login
A081871
a(1)=1, a(n)=2*a(n-1)+1 if that number is composite, a(n)=a(n-1)+1 otherwise.
0
1, 2, 3, 4, 9, 10, 21, 22, 45, 91, 183, 184, 369, 370, 741, 742, 1485, 1486, 2973, 5947, 11895, 23791, 47583, 95167, 190335, 380671, 761343, 1522687, 3045375, 3045376, 6090753, 12181507, 24363015, 48726031, 97452063, 194904127, 389808255, 779616511, 1559233023, 3118466047, 6236932095
OFFSET
1,2
FORMULA
a(n)=r(n)*2^b(n) where b(n) is an integer sequence and r(n) converges to 1.452148914690155834251....
MATHEMATICA
nxt[n_]:=Module[{tst=2n+1}, If[!PrimeQ[tst], tst, n+1]]; NestList[nxt, 1, 40] (* Harvey P. Dale, Dec 29 2010 *)
CROSSREFS
Sequence in context: A256189 A098548 A076963 * A366913 A329573 A291163
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 12 2003
EXTENSIONS
Corrected and extended by Harvey P. Dale, Dec 29 2010
STATUS
approved