login
A074239
Related to cumulative number of non-twin primes.
2
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,6
LINKS
Robert Israel and Paul Nanninga, Table of n, a(n) for n = 0..10000 (terms up to a(100) from Paul Nanninga)
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.
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 *)
PROG
(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
CROSSREFS
Cf. A065091 (odd primes), A007510 (non-twin primes).
Sequence in context: A265133 A064506 A082774 * A248333 A303905 A341904
KEYWORD
easy,nonn
AUTHOR
Rudi Huysmans (rudi.huysmans(AT)pandora.be), Sep 18 2002
STATUS
approved