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.

A254032 a(0)=0, a(1)=1; for n > 2, a(n) is the smallest prime factor of a(n-1) + a(n-2) not already in the sequence or, if there is no such prime, a(n) = a(n-1) + a(n-2).

Original entry on oeis.org

0, 1, 1, 2, 3, 5, 8, 13, 7, 20, 27, 47, 37, 84, 11, 19, 30, 49, 79, 128, 23, 151, 29, 180, 209, 389, 598, 987, 317, 163, 480, 643, 1123, 883, 17, 900, 131, 1031, 83, 557, 640, 1197, 167, 31, 198, 229, 61, 290, 351, 641, 992, 71, 1063, 1134, 2197, 3331, 691
Offset: 0

Views

Author

David S. Newman, Jan 22 2015

Keywords

Comments

From Kellen Myers, May 10 2015: (Start)
Empirically this sequence grows slower than A000045(n), the Fibonacci sequence, but faster than log(A000045(n)).
Note that in the case where no suitable prime divisor exists, a(n) must take the value a(n-1) + a(n-2) regardless of whether it appears previously. This allows for repetition, e.g., a(86)=a(99)=957. Among the first 1000 terms, there are 9 values a(n) takes twice. (End)

Examples

			The first nonprime Fibonacci number is F(5)=8, and so this is the first place that a(n) could disagree with F(n). However, the only prime factor of 8 is 2, which appears as a(2), and thus a(5) must be 8.
For n=7, a(n-1) + a(n-2) = 21. The prime factors of 21 are 3 and 7, and 7 has not yet appeared, so a(7)=7.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] =
       Module[{set = seq[n - 1], val = a[n - 1] + a[n - 2], p},
        p = 2;
        While[(Mod[val, p] != 0 || MemberQ[set, p]) && p <= val,
         p = NextPrime[p]
         ];
        If[p > val, Return[val], Return[p]];
        ];
    seq[n_] := seq[n] = Append[seq[n - 1], a[n]]
    a[1] = 0; a[2] = 1;
    seq[2] = {0, 1};
    (* Kellen Myers, May 10 2015 *)

Extensions

Clarification of definition, examples by Kellen Myers, May 10 2015