login
A353589
Number of nondecreasing nonnegative integer quadruples (m,p,q,r) such that m^2 + p^2 + q^2 + r^2 = n^2 and m +- p +- q +- r = +- n.
3
1, 1, 2, 2, 2, 2, 4, 2, 2, 4, 4, 4, 4, 3, 4, 6, 2, 5, 8, 5, 4, 6, 8, 5, 4, 7, 6, 9, 4, 6, 12, 6, 2, 12, 10, 9, 8, 7, 10, 10, 4, 9, 12, 9, 8, 17, 10, 9, 4, 9, 14, 16, 6, 10, 18, 17, 4, 16, 12, 12, 12, 11, 12, 17, 2, 16, 24, 13, 10, 18, 18, 13, 8, 14, 14, 26, 10, 17, 20, 14, 4, 23
OFFSET
0,3
COMMENTS
Motivated by A354766 and A278085.
EXAMPLE
For n = 1, (0, 0, 0, 1) is the only solution.
For n = 2, (0, 0, 0, 2) and (1, 1, 1, 1) are solutions, with 1 + 1 + 1 - 1 = 2.
PROG
(PARI) apply( {A353589(n, show=0, cnt=0, n2=n^2, e=[1, -1]~)=
for(a=0, sqrtint(n2\4), for(b=a, sqrtint((n2-a^2)\3),
my(s=[a+b, b-a, a-b, -a-b]); foreach(sum2sqr(n2-a^2-b^2), cd, cd[1] >= b &&
vecsum(cd)+s[1] >= n && foreach(s, d, (vecsum(cd)+d==n || abs(cd*e+d)==n)&&
cnt++&& !(show && print1(concat([a, b], cd)))&& break)))); cnt}, [0..99]) \\ See A133388 for sum2sqr().
CROSSREFS
Sequence in context: A366538 A366536 A349355 * A237709 A250200 A097859
KEYWORD
nonn
AUTHOR
M. F. Hasler, Jun 20 2022
STATUS
approved