A306440 Number of different ways of expressing 2*n as (p - 1)*(q - 1), where p < q are primes.
0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 0, 2, 0, 2, 1, 1, 1, 1, 0, 1, 0, 1, 1, 3, 0, 1, 1, 0, 1, 4, 0, 0, 1, 1, 1, 1, 0, 2, 0, 1, 0, 2, 0, 1, 1, 1, 1, 2, 0, 2, 0, 1, 0, 3, 0, 0, 1, 0, 1, 2, 0, 1, 1, 1, 0, 2, 0, 1, 1, 0, 0, 2, 0, 2, 1, 1, 1, 2, 0, 1, 0, 1, 1, 3, 0, 1, 0, 0, 1
Offset: 0
Keywords
Examples
a(2) = 1 because 2*2 = 4 can only be expressed as (p - 1)*(q - 1) with primes p = 2 and q = 5. a(6) = 2 because for 2*6 = 12, there are only two possible ordered pairs of distinct primes (p,q), (2,13) and (3,7), such that 12 = (p - 1)*(q - 1).
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A323550.
Programs
-
Maple
f:= proc(n) local t; nops(select(t -> t^2<2*n and isprime(t+1) and isprime(2*n/t+1), numtheory:-divisors(2*n))) end proc: map(f, [$0..200]); # Robert Israel, Mar 18 2019
-
Mathematica
a[n_]:=Module[{k=0},Do[Do[If[2n==(Prime[i]-1)*(Prime[j]-1),k++],{i,1,j-1}],{j,2,PrimePi[2n]+1}];Return[k]]; Table[a[j],{j,0,128}]
-
PARI
A306440(n,d,c)={forprime(p=2,sqrtint(-(n>0)+n*=2)+1,n%(p-1)==0 && isprime(n/(p-1)+1) && c++ && d && printf("%d-1=(%d-1)*(%d-1) [%d], ",n+1,p,n/(p-1)+1,c));c} \\ Give 1 as 2nd optional arg (d=debug) to get a list of all decompositions. - M. F. Hasler, Feb 25 2019
-
PARI
a(n) = if(n==0, return(0)); my(d=divisors(n<<1)); d+=vector(#d, i, 1); sum(i=1, #d\2, isprime(d[i]) && isprime(d[#d-i+1])) \\ for finding lots of terms or a(n) for large n. \\ David A. Corneth, Mar 18 2019
Formula
a(6k+1) = 0 for k > 0 because 12k+2 can't be written as (p-1)(q-1) except for k = 0 with p = 2, q = 3: If q > 3, then q-1 is congruent to 0 or 4 (mod 6), and no p = 2, p = 3 (=> q-1 = 6k+1) or p > 3 is possible. - M. F. Hasler, Feb 25 2019
Comments