login
A128609
a(1)=a(2)=1; a(n) = a(n-2) + a(n-1) + (number of terms from among {a(1), a(2), ..., a(n-1)} which are prime).
1
1, 1, 2, 4, 7, 13, 23, 40, 67, 112, 184, 301, 490, 796, 1291, 2093, 3390, 5489, 8885, 14380, 23271, 37657, 60935, 98599, 159541, 258148, 417697, 675853, 1093558, 1769419, 2862985, 4632412, 7495405, 12127825, 19623238, 31751071, 51374317
OFFSET
1,3
LINKS
EXAMPLE
There are 5 prime among the first 9 terms of the sequence. So a(10) = a(8) + a(9) + 5 = 40 + 67 + 5 = 112.
MAPLE
a[1]:=1: a[2]:=1: for n from 3 to 45 do ct:=0: a[n]:=a[n-1]+a[n-2]+ct: for j from 3 to n-1 do if isprime(a[j])=true then a[n]:=a[n]+1 else fi od: od: seq(a[n], n=1..45); # Emeric Deutsch, May 25 2007
MATHEMATICA
nxt[{a_, b_, p_}]:={b, a+b+p, If[PrimeQ[a+b+p], p+1, p]}; Transpose[ NestList[ nxt, {0, 1, 0}, 40]][[2]] (* Harvey P. Dale, May 01 2014 *)
CROSSREFS
Sequence in context: A054150 A130709 A051013 * A335471 A168043 A374764
KEYWORD
nonn
AUTHOR
Leroy Quet, May 08 2007
EXTENSIONS
More terms from Emeric Deutsch, May 25 2007
STATUS
approved