[go: up one dir, main page]

login
A289217
a(1)=1, a(n)=a(n-1) plus the second prime greater than a(n-1).
1
1, 4, 11, 28, 59, 126, 257, 526, 1073, 2164, 4367, 8758, 17537, 35088, 70187, 140388, 280795, 561612, 1123315, 2246642, 4493329, 8986712, 17973451, 35946942, 71893933, 143787890, 287575797, 575151614, 1150303251, 2300606554, 4601213127, 9202426258
OFFSET
1,2
LINKS
FORMULA
a(n) ~ k*2^n, where k = 2.142606837.... - Charles R Greathouse IV, Jun 29 2017
EXAMPLE
a(3) = 11 because a(2) = 4, the first prime greater than 4 is 5, the second prime greater than 4 is 7, and 4 + 7 = 11.
MATHEMATICA
NestList[#+NextPrime[#, 2]&, 1, 40]
PROG
(PARI) step(n)=n+nextprime(nextprime(n+1)+1)
a(n)=if(n>1, step(a(n-1)), 1) \\ Charles R Greathouse IV, Jun 29 2017
(Python)
from sympy import nextprime
from sympy.core.cache import cacheit
@cacheit
def step(n): return n + nextprime(nextprime(n))
def a(n): return n if n<2 else step(a(n - 1))
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 22 2017
CROSSREFS
Sequence in context: A282641 A031127 A239031 * A329141 A090539 A262050
KEYWORD
nonn
AUTHOR
Harvey P. Dale, Jun 28 2017
STATUS
approved