%I #4 Mar 30 2012 17:38:16
%S 1,2,3,4,2,3,4,5,3,2,3,4,2,3,4,5,2,3,3,4,3,3,4,5,2,2,3,4,2,3,4,5,3,2,
%T 3,4,2,3,4,5,2,3,3,4,3,3,4,5,3,2,3,4,2,3,4,5,3,2,3,4,2,3,4,5,2,3,3,4,
%U 3,3,4,5,2,2,3,4,3,3,4,5,3,2,3,4,2,3,4,5,2,3,3,4,3,3,4,5,2,3,3
%N Write n as a sum of positive squares a^2+b^2+c^2+... with gcd(a,b,...) = 1; a(n) = minimal number of squares needed.
%C Similar to A002828, but only now primitive representations are allowed.
%C Of course a(n) >= A002828(n).
%C From Lagrange's theorem, a(n) <= 5 (see also Estermann, Grosswald, Th. 3, p. 176).
%C Furthermore, it appears (and should be easy to prove) that:
%C a(n) = 1 iff n=1
%C a(n) = 2 iff n in A008784\{1}
%C a(n) = 3 iff n in A151926
%C a(n) = 4 iff n == 4 or 7 mod 8
%C a(n) = 5 iff n == 0 mod 8
%D Estermann, T., On the representations of a number as a sum of squares, Acta Arith., 45 (1937), 93-125.
%D E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985.
%H N. J. A. Sloane, <a href="/A151925/b151925.txt">Table of n, a(n) for n = 1..1000</a>
%H N. J. A. Sloane, <a href="/A151925/a151925.txt">Fortran program</a>
%e ..... n .. a(n) ..<- Numbers when squared add to n ->
%e -----------------------------------------------------
%e ......1......1......1
%e ......2......2......1......1
%e ......3......3......1......1......1
%e ......4......4......1......1......1......1
%e ......5......2......1......2
%e ......6......3......1......1......2
%e ......7......4......1......1......1......2
%e ......8......5......1......1......1......1......2
%e ......9......3......1......2......2
%e .....10......2......1......3
%e .....11......3......1......1......3
%e .....12......4......1......1......1......3
%e .....13......2......2......3
%e .....14......3......1......2......3
%e .....15......4......1......1......2......3
%e .....16......5......1......1......1......2......3
%e .....17......2......1......4
%e .....18......3......1......1......4
%e .....19......3......1......3......3
%e .....20......4......1......1......3......3
%K nonn
%O 1,2
%A _N. J. A. Sloane_ and _Vinay Vaishampayan_, Aug 06 2009, Aug 07 2009