login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A116127
Number of numbers that are congruent to {2, 4} mod 6 between prime(n) and prime(n+1) inclusive.
3
1, 1, 0, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, 2, 4, 2, 2, 0, 4, 0, 2, 2, 2, 2, 2, 0, 4, 0, 2, 0, 4, 4, 2, 0, 2, 2, 0, 4, 2, 2, 2, 0, 2, 2, 0, 4, 4, 2, 0, 2, 4, 2, 4, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 4, 0, 2, 2, 2, 2, 2, 0, 2, 4, 2, 2, 2, 2, 2, 4, 0, 6, 2, 4, 2, 2, 0, 2
OFFSET
1,4
COMMENTS
For n > 2,
A001223(n) = 2 iff a(n) = 0,
A001223(n) = 4 or 6 or 8 iff a(n) = 2,
A001223(n) = 10 or 12 or 14 iff a(n) = 4,
A001223(n) = 16 or 18 or 20 iff a(n) = 6,
and so on. This can be generalized to
A001223(n) = 3*k-2 or 3*k or 3*k+2 iff a(n) = k for k >= 2.
LINKS
MAPLE
P:= select(isprime, [seq(i, i=5..1000, 2)]):
Delta:= P[2..-1]-P[1..-2]:
f:= t -> (t + 2*(t+1 mod 3) - 2)/3:
1, 1, op(map(f, Delta)); # Robert Israel, Jun 19 2019
MATHEMATICA
s={}; Do[c=0; Do[If[MemberQ[{2, 4}, Mod[i, 6]], c=c+1], {i, Prime[n], Prime[n+1]}]; AppendTo[s, c], {n, 105}]; s (* James C. McMahon, Aug 18 2024 *)
PROG
(Magma) [ #[ k: k in [NthPrime(n)..NthPrime(n+1)] | r eq 2 or r eq 4 where r is k mod 6 ]: n in [1..105] ]; /* Klaus Brockhaus, Apr 15 2007 */
CROSSREFS
Cf. A000040 (primes), A001223 (differences between consecutive primes), A047235 (numbers congruent to {2, 4} mod 6), A002654.
Sequence in context: A029225 A341977 A309937 * A039979 A204173 A103668
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Apr 08 2007
EXTENSIONS
Edited, corrected and extended by Klaus Brockhaus, Apr 15 2007
STATUS
approved