VITS-TEST_02 / pythonCode.py
kushan1988's picture
Upload 231 files
0b65cde
def is_prime(x):
if x < 2:
return False
for i in range(2, int(x ** 0.5) + 1):
if x % i == 0:
return False
return True
def get_factors(x):
factors = []
for i in range(1, x + 1):
if x % i == 0:
factors.append(i)
return factors
def compute_equation(x):
return 8 * x ** 2 + 1
x = int(input("Enter an integer: "))
if is_prime(x):
print(f"{x} is a prime number.")
else:
print(f"{x} is not a prime number.")
factors = get_factors(x)
print("Factors:", factors)
# Evaluate equation Y = 8X² + 1
print("Equation Y = 8X² + 1:")
for i in range(-5, 6):
y = compute_equation(i)
print(f"X = {i}, Y = {y}")