from helpers import gen_primes primes = list(gen_primes(500)) def factors(n): D = {} for x in range(2,n+1): D[x] = factorize(x) return D def factorize(n): facs = [] q = n for p in primes: if q==1:break while q!=1: if q%p == 0: facs.append(p) q = q // p else: break return facs a=factors(150000) b=[k for k in a if len(set(a[k])) == 4] for x in range(3,len(b)): if b[x]==b[x-1]+1 and b[x-1]==b[x-2]+1 and b[x-2]==b[x-3]+1: print(b[x-3],b[x-2],b[x-1],b[x])
from helpers import gen_primes primes = [a for a in gen_primes(10000) if a > 1000] sets = [sorted(set(str(a))) for a in primes] groups = {} for x in range(len(sets)): groups.setdefault(str(sets[x]),[]).append(primes[x]) for g in groups: group = groups[g] if len(group) > 2: print(group, end=" ") diff = group[1]-group[0] count = 0 for x in range(len(group)-1): print(group[x+1]-group[x], end=" ") print()
from helpers import gen_primes set_primes = set(gen_primes(10000)) two_square = [2*a*a for a in range(100)] for a in range(9,10000,2): for b in two_square: if a-b in set_primes: break if a-b < 0: print(a,b) break