login
A331996
Number of Pythagorean triples mod n: total number of solutions (x,y,z) to x^2 + y^2 = z^2 mod n with x <= y.
0
1, 3, 5, 14, 13, 19, 31, 52, 54, 51, 61, 110, 85, 111, 113, 232, 161, 207, 181, 302, 227, 243, 287, 436, 375, 339, 450, 614, 421, 451, 511, 912, 545, 611, 619, 1206, 685, 723, 761, 1204, 881, 895, 925, 1454, 1242, 1103, 1151, 2024, 1414, 1475, 1317, 2030, 1405
OFFSET
1,2
COMMENTS
Based on A062775, but that sequence counts (x,y,z) and (y,x,z) as different pairs.
EXAMPLE
Below is an example for n = 3 (a(3) = 5).
(0 0 0)
(1 0 1)
(1 0 2)
(2 0 1)
(2 0 2)
In contrast, A062775, counts (1 0 1) and (0 1 1), etc. as different pairs and therefore A062775(3) = 9 .
MATHEMATICA
a[n_] := Block[{q = Association[(#[[1]] -> #[[2]]) & /@ Tally[ Mod[ Range[ n]^2, n]]]}, Sum[ Lookup[q, Mod[x^2 + y^2, n], 0], {x, n}, {y, x}]]; Array[a, 53] (* Giovanni Resta, Feb 04 2020 *)
CROSSREFS
Cf. A062775.
Sequence in context: A028942 A278314 A289622 * A179213 A074378 A185301
KEYWORD
nonn
AUTHOR
Yinxi Pan, Feb 03 2020
EXTENSIONS
More terms from Giovanni Resta, Feb 04 2020
STATUS
approved