%I #30 Apr 27 2023 09:09:07
%S 1,0,0,1,2,0,3,0,1,2,5,0,2,3,3,1,2,3,5,2,4,3,3,5,1,2,3,3,2,3,3,5,5,2,
%T 3,1,2,3,3,2,2,3,3,5,2,3,3,5,1,2,3,2,2,3,3,3,3,2,4,3,2,3,3,1,2,3,3,2,
%U 4,3,3,3,2,2,3,5,4,3,3,2,1,2,3,4,2,3,3,3,2,2,3,3,4,3,3,5,2,3,3
%N a(n) is the smallest integer k such that n can be expressed as the arithmetic mean of k distinct nonzero squares, or 0 if no such k exists.
%F Upper bound: (a(n) + 1) * (2*a(n) + 1) <= 6*n. Proof: Because (Sum_{m=1..k} (i_m)^2)/k = n, n*k = Sum_{m=1..k} (i_m)^2. Since each i_m is distinct, n*k >= Sum_{m=1..k} m^2 = k * (k + 1) * (2*k + 1)/6, hence (k + 1) * (2*k + 1) <= 6*n.
%F a(A132777(n)) = 2. - _Thomas Scheuerle_, Apr 16 2023
%e For n = 2, if k = 1, 2*1 = 2 is not a square; but, from the upper bound formula, (k + 1) * (2*k + 1) <= 12, so k <= 1. So, a satisfactory k does not exist; hence a(2) = 0.
%Y Cf. A360530 (allows repeated squares).
%Y Cf. A001422, A033461, A129210, A132777, A248509.
%K nonn
%O 1,5
%A _Yifan Xie_, Apr 16 2023
%E Name qualified and other edits by _Peter Munn_, Apr 21 2023