A354449
a(n) is the number of pairs of primes (p,q) with p
0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0
Offset: 1
Keywords
Examples
a(15) = 2 as there are two such pairs, (7,23) and (13,17): 2*15+7 = 37, 2*15+23 = 53, 7*23-2*15 = 131, 7*23+2*15 = 191, 2*15+13 = 43, 2*15+17 = 47, 13*17-2*15 = 191 and 13*17+2*15 = 251 are all prime.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local count,p,q; p:= 2*n-1 ; count:= 0; do p:= prevprime(p); if p < n then return count fi; q:= 2*n-p; if isprime(q) and isprime(2*n+q) and isprime(2*n+p) and isprime(p*q-2*n) and isprime(p*q+2*n) then count:=count+1 fi; od end proc: f(1):= 0: f(2):= 0: map(f, [$1..100]);
-
Mathematica
a[n_] := Sum[If[AllTrue[{k, 2*n - k, 2*n + k, 4*n - k, k*(2 n - k) - 2*n, k*(2 n - k) + 2*n}, PrimeQ], 1, 0], {k, 1, n}]; Array[a, 100] (* Amiram Eldar, May 31 2022 *)
-
PARI
a(n) = sum(k=1, n, ispseudoprime(k) && ispseudoprime(2*n-k) && ispseudoprime(2*n+k) && ispseudoprime(4*n-k) && ispseudoprime(k*(2*n-k)-2*n) && ispseudoprime(k*(2*n-k)+2*n)) \\ adapted from Mathematica code, Felix Fröhlich, May 31 2022