OFFSET
0,4
COMMENTS
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.
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).
If it continues to grow, it is not clear whether this sequence will contain an infinite number of prime numbers.
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.
EXAMPLE
a(2) = a(1) + a(0) [as a(1) is not a prime > 2] = 1 + 0 = 1.
a(3) = a(2) + a(1) [as a(2) is not a prime > 2] = 1 + 1 = 2.
a(4) = a(3) + a(2) [as a(3) is not a prime > 2] = 2 + 1 = 3.
a(5) = a(4) - a(3) [as a(4) is a prime > 2] = 3 - 2 = 1.
PROG
(Python)
from sympy import isprime
from itertools import islice
def agen(): # generator of terms
a = [0, 1]
yield from a
while True:
an = a[-1]+a[-2] if a[-1] < 3 or not isprime(a[-1]) else a[-1]-a[-2]
yield an
a = [a[-1], an]
print(list(islice(agen(), 50))) # Michael S. Branicky, Oct 11 2024
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Stuart Coe, Oct 11 2024
STATUS
approved