login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A337347 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. 0
2, 3, 5, 11, 19, 37, 73, 193, 337, 1741, 5851, 39157, 50857, 987713, 1292701, 11168887, 21510131, 177872951, 220893209, 932384951, 15511295531, 43482833879, 974160518137, 2539542521143, 12281147701703, 22439317786231, 47001613189621, 899695689045059 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

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.

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.

When a(n-1)+a(n-2) is not prime, the last digit of the last term, prime(s), added to a(n-1)+a(n-2) is either "1", "7", or "9" for n up to 35, except prime(s) = 3 for n = 5 and prime(s) = 23 for n=8. This trend has yet to be verified for n > 35.

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

LINKS

Table of n, a(n) for n=1..28.

FORMULA

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.

EXAMPLE

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

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

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

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;

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

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.

PROG

(Python)

from sympy import isprime, prime, primepi

a_1 = 1

a0 = 1

for n in range(1, 101):

    a = a_1 + a0

    m = primepi(a_1)

    b = 0

    while not isprime(a + b):

        m = m - 1

        b = b + prime(m)

    a = a + b

    print(a)

    a_1 = a0

    a0 = a

CROSSREFS

Cf. A000045 (Fibonacci), A000213 (tribonacci).

Sequence in context: A037082 A084573 A155954 * A087581 A049888 A117221

Adjacent sequences:  A337344 A337345 A337346 * A337348 A337349 A337350

KEYWORD

nonn

AUTHOR

Ya-Ping Lu, Aug 25 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 18 16:10 EDT 2021. Contains 347527 sequences. (Running on oeis4.)