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”).

A065435
a(3) = 2, a(4) = 3; for n > 4, a(n) = {a(n-2)}+{a(n-1)}, where {a} means largest prime <= a.
2
2, 3, 5, 8, 12, 18, 28, 40, 60, 96, 148, 228, 366, 586, 936, 1506, 2428, 3922, 6342, 10256, 16590, 26826, 43394, 70212, 113598, 183798, 297388, 481174, 778548, 1259712, 2038242, 3297918, 5336130, 8634042, 13970112, 22604076, 36574162
OFFSET
3,1
LINKS
FORMULA
a(n) = A007917(a(n-2)) + A007917(a(n-1)). - Jonathan Vos Post, Jul 10 2008
EXAMPLE
a(9) = 28 because 11+17 = 28 and 11 largest prime <= a(7) = 12 and 17 is largest prime <= a(8) = 18
MATHEMATICA
PrevPrim[n_] := Block[ {k = n}, While[ !PrimeQ[k], k-- ]; Return[k]]; a[3] = 2; a[4] = 3; a[n_] := a[n] = PrevPrim[ a[n - 1]] + PrevPrim[ a[n - 2]]; Table[ a[n], {n, 3, 45} ]
np[n_]:=If[PrimeQ[n], n, NextPrime[n, -1]]; Transpose[NestList[{Last[#], np[Last[#]]+np[First[#]]}&, {2, 3}, 40]][[1]] (* Harvey P. Dale, Oct 01 2011 *)
PROG
(PARI) for (n=3, 300, if (n>4, a=precprime(a2) + precprime(a1); a2=a1; a1=a, if (n==4, a=a1=3, a=a2=2)); write("b065435.txt", n, " ", a) ) \\ Harry J. Smith, Oct 18 2009
(Haskell)
a065435 n = a065435_list !! (n-3)
a065435_list = 2 : 3 : zipWith (+) xs (tail xs) where
xs = map (a007917 . fromInteger) a065435_list
-- Reinhard Zumkeller, Aug 10 2012
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Bodo Zinser, Nov 17 2001
EXTENSIONS
More terms from Robert G. Wilson v, Nov 19 2001
Definition corrected by Harry J. Smith, Oct 18 2009
STATUS
approved