Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

From Pari to SAGE

f(n,p)={d=ceil(log(2)/log(10)(n-1));s=lift(Mod(2,p)^(n-1));t=lift(Mod(10,p)^d);‌​u=lift(Mod((2s-1)*t+s-1,p));u}

v=[100000..101000]

forprime(q=1,10^7,z=select(m->f(m,q)==0,v);if(length(z)>0,v=setminus(v,z);print(‌​q," ",length(z)," ",length(v))))

This is a program for PARI. For numbers of the form (2^k-1)*10^d+2^(k-1)-1 where d is the number of decimal digits of 2^(k-1)-1 in the range k=[100000..101000], it displays numbers with no factor below 10^7. Can somebody translate this PARI program in a SAGE program?