cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A331996 #14 Apr 09 2020 22:06:01
%S A331996 1,3,5,14,13,19,31,52,54,51,61,110,85,111,113,232,161,207,181,302,227,
%T A331996 243,287,436,375,339,450,614,421,451,511,912,545,611,619,1206,685,723,
%U A331996 761,1204,881,895,925,1454,1242,1103,1151,2024,1414,1475,1317,2030,1405
%N 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.
%C A331996 Based on A062775, but that sequence counts (x,y,z) and (y,x,z) as different pairs.
%e A331996 Below is an example for n = 3 (a(3) = 5).
%e A331996 (0 0 0)
%e A331996 (1 0 1)
%e A331996 (1 0 2)
%e A331996 (2 0 1)
%e A331996 (2 0 2)
%e A331996 In contrast, A062775, counts (1 0 1) and (0 1 1), etc. as different pairs and therefore A062775(3) = 9 .
%t A331996 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 *)
%Y A331996 Cf. A062775.
%K A331996 nonn
%O A331996 1,2
%A A331996 _Yinxi Pan_, Feb 03 2020
%E A331996 More terms from _Giovanni Resta_, Feb 04 2020