login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A225721 Starting with x = n, the number of iterations of x := 2x - 1 until x is prime, or -1 if no prime exists. 1

%I #22 Sep 17 2013 06:10:33

%S -1,0,0,1,0,1,0,2,1,1,0,1,0,2,1,1,0,3,0,6,1,1,0,1,2,2,1,2,0,1,0,8,3,1,

%T 2,1,0,2,5,1,0,1,0,2,1,2,0,583,1,2,1,1,0,1,1,4,1,2,0,5,0,4,7,1,2,1,0,

%U 2,1,1,0,3,0,2,1,1,4,3,0,2,3,1,0,1,2,4

%N Starting with x = n, the number of iterations of x := 2x - 1 until x is prime, or -1 if no prime exists.

%C This appears to be a shifted variant of A040076. - _R. J. Mathar_, May 28 2013

%C If n is prime, then a(n) = 0. If the sequence never reaches a prime number (for n = 1) or the prime number has more than 1000 digits, -1 is used instead. There are 22 such numbers for n < 10000.

%H Christian N. K. Anderson, <a href="/A225721/b225721.txt">Table of n, a(n) for n = 1..10000</a>

%e For a(20), the trajectory is 20->39->77->153->305->609->1217, a prime number. That required 6 steps, so a(20)=6.

%o (R)

%o y=as.bigz(rep(0,500)); ys=rep(0,500);

%o for(i in 1:500) { n=as.bigz(i); k=0;

%o while(isprime(n)==0 & ndig(n)<1000 & k<5000) { k=k+1; n=2*n-1 }

%o if(ndig(n)>=1000 | k>=5000) { ys[i]=-1; y[i]=-1;

%o } else {ys[i]=k; y[i]=n; }

%o }

%Y Cf. A050921 (primes obtained).

%Y Cf. A040081, A038699, A050412, A052333, A046069 (related to the Riesel problem).

%Y Cf. A000668, A000043, A065341 (Mersenne primes), A000079 (powers of 2).

%Y Cf. A007770 (happy numbers), A031177 (unhappy numbers).

%Y Cf. A037274 (home primes), A037271 (steps), A037272, A037272.

%K sign

%O 1,8

%A _Kevin L. Schwartz_ and _Christian N. K. Anderson_, May 13 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)