A336093 Let P(n) = primorial(n) = A002110(n); a(n) is the number of primes q < P(n) such that P(n) - q is also prime and q^2==1 (mod P(n)).
0, 0, 2, 4, 2, 8, 6, 28, 36, 40, 56, 106, 192, 304, 526, 926, 1644, 2756, 4944, 8840, 15958, 28402, 51102, 92372
Offset: 1
Examples
P(4)=210; all totatives 29,41,71,139,181 are prime. However 210 - 41 = 169 is not prime, whereas 210-29 = 181, 210-71 = 139. Therefore the totatives we count in this case are 29,71,139,181, so a(4) = 4.
Programs
-
Maple
with(NumberTheory): P := proc (k) local n, v, W, H; n := 1; v := 0; W := product(ithprime(j), j = 1 .. k); H := PrimeCounting(W); for n from 1 to H do if mod(ithprime(n)^2, W) = 1 and isprime(W-ithprime(n)) then v := v+1 else v := v end if: end do: v; end proc: seq(P(k), k = 1 .. 8);
-
Mathematica
{0, 0}~Join~Table[Block[{P = #, k = 0}, Do[If[AllTrue[{#, P - #}, And[PrimeQ@ #, MultiplicativeOrder[#, P] == 2] &], k++] &@ Prime[i], {i, PrimePi[n + 1], PrimePi[P/2]}]; 2 k ] &@ Product[Prime@ j, {j, n}], {n, 3, 8}]
Comments