|
|
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
|
|
|
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))))
(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
|
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|