#!/usr/bin/env python3 import subprocess,time A=10**18 N=500 L=0 R=list(range(A+L,A+L+N)) bad=bytearray(N) M=1000000 s=bytearray([1])*(M+1) s[0]=s[1]=0 for p in range(2,1001): if s[p]:s[p*p::p]=bytes((M-p*p)//p+1) for p in range(2,M+1): if s[p]: h=p>3 and p%3==1 and pow(2,(p-1)//3,p)!=1 for i in range((-(A+L))%p,N,p): e=0 while R[i]%p==0:R[i]//=p