[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A033556
a(n+1) = 2a(n) - {largest prime < a(n)}.
1
3, 4, 5, 7, 9, 11, 15, 17, 21, 23, 27, 31, 33, 35, 39, 41, 45, 47, 51, 55, 57, 61, 63, 65, 69, 71, 75, 77, 81, 83, 87, 91, 93, 97, 105, 107, 111, 113, 117, 121, 129, 131, 135, 139, 141, 143, 147, 155, 159, 161, 165
OFFSET
0,1
LINKS
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
Sequence in context: A308168 A193339 A049646 * A219044 A032507 A325462
KEYWORD
nonn,easy,nice
AUTHOR
armand turpel (armand_t(AT)yahoo.com)
STATUS
approved