A383970 Inventory sequence: record the number of prior terms such that if 2 then 4, then 6,... are added the result is a prime. Reset the count at each term = 0.
0, 1, 1, 2, 0, 4, 2, 2, 0, 5, 2, 3, 2, 3, 3, 4, 5, 4, 3, 2, 2, 6, 6, 2, 2, 4, 4, 6, 6, 4, 4, 2, 2, 4, 2, 2, 6, 6, 2, 2, 4, 4, 6, 6, 2, 2, 4, 4, 4, 2, 2, 4, 2, 0, 12, 6, 4, 6, 6, 4, 6, 6, 4, 4, 2, 2, 6, 6, 2, 2, 4, 4, 6, 6, 4, 4, 2, 2, 4, 2, 2, 6, 6, 2, 2, 4, 4
Offset: 1
Keywords
Examples
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.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
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 *)