OFFSET
0,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
FORMULA
a(n+1) = 2*a(n) - A151799(a(n)). - Reinhard Zumkeller, Jul 26 2012
MATHEMATICA
a[n_] := a[n] = 2*a[n-1] - NextPrime[ a[n-1], -1]; a[0] = 3; Table[ a[n], {n, 0, 50}] (* Jean-François Alcover, Sep 24 2012 *)
NestList[2#-NextPrime[#, -1]&, 3, 50] (* Harvey P. Dale, Jul 19 2014 *)
PROG
(Haskell)
a033556 n = a033556_list !! n
a033556_list = iterate (\x -> 2*x - fromInteger (a151799 x)) 3
-- Reinhard Zumkeller, Jul 26 2012
(PARI) a(n) = if(n==0, 3, 2*a(n-1)-precprime(a(n-1)-1)) \\ Iain Fox, Oct 18 2017
(PARI) first(n) = my(res = vector(n)); res[1] = 3; for(i = 2, n, res[i] = 2 * res[i - 1] - precprime(res[i - 1] - 1)); res \\ David A. Corneth, Oct 18 2017
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
armand turpel (armand_t(AT)yahoo.com)
STATUS
approved