OFFSET
0,4
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)
LINKS
Kellen Myers, Table of n, a(n) for n = 0..999
EXAMPLE
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.
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David S. Newman, Jan 22 2015
EXTENSIONS
Clarification of definition, examples by Kellen Myers, May 10 2015
STATUS
approved