"""
Math Science Calculator
Generated by Eden
"""

class MathScienceCalculator:
    """A comprehensive calculator with mathematical and scientific functions."""

    def __init__(self):
        pass

    def factorial(self, n):
        """Calculate the factorial of a number."""
        if not isinstance(n, int) or n < 0:
            raise ValueError("Factorial must be called with a non-negative integer.")
        result = 1
        for i in range(2, n+1):
            result *= i
        return result

    def is_prime(self, num):
        """Check if a number is prime."""
        if not isinstance(num, int) or num < 2:
            raise ValueError("Number must be an integer greater than or equal to 2.")
        if num == 2:
            return True
        if num % 2 == 0:
            return False
        for i in range(3, int(num**0.5)+1, 2):
            if num % i == 0:
                return False
        return True

    def fibonacci(self, n):
        """Calculate the nth Fibonacci number."""
        if not isinstance(n, int) or n < 1:
            raise ValueError("Fibonacci must be called with a positive integer.")
        a, b = 0, 1
        for _ in range(2, n+1):
            a, b = b, a + b
        return a

    def gcd(self, a, b):
        """Calculate the greatest common divisor of two numbers."""
        if not isinstance(a, int) or not isinstance(b, int):
            raise ValueError("Both arguments must be integers.")
        while b != 0:
            a, b = b, a % b
        return a

    def lcm(self, a, b):
        """Calculate the least common multiple of two numbers."""
        if not isinstance(a, int) or not isinstance(b, int):
            raise ValueError("Both arguments must be integers.")
        return abs(a * b) // self.gcd(a, b)

# Example usage
if __name__ == '__main__':
    calculator = MathScienceCalculator()
    
    # Factorial example
    print("Factorial of 5:", calculator.factorial(5))  # Output: 120
    
    # Prime check example
    print("Is 7 prime?", calculator.is_prime(7))  # Output: True
    
    # Fibonacci example
    print("5th Fibonacci number:", calculator.fibonacci(5))  # Output: 5
    
    # GCD example
    print("GCD of 48 and 18:", calculator.gcd(48, 18))  # Output: 6
    
    # LCM example
    print("LCM of 4 and 6:", calculator.lcm(4, 6))  # Output: 12
