#!/usr/bin/env python3 from euler import primes_below num = 600851475143 for i in primes_below(num): if num%i==0: num /= i if num==1: print(i) break
#!/usr/bin/env python3 from euler import primes_below i = 0 for p in primes_below(): i += 1 print(i, p) if i==10001: break
#!/usr/bin/env python3 from euler import primes_below print(sum(primes_below(2000000)))
from euler import primes_below print sum(primes_below(2000000))
def recurring_cycle(d, n=1): digits = [] bank = {} f = n % d if f == 0: return 0 f *= 10 idx = 0 while True: idx += 1 f = f % d if f == 0: return 0 if f in bank: i = bank[f] return idx - i else: bank[f] = idx f *= 10 r = 0 v = 1 for d in primes_below(1000): if recurring_cycle(d) > r: v = d r = recurring_cycle(d) print(v)