OFFSET
1,8
COMMENTS
The primes that result from this sequence are 3, 3, 5, 7, 7, 7, 11, 13, 11, 11, 13, 17, 17, 17, 19, 19, 19, 19, 23, 29, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 37, 41, 37, 37, 41, ...
EXAMPLE
When n=5, a(4)=1; we want a(5)+a(4)+5 to be a prime. 1 is the least nonnegative number that satisfies this condition (1+5+1=7). So, a(5)=1.
MATHEMATICA
Nest[Append[#1, Block[{k = 0}, While[! PrimeQ[#1[[-1]] + k + #2], k++]; k]] & @@ {#, Length@ # + 1} &, {1}, 105] (* Michael De Vlieger, Dec 14 2019 *)
PROG
(PARI) for (n=1, 87, print1 (v=if (n==1, 1, nextprime(n+v)-n-v)", ")) \\ Rémy Sigrist, Dec 06 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Ali Sada, Dec 06 2019
STATUS
approved