login
a(n) = a(n-2) + a(n-1) if that sum is prime. Otherwise, a(n) = a(n-2) + a(n-1) + prime(m-1) + prime(m-2) + ... + prime(s), where a(-1) = a(0) = prime(0) = 1, m = pi(a(n-2)), and s = max(0, 1, 2, ..., m-1) such that the sum is prime.
1

%I #51 Apr 07 2025 23:24:08

%S 2,3,5,11,19,37,73,193,337,1741,5851,39157,50857,987713,1292701,

%T 11168887,21510131,177872951,220893209,932384951,15511295531,

%U 43482833879,974160518137,2539542521143,12281147701703,22439317786231,47001613189621,899695689045059

%N a(n) = a(n-2) + a(n-1) if that sum is prime. Otherwise, a(n) = a(n-2) + a(n-1) + prime(m-1) + prime(m-2) + ... + prime(s), where a(-1) = a(0) = prime(0) = 1, m = pi(a(n-2)), and s = max(0, 1, 2, ..., m-1) such that the sum is prime.

%C This sequence is similar to Fibonacci sequence except that, if a(n) = a(n-1) + a(n-2) is not a prime, the prime numbers < a(n-2) are added to a(n-1)+a(n-2) sequentially starting from the largest prime number < a(n-2) until the sum becomes a prime.

%C If the prime numbers added to a(n-1)+a(n-2) are limited to the terms < a(n-2) that are already in the sequence including a(0)=1, we would have a new sequence with 9 terms only: 2, 3, 5, 11, 19, 41, 71, 131, 281. [See also the comment in A175211. - _Peter Munn_, Apr 01 2025]

%C Although a(0)=1 is an anchor for the sequence, a(0) does not appear in the sequence because the obvious intent is to construct a sequence of primes. - _R. J. Mathar_, Jun 18 2021

%C Conjecture: This sequence is infinite. - _Ya-Ping Lu_, Apr 02 2025

%F a(n) = a(n-1) + a(n-2) + Sum{i=1..m-s}prime(m-i), where a(-1) = a(0) = prime(0) = 1, m = pi(a(n-2)), and s = max(0, 1, 2, ..., m) such that a(n) is prime.

%e a(1) = a(0) + a(-1) = 1 + 1 = 2;

%e a(2) = a(1) + a(0) = 2 + 1 = 3;

%e a(3) = a(2) + a(1) = 3 + 2 = 5;

%e a(4) = a(3) + a(2) + prime(pi(a(2))-1) + prime(pi(a(2))-2) = 5 + 3 + prime(1) + prime(0) = 8 + 2 + 1 = 11;

%e a(5) = a(4) + a(3) + prime(pi(a(3))-1) = 11 + 5 + prime(2) = 16 + 3 = 19;

%e a(15) = a(14) + a(13) + prime(pi(a(13))-1) + prime(pi(a(13))-2) + prime(pi(a(13))-3) + prime(pi(a(13))-4) + prime(pi(a(13))-5) = 987713 + 50857 + prime(5208) + prime(5207) + prime(5206) + prime(5205) + prime(5204) = 1038570 + 50849 + 50839 + 50833 + 50821 + 50789 = 1292701.

%o (Python)

%o from sympy import isprime, prevprime; a_2 = a_1 = 1

%o for _ in range(28):

%o a = a_2 + a_1; b = a_2

%o while not isprime(a): b = prevprime(b) if b > 2 else 1 if b == 2 else exit(); a += b

%o print(a, end = ', '); a_2 = a_1; a_1 = a # _Ya-Ping Lu_, Apr 02 2025

%Y Cf. A000045 (Fibonacci), A000213 (tribonacci), A175211.

%K nonn

%O 1,1

%A _Ya-Ping Lu_, Aug 25 2020