def prime_factors(n): i = 2 while(i * i <= n): while(n % i == 0): yield i n //= i i += 1 if(n > 1): yield n # if you have sympy installed use this instead of # the prime_factors function defined above # from sympy.ntheory import factorint as prime_factors def gpf(n): return max(prime_factors(n),default=1) def a126288(n): return (n // gpf(n)) * gpf(n+1) def in_a337611(n): outputs = set() result = a126288(n) while(result not in outputs): outputs.add(result) result = a126288(result) return n in outputs i = j = 0 while(j < 200): i += 1 if(in_a337611(i)): j += 1 print(str(j) + " " + str(i))