A074239 Related to cumulative number of non-twin primes.
0, 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 17, 18, 19, 20, 21, 21, 22, 22, 23, 24, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, 32, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, 49, 50
Offset: 0
Links
- Robert Israel and Paul Nanninga, Table of n, a(n) for n = 0..10000 (terms up to a(100) from Paul Nanninga)
Programs
-
Maple
N:= 100: # to get a(0) to a(N) P:= [seq(ithprime(i),i=2..N+2)]: ListTools:-PartialSums([0,seq(`if`(P[i]-P[i-1]=2,0,1),i=2..N+1)]); # Robert Israel, May 13 2016
-
Mathematica
Accumulate@ Table[If[Prime@ n - Prime[n - 1] == 2, 0, 1], {n, 2, 120}] - 1 (* Michael De Vlieger, May 13 2016, after Robert Israel *)
-
PARI
op(n) = prime(n+1); lista(nn) = {my(x=0); for (n=1, nn, print1(x, ", "); if ((op(n+1) - op(n)) > 2, x++););} \\ Michel Marcus, May 13 2016
Formula
Take the sequence of odd primes op(n); set a(0) = 0; if op(n+1)-op(n)=2 a(n+1) = a(n), if op(n+1)-op(n) > 2 a(n+1) = a(n) + 1.