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.
%I A354766 #45 Mar 09 2023 04:51:59 %S A354766 1,2,4,2,7,8,7,2,13,14,13,8,13,14,28,2,19,26,19,14,28,26,25,8,37,26, %T A354766 40,14,31,56,31,2,52,38,49,26,37,38,52,14,43,56,43,26,91,50,49,8,49, %U A354766 74,76,26,55,80,91,14,76,62,61,56,61,62,91,2,91,104,67,38,100,98,73,26,73,74,148,38,91,104,79,14,121,86,85,56 %N A354766 1/4 of the total number of integral quadruples with sum = n and sum of squares = n^2. %C A354766 If instead we count only primitive quadruples (meaning quadruples (h,i,j,k) with gcd(h,i,j,k) = 1) we get A278085(n). %C A354766 Conjectures from _Colin Mallows_, Jun 12 2022: (Start) %C A354766 Given a natural number n, a "quad" for n is a quadruple q = (h,i,j,k) of integers with sum(q) = h+i+j+k = n and sum(q^2) = h^2+i^2+j^2+k^2 = n^2. %C A354766 A quad q is "primitive" if gcd(h,i,j,k) = 1. Define pq(n) = A278085(n) to be the number of distinct primitive quads for n, and tq(n) (the present sequence) to be the total number of quads for n. %C A354766 Conjecture 1: (Based on the data for n <= 5000) pq/4 and tq/4 are multiplicative sequences. %C A354766 Conjecture 2: When n = p^k, p prime and k >= 1: %C A354766 if p = 2, k = 1 then pq(q)/4 = 1 and tq(n)/4 = 2; %C A354766 if p = 2, k >= 2 then pq(q)/4 = 0 and tq(n)/4 = 2; %C A354766 if p = 3, k >= 1 then pq(q)/4 = n and tq(n)/4 = (3*n-1)/2; %C A354766 if p == 5 (mod 6), k >= 1 then pq(q)/4 = (p+1)*n/p and tq(n)/4 = n + 2*(n-1)/(p-1); %C A354766 if p == 1 (mod 6), k >= 1 then pq(q)/4 = (p-1)*n/p and tq(n)/4 = n. %C A354766 (End) %C A354766 Conjecture: the numbers n for which a(n) = n have a positive asymptotic density. %H A354766 Robert Israel, <a href="/A354766/b354766.txt">Table of n, a(n) for n = 1..650</a> %e A354766 Solutions for n = 1: (1,0,0,0) and all permutations thereof. %e A354766 n=2: (2,0,0,0) and (1,1,1,-1). %e A354766 n=3: (3,0,0,0) and (2,2,-1,0). %e A354766 n=4: (4,0,0,0) and (2,2,2,-2). Eight solutions, so a(4) = 8/4 = 2. None are primitive, so A278085(4) = 0. %e A354766 n=5: (5,0,0,0) and (4,2,-2,1). 4+24 solutions, so a(5) = 28/4 = 7. 24 are primitive, so A278085(5) = 24/4 = 6. %p A354766 f:= proc(n) local d; add(g3(n-d, n^2 - d^2), d=-n .. n)/4 end proc: %p A354766 g3:= proc(x,y) option remember; local m,c; %p A354766 if x^2 > 3*y then return 0 fi; %p A354766 m:= floor(sqrt(y)); %p A354766 add(g2(x-c,y - c^2), c=- m.. m) %p A354766 end proc: %p A354766 g2:= proc(x,y) option remember; %p A354766 local v; %p A354766 v:= 2*y - x^2; %p A354766 if not issqr(v) then 0 %p A354766 elif v = 0 then 1 %p A354766 else 2 %p A354766 fi %p A354766 end proc: %p A354766 map(f, [$1..100]); # _Robert Israel_, Feb 16 2023 %t A354766 f[n_] := Sum[g3[n - d, n^2 - d^2], {d, -n, n}]/4 ; %t A354766 g3[x_, y_] := g3[x, y] = Module[{m}, If[x^2 > 3*y, 0, m = Floor[Sqrt[y]]; Sum[g2[x - c, y - c^2], {c, -m, m}]]]; %t A354766 g2[x_, y_] := g2[x, y] = Module[{v}, v = 2*y - x^2; Which[!IntegerQ@Sqrt[v], 0, v == 0, 1, True, 2]]; %t A354766 f /@ Range[100] (* _Jean-François Alcover_, Mar 09 2023, after _Robert Israel_ *) %Y A354766 Cf. A278085, A354777, A354778. %Y A354766 See also A353589 (counts nondecreasing nonnegative (h,i,j,k) such that (+-h, +-i, +-j, +-k) is a solution). %K A354766 nonn,look %O A354766 1,2 %A A354766 _N. J. A. Sloane_, Jun 19 2022, based on an email from _Colin Mallows_, Jun 12 2022