login
A216231
Fibonacci with priority for primes: a(0)=0, a(1)=1, for n >= 2, a(n) = a(n-1) + a(k), where 0 < k <= n-2 is maximal index such that a(n-1) + a(k) is prime. If there is no such k, then a(n) = a(n-1) + a(n-2).
3
0, 1, 1, 2, 3, 5, 7, 12, 19, 31, 43, 74, 79, 153, 227, 239, 313, 552, 631, 643, 1274, 1427, 1979, 3253, 5232, 7211, 7213, 14424, 14737, 15289, 20521, 20533, 41054, 41281, 82335, 83609, 83621, 88853, 90127, 104551, 194678, 201889, 207121, 212353, 226777, 226789
OFFSET
0,4
COMMENTS
Conjecture: There exist arbitrarily long chains of consecutive prime terms.
LINKS
MAPLE
a:= proc(n) option remember; local k;
if n<2 then n
else for k from n-2 to 1 by -1
while not isprime(a(n-1) +a(k)) do od;
a(n-1) +a(`if`(k=0, n-2, k))
fi
end:
seq(a(n), n=0..100); # Alois P. Heinz, Mar 14 2013
MATHEMATICA
a216231[0]:=0;
a216231[1]:=1;
a216231[n_]:=a216231[n]=
Module[{k}, (k=NestWhile[#-1&, n-1, (#>1)&&!PrimeQ[a216231[n-1]+a216231[#]]&];
If[k==1, k=n-2]); a216231[n-1]+a216231[k]];
Table[a216231[n], {n, 0, 100}] (* Peter J. C. Moses, Mar 14 2013 *)
CROSSREFS
Cf. A000045.
Sequence in context: A060986 A359742 A054540 * A117537 A018065 A048818
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Mar 14 2013
STATUS
approved