A385104 Triangle read by rows: T(n,k) is the number of residue classes obtained by solving mod(x^2,n) = k for x over the integers, n >= 1, k >= 0.
1, 1, 1, 1, 2, 0, 2, 2, 0, 0, 1, 2, 0, 0, 2, 1, 2, 0, 1, 2, 0, 1, 2, 2, 0, 2, 0, 0, 2, 4, 0, 0, 2, 0, 0, 0, 3, 2, 0, 0, 2, 0, 0, 2, 0, 1, 2, 0, 0, 2, 1, 2, 0, 0, 2, 1, 2, 0, 2, 2, 2, 0, 0, 0, 2, 0, 2, 4, 0, 0, 4, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 2, 1, 2, 2, 0, 2, 0, 0, 1, 2
Offset: 1
Examples
Triangle starts: 1 1 1 1 2 0 2 2 0 0 1 2 0 0 2 1 2 0 1 2 0 1 2 2 0 2 0 0 2 4 0 0 2 0 0 0 3 2 0 0 2 0 0 2 0 1 2 0 0 2 1 2 0 0 2 ...
Links
- Jason Bard, Table of n, a(n) for n = 1..11325
Programs
-
Mathematica
dat[n_] := Table[Reduce[Mod[x^2, n] == k, x, Integers], {k, 0, n - 1}]; countConditions[cond_] := Which[cond === False, 0, MatchQ[cond, x \[Element] Integers], 1, True, Length@Cases[cond, Equal[x, _], Infinity]]; counts = Flatten[Table[countConditions /@ dat[n], {n, 1, 20}]]
-
PARI
T(n, k) = sum(i=1, n, Mod(i,n)^2 == k); row(n) = vector(n, i, T(n, i-1)); \\ Michel Marcus, Jun 23 2025
Comments