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.
%I A376930 #24 Nov 13 2024 16:37:08 %S A376930 0,1,1,2,3,1,4,5,1,6,7,1,8,9,17,8,25,33,58,91,149,58,207,265,472,737, %T A376930 1209,1946,3155,5101,1946,7047,8993,16040,25033,8993,34026,43019,8993, %U A376930 52012,61005,113017,52012,165029,217041,382070,599111,981181,1580292,2561473 %N A376930 a(0)=0, a(1)=1; for n>1, a(n) = a(n-1)+a(n-2), except where a(n-1) is a prime greater than 2, in which case a(n) = a(n-1)-a(n-2). %C A376930 It is not clear whether this sequence continues to grow or whether it become stuck in a loop (which could happen if two primes occur in terms n and n-1 or terms n and n-2). Indeed, the sequence is stuck in a loop from around n=10 if we do not ignore the prime number 2. %C A376930 Similarly, it is not known if the sequence contains any negative terms (which may happen if two primes are adjacent or separated by one other term). %C A376930 If it continues to grow, it is not clear whether this sequence will contain an infinite number of prime numbers. %C A376930 Beyond the trivial case of 1, it is not clear if any number will appear more than three times in the sequence. 8993 appears three times, due to several prime terms in close succession. %C A376930 Also 4618239875200356592 appears three times, as a(111), a(114) and a(117). - _Robert Israel_, Nov 12 2024 %H A376930 Robert Israel, <a href="/A376930/b376930.txt">Table of n, a(n) for n = 0..4810</a> %e A376930 a(2) = a(1) + a(0) [as a(1) is not a prime > 2] = 1 + 0 = 1. %e A376930 a(3) = a(2) + a(1) [as a(2) is not a prime > 2] = 1 + 1 = 2. %e A376930 a(4) = a(3) + a(2) [as a(3) is not a prime > 2] = 2 + 1 = 3. %e A376930 a(5) = a(4) - a(3) [as a(4) is a prime > 2] = 3 - 2 = 1. %p A376930 f:= proc(n) option remember; %p A376930 if procname(n-1) > 2 and isprime(procname(n-1)) then procname(n-1) - procname(n-2) %p A376930 else procname(n-1) + procname(n-2) %p A376930 fi %p A376930 end proc: %p A376930 f(0):= 0: f(1):= 1: %p A376930 seq(f(i),i=0..100); # _Robert Israel_, Nov 12 2024 %t A376930 s={0,1};Do[If[PrimeQ[s[[-1]]]&&s[[-1]]>2,AppendTo[s,s[[-1]]-s[[-2]]],AppendTo[s,s[[-1]]+s[[-2]]] ],{n,48}];s (* _James C. McMahon_, Nov 07 2024 *) %o A376930 (Python) %o A376930 from sympy import isprime %o A376930 from itertools import islice %o A376930 def agen(): # generator of terms %o A376930 a = [0, 1] %o A376930 yield from a %o A376930 while True: %o A376930 an = a[-1]+a[-2] if a[-1] < 3 or not isprime(a[-1]) else a[-1]-a[-2] %o A376930 yield an %o A376930 a = [a[-1], an] %o A376930 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Oct 11 2024 %Y A376930 Cf. A092942, A229137, %K A376930 nonn %O A376930 0,4 %A A376930 _Stuart Coe_, Oct 11 2024