A377014 a(n) is the number of primes p such that p - 6, p + 6 and 2*n - p are also primes.
0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 2, 3, 4, 1, 3, 3, 0, 4, 4, 2, 2, 3, 3, 3, 6, 3, 4, 6, 0, 5, 5, 1, 6, 4, 3, 5, 6, 4, 3, 9, 3, 2, 8, 2, 4, 7, 2, 4, 3, 3, 5, 5, 6, 4, 9, 4, 4, 11, 2, 5, 10, 1, 4, 4, 4, 4, 4, 5, 2, 7, 4, 4, 9, 2, 5, 6, 0, 6, 7, 5, 3, 6, 5, 1, 10, 7, 4, 9, 2, 5, 9, 2, 6, 5, 4, 5, 4, 4
Offset: 1
Examples
a(7) = 1 since only when p = 11 are p - 6, p + 6 and 2n - p all prime. a(12) = 3 from the cases when p is 11, 13 or 17: when p = 11, {p - 6, p + 6, 2n - p} = {5, 17, 13} are all prime; when p = 13, {p - 6, p + 6, 2n - p} = {7, 13, 19, 11} are all prime; when p = 17, {p - 6, p + 6, 2n - p} = {11, 17, 23, 7} are all prime. a(19) = 0 since 2n = 38 = 7 + 31 = 19 + 19 = 31 + 7, and none of p = 7, 19, 31 can make p - 6 and p + 6 both prime.
Programs
-
Maple
f:= proc(n) local i; nops(select(p -> andmap(isprime,[p,p-6,p+6, 2*n-p]), [seq(i,i=3..2*n,2)])) end proc: map(f, [$1..100]); # Robert Israel, Oct 13 2024
-
Mathematica
m = 200; ps = {}; p = 7; While[p = NextPrime[p]; If[PrimeQ[p - 6] && PrimeQ[p + 6], AppendTo[ps, p]]; p < 2*m]; a = {}; Do[ct = 0; k = 0; While[k++; ps[[k]] < n, q = n - ps[[k]]; If[PrimeQ[q], ct++]]; AppendTo[a, ct]; If[ct == 0, AppendTo[b, n]], {n, 2, m, 2}]; a
Comments