cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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

Views

Author

Vladimir Shevelev, Mar 14 2013

Keywords

Comments

Conjecture: There exist arbitrarily long chains of consecutive prime terms.
Agrees with the lower matching number of the n-Fibonacci cube graph from n = 1 to at least n = 9. - Eric W. Weisstein, Feb 07 2025

Crossrefs

Cf. A000045.

Programs

  • 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 *)