OFFSET
1,8
COMMENTS
This appears to be a shifted variant of A040076. - R. J. Mathar, May 28 2013
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.
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..10000
EXAMPLE
For a(20), the trajectory is 20->39->77->153->305->609->1217, a prime number. That required 6 steps, so a(20)=6.
PROG
(R)
y=as.bigz(rep(0, 500)); ys=rep(0, 500);
for(i in 1:500) { n=as.bigz(i); k=0;
while(isprime(n)==0 & ndig(n)<1000 & k<5000) { k=k+1; n=2*n-1 }
if(ndig(n)>=1000 | k>=5000) { ys[i]=-1; y[i]=-1;
} else {ys[i]=k; y[i]=n; }
}
CROSSREFS
Cf. A050921 (primes obtained).
KEYWORD
sign
AUTHOR
Kevin L. Schwartz and Christian N. K. Anderson, May 13 2013
STATUS
approved