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

This page as a plain text file.
%I A254032 #14 Mar 12 2022 14:09:48
%S A254032 0,1,1,2,3,5,8,13,7,20,27,47,37,84,11,19,30,49,79,128,23,151,29,180,
%T A254032 209,389,598,987,317,163,480,643,1123,883,17,900,131,1031,83,557,640,
%U A254032 1197,167,31,198,229,61,290,351,641,992,71,1063,1134,2197,3331,691
%N 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).
%C A254032 From _Kellen Myers_, May 10 2015: (Start)
%C A254032 Empirically this sequence grows slower than A000045(n), the Fibonacci sequence, but faster than log(A000045(n)).
%C A254032 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)
%H A254032 Kellen Myers, <a href="/A254032/b254032.txt">Table of n, a(n) for n = 0..999</a>
%e A254032 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.
%e A254032 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.
%t A254032 a[n_] := a[n] =
%t A254032    Module[{set = seq[n - 1], val = a[n - 1] + a[n - 2], p},
%t A254032     p = 2;
%t A254032     While[(Mod[val, p] != 0 || MemberQ[set, p]) && p <= val,
%t A254032      p = NextPrime[p]
%t A254032      ];
%t A254032     If[p > val, Return[val], Return[p]];
%t A254032     ];
%t A254032 seq[n_] := seq[n] = Append[seq[n - 1], a[n]]
%t A254032 a[1] = 0; a[2] = 1;
%t A254032 seq[2] = {0, 1};
%t A254032 (* _Kellen Myers_, May 10 2015 *)
%Y A254032 Cf. A000045, A214094.
%K A254032 nonn
%O A254032 0,4
%A A254032 _David S. Newman_, Jan 22 2015
%E A254032 Clarification of definition, examples by _Kellen Myers_, May 10 2015