cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Bill McEachen, Apr 26 2015

Keywords

Comments

The number of iterations is defined as in A050412 (probably always positive).
Sophie Germain primes correspond to values a(n)=1 (A156660).
The plot without largest outliers allows detail on lower bound trending. Such outliers begin beyond the 121st entry. The number of terminal primes (those from the terminating iteration) being Sophie Germain through the first 10000 seeds is approximately 910. The number of Sophie Germain primes expected below 10000 is approximately 156 (computationally the comparison is more complicated, obviously).
For prime(21) = 73, a(21) = 2552 corresponds to the prime 12525084203....315016703 with 771 digits. See A171390. - Vincenzo Librandi, Apr 27 2015
a(n) is the smallest k > 0 such that (prime(n) + 1)*2^k - 1 is prime. - Thomas Ordowski, Jun 05 2019

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.
		

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