OFFSET
1,2
COMMENTS
Two separate indices determine the progress of this sequence, like two parallel scales. What regularities or irregularities in the distribution of primes and nonprimes among the terms may emerge as the sequence grows?
EXAMPLE
Start with 1. As a nonprime, its index is 1. Add up the term and its index to get the next term, 2. This is a prime whose appropriate index is 1. The third term therefore is 2 + 1 = 3. And so on.
a(n) Prime index Nonprime index
1 - 1
2 1 -
3 2 -
5 3 -
8 - 4
12 - 7
19 8 -
.............................
PROG
(PARI) first(n) = { n = max(n, 1); print1(1", "); res = vector(n); res[1] = 1; for(i = 2, n, if(!isprime(res[i-1]), res[i] = 2*res[i-1] - primepi(res[i-1]) , res[i] = res[i-1] + primepi(res[i-1]) ); print1(res[i]", "); ); res } \\ David A. Corneth, Jul 26 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Tamas Sandor Nagy, Jul 26 2022
EXTENSIONS
a(14)-a(30) from Thomas Scheuerle, Jul 26 2022
More terms from David A. Corneth, Jul 26 2022
STATUS
approved