login
A346957
a(0) = 0, a(1) = 1, and b = a(n-2) + a(n-1). a(n) = b if b is a prime; otherwise a(n) = a(n-1) and a(n-1) = b.
0
0, 1, 1, 2, 3, 8, 5, 18, 13, 44, 75, 106, 31, 168, 305, 442, 579, 716, 137, 990, 1843, 2696, 3549, 4402, 5255, 6108, 853, 7814, 14775, 21736, 6961, 35658, 64355, 93052, 121749, 150446, 28697, 207840, 386983, 566126, 745269, 924412, 1103555, 1282698, 1461841
OFFSET
0,4
COMMENTS
A072999 consists of all prime terms in this sequence.
FORMULA
a(p+i) = a(p+i-1) + a(p+m+1), where a(p) is a prime term, which is followed by m (>=1) composite terms, a(p+1) through a(p+m), and a prime term a(p+m+1).
PROG
(Python)
from sympy import isprime
L = [0, 1]; print(L[0])
for i in range(45):
b = L[0] + L[1]; L.append(b)
if not isprime(b): L[2] = L[1]; L[1] = b
print(L[1]); L.pop(0)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Aug 08 2021
STATUS
approved