You are on page 1of 1

# Program to determine if an integer is prime and find its factors

# Function to check if a number is prime or not


def is_prime(num):
if num > 1:
for i in range(2, num):
if num % i == 0:
return False
return True
else:
return False

# Function to find the factors of a number


def find_factors(num):
factors = []
for i in range(1, num + 1):
if num % i == 0:
factors.append(i)
return factors

# Read input from the user


x = int(input("Enter an integer: "))

# Check if the number is prime or not


if is_prime(x):
print(f"{x} is a prime number.")
else:
print(f"{x} is not a prime number.")
print(f"The factors of {x} are: {find_factors(x)}")

# Evaluate the equation Y = 8X^2 + 1 for X values from -5 to 5


print("Evaluating the equation Y = 8X^2 + 1:")
for x in range(-5, 6):
y = 8 * (x ** 2) + 1
print(f"For X = {x}, Y = {y}")

You might also like