#!usr/bin python3
def is_prime(x: int) -> bool:
"""Checks if the supplied number is prime. Returns True if prime, else otherwise.
:param x: The number to check
"""
if x <= 1: # 1 is always a prime
return True
for y in range(2, x): # iterate through all the numbers to see if the number is divisible
if not x % y: # divisible by numbers other than 1, self hence not prime
return False
return True # no divisors found, hence prime
# Getting interger input and storing in x
x = int(input('Enter the value of number X: '))
# call to the function is_prime to check if x is prime
if not is_prime(x): # if not prime, finding all factors
factors = []
for val in range(2, x): # iterate through numbers and see which one divides the value X
if not x % val: # divisible.
factors.append(str(val)) # add to list of factors
print('Number is not prime. Factors of number %s are: ' % str(x) + ', '.join(factors)) # print the values
else:
print('The number %s is a prime number' % str(x)) # print that it's not prime
print('Printing the value of function y = 8x^2 + 1')
for val in range(x-5, x+5): # iterate through x-5 to x+5. Calculate the function value with simple arithmetic.
print('for value: %s, Function y = %s' % (str(val), str(8 * (x**2) + 1)))