login
The number of Carmichael numbers smaller than the n-th Carmichael number which are quadratic residues of the n-th Carmichael number.
2

%I #14 Jan 23 2023 09:10:40

%S 0,0,0,0,0,1,1,0,1,1,2,3,4,2,3,2,2,3,2,3,3,3,2,0,3,4,2,6,7,1,1,7,5,7,

%T 3,8,3,6,7,5,5,7,7,8,6,5,6,6,12,10,1,6,9,7,6,9,4,7,7,8,8,2,3,10,6,12,

%U 8,7,8,6,12,12,12,9,6,16,8,9,8,10,15,9,8,7,13,9,12,11,10,12,13,10,18,7

%N The number of Carmichael numbers smaller than the n-th Carmichael number which are quadratic residues of the n-th Carmichael number.

%e a(5)=0 because none of C(1) to C(4) is a QR of C(5)=2821.

%e a(6)=1 because C(4)=2465 is a QR of C(6)=6601.

%e a(7)=1 because C(3)=1729 is a QR of C(7)=8911.

%e a(11)=2 because C(5)=2821 and C(6)=6601 are QR's of C(11)=41041.

%e a(12)=3 because C(5)=2821, C(8)=10585 and C(10)= 29341 are QR's of C(12)=46657.

%p L := BFILETOLIST("b002997.txt") ;

%p # count how many Carm's smaller than Carm(n) which are q.reds. exist.

%p A359729 := proc(n)

%p global L ;

%p local a,i;

%p a := 0 ;

%p for i from 1 to n-1 do

%p if numtheory[quadres](op(i,L),op(n,L)) = 1 then

%p a := a+1 ;

%p end if;

%p end do:

%p a ;

%p end proc:

%p seq(A359729(n),n=1..60) ;

%t L = Cases[Import["https://oeis.org/A002997/b002997.txt", "Table"], {_, _}][[All, 2]];

%t quadres[q_, p_] := Module[{k}, For[k = 1, k <= Floor[p/2], k++, If[q == PowerMod[k, 2, p], Return[1]]]; -1];

%t a[n_] := a[n] = Module[{k = 0, i}, For[i = 1, i <= n-1, i++, If[quadres[L[[i]], L[[n]]] == 1, k++]]; k];

%t Table[Print[n, " ", a[n]]; a[n], {n, 1, 60}] (* _Jean-François Alcover_, Jan 23 2023, after Maple program *)

%Y Cf. A002997, A317247

%K nonn

%O 1,11

%A _R. J. Mathar_, Jan 12 2023