A224963 Let p = prime(n). a(n) = number of primes q less than p, such that both p+q+1 and p+q-1 are primes.
0, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 3, 2, 3, 1, 4, 2, 3, 5, 4, 3, 3, 5, 3, 6, 6, 4, 7, 3, 5, 5, 4, 5, 6, 4, 8, 4, 3, 4, 6, 6, 6, 3, 5, 5, 7, 6, 6, 2, 4, 6, 5, 2, 6, 5, 5, 5, 5, 3, 3, 8, 5, 4, 8, 4, 7, 4, 7, 7, 4, 7, 3, 5, 8, 9, 9, 6, 6, 7
Offset: 1
Keywords
Examples
For n=3, p=5, there are no primes q(<5) such that both 5+q+1 and 5+q-1 are primes and hence a(3)=0. Also for n=5, p=11, there is a(5)=1 solution 7 since 11+7+1=19, 11+7-1=17.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Table[p = Prime[n]; c = 0; i = 1; While[i < n, p1 = p + Prime[i]; If[PrimeQ[p1 + 1] && PrimeQ[p1 - 1], c = c + 1]; i++]; c, {n, 85}] pq1[n_]:=Module[{pr1=Prime[Range[n-1]],pr2=Prime[n]},Total[ Table[ If[ AllTrue[pr2+pr1[[k]]+{1,-1},PrimeQ],1,0],{k,Length[pr1]}]]]; Array[ pq1,100] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 20 2020 *)