OFFSET
3,1
LINKS
Harry J. Smith, Table of n, a(n) for n = 3..300
FORMULA
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