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).
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
Keywords
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.
Links
- Kellen Myers, Table of n, a(n) for n = 0..999
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
Comments