login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A353048 a(n) = (number of primes p in the first n primes such that 2*p+1 is also prime) - (number of primes p in the first n primes such that 2*p-1 is also prime). 1
0, 0, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 2, 3, 3, 4, 4, 3, 3, 3, 2, 2, 2, 3, 4, 4, 5, 5, 5, 4, 3, 3, 3, 2, 3, 4, 4, 5, 5, 5, 5, 4, 4, 5, 5, 6, 5, 5, 5, 5, 4, 3, 3, 3, 3, 4, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,10

COMMENTS

a(n) is the number of members of A005384 <= prime(n) minus the number of members of A005382 <= prime(n).

LINKS

Robert Israel, Table of n, a(n) for n = 1..10000

T. Haddad, Prime Number Races, Université de Montréal master's thesis, 2020.

Robert Israel, Plot of (n, a(n)) for n = 1..10^6

EXAMPLE

Of the first 5 primes there are 4 (2, 3, 5 and 11) such that 2*p+1 is prime and 3 (2, 3 and 7) such that 2*p-1 is prime, so a(5) = 4 - 3 = 1.

MAPLE

f:= proc(p) `if`(isprime(2*p+1), 1, 0) - `if`(isprime(2*p-1), 1, 0) end proc:

L:= map(f, [seq(ithprime(i), i=1..200)]):

ListTools:-PartialSums(L);

MATHEMATICA

Accumulate[(Boole[PrimeQ[2*# + 1]] - Boole[PrimeQ[2*# - 1]]) & /@ Prime[Range[100]]] (* Amiram Eldar, Apr 20 2022 *)

PROG

(Python)

from itertools import accumulate

from sympy import isprime, prime, primerange

def f(p): return isprime(2*p+1) - isprime(2*p-1)

def aupton(nn): return list(accumulate(map(f, primerange(2, prime(nn)+1))))

print(aupton(99)) # Michael S. Branicky, Apr 20 2022

(PARI) a(n) = my(vp=primes(n)); sum(k=1, n, isprime(2*vp[k]+1)-isprime(2*vp[k]-1)); \\ Michel Marcus, Apr 21 2022

CROSSREFS

Cf. A005382, A005384.

Sequence in context: A205217 A054635 A003137 * A006842 A299038 A273693

Adjacent sequences:  A353045 A353046 A353047 * A353049 A353050 A353051

KEYWORD

sign

AUTHOR

J. M. Bergot and Robert Israel, Apr 20 2022

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 7 23:50 EDT 2022. Contains 355995 sequences. (Running on oeis4.)