OFFSET
1,4
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
EXAMPLE
Initially there are no terms in the sequence which satisfy any condition so a(1) = 0, whereupon the count is reset. Now count the number of prior terms such that the addition of 2 gives a prime. Since 0 + 2 = 2 is prime, a(2) = 1, and we increment from 2 to 4 finding that 1+4 = 5 is prime thus a(3) = 1. Since adding 6 to all prior terms gives 6,7,7 two of which are prime, we have a(4) = 2. Adding 8 to all prior terms results in 8,9,10,8 which contains no primes, so a(5) = 0; and so on.
MATHEMATICA
s = {0}; q = 0; Do[k = Count[s + 2*(n - q), _?PrimeQ]; AppendTo[s, k]; If[k == 0, q = n], {n, 120}]; s (* Michael De Vlieger, May 16 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, May 16 2025
STATUS
approved
