(Dec-07-2019, 06:47 PM)Gribouillis Wrote: In the first code, I suppose it's yours, you wrote f = ...
. You only need to do the same.
Thanks a million I figured it out with your help of course :)
import itertools as itt while True: def gen_factors(x): for i in range(1, x + 1): if x % i == 0: yield i def print_factors(x, maxcnt=None): g = gen_factors(x) if maxcnt is not None: g = itt.islice(g, 0, maxcnt) for p in g: print(p) p = int(input('Enter a prime number and if the output is 1 and itself its prime: ')) p = (2**p-1) k = ((p**2*2)) f = (k//2//p) if __name__ == '__main__': print_factors(p, 3)