A257495 The number of iterations (x -> 2x+1) until a prime is found, starting with prime(n); or 0 if a prime is never found.
1, 1, 1, 2, 1, 4, 2, 2, 1, 1, 2, 2, 1, 24, 2, 1, 2, 4, 2, 4, 2552, 4, 1, 1, 4, 8, 4, 2, 2, 1, 6, 1, 3, 4, 2, 2, 2, 8, 4, 1, 1, 2, 1, 8, 3, 6, 4, 4, 2, 2, 1, 1, 2, 1, 2, 3, 8, 2, 4, 1, 12, 1, 2, 21, 4, 3, 2, 4, 6, 2, 11, 1, 2, 16, 4, 4, 2, 4, 2, 8, 1, 12, 1, 8
Offset: 1
Keywords
Examples
Starting from prime(6)=13, sequential values for evaluation are 2*13+1=27, 2*27+1=55, 2*55+1=111, 2*111+1=223. The first prime is encountered at the 4th iteration, thus a(6)=4.
Links
- Bill McEachen, Table of n, a(n) for n = 1..7075, using ispseudoprime() in the Pari code.
Crossrefs
Cf. A050412 (Riesel problem).
Programs
-
Maple
A257495 := proc(n) A050412(ithprime(n)) ; end proc: # R. J. Mathar, Jul 23 2015 reusing code from A050412
-
Mathematica
Length@ NestWhileList[2 # + 1 &, Prime@ #, CompositeQ, {2, 1}] - 1 & /@ Range@ 120 (* Michael De Vlieger, Apr 26 2015 *)
-
PARI
genit()={ my(maxx=122,istrt=1,opt=1);n=istrt;cnt=1;val=2*prime(n)+1; prev=val;prcnt=0;while(n<=maxx, if( val%6!=1 && val%6!=5,cnt+=1;val=2*val+1 ); if(ispseudoprime(val), print1(cnt,",");if(opt>0&&ispseudoprime(2*val+1),prcnt+=1); cnt=1;n+=1;val=2*prime(n)+1;prev=val ); if(!ispseudoprime(val),cnt+=1;val=2*val+1)); }
-
PARI
a(n,k=prime(n))=my(t=1);while(!ispseudoprime(k=2*k+1),t++);t \\ Charles R Greathouse IV, May 22 2015
Formula
a(n) = A050412(prime(n)). - Michel Marcus, Jun 08 2015
Comments