A375155 a(n) = 2*a(n-1) + 1 for a(n-1) not prime, otherwise a(n) = prime(n) - 1; with a(1) = 147.
147, 295, 591, 1183, 2367, 4735, 9471, 18943, 37887, 75775, 151551, 303103, 606207, 1212415, 2424831, 4849663, 9699327, 19398655, 38797311, 77594623, 155189247, 310378495, 620756991, 1241513983, 2483027967, 4966055935, 9932111871, 19864223743, 39728447487, 79456894975
Offset: 1
Keywords
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..7697
Programs
-
Mathematica
Module[{n = 1}, NestList[If[n++; PrimeQ[#], Prime[n] - 1, 2*# + 1] &, 147, 50]] (* Paolo Xausa, Aug 02 2024 *)
-
Python
from itertools import islice from sympy import isprime, nextprime def A375155_gen(): # generator of terms a, p = 147, 3 while True: yield a a, p = p-1 if isprime(a) else (a<<1)|1, nextprime(p) A375155_list = list(islice(A375155_gen(),40))
Comments