|
| |
|
|
A100876
|
|
Least number of squares that sum to prime(n).
|
|
0
| |
|
|
2, 3, 2, 4, 3, 2, 2, 3, 4, 2, 4, 2, 2, 3, 4, 2, 3, 2, 3, 4, 2, 4, 3, 2, 2, 2, 4, 3, 2, 2, 4, 3, 2, 3, 2, 4, 2, 3, 4, 2, 3, 2, 4, 2, 2, 4, 3, 4, 3, 2, 2, 4, 2, 3, 2, 4, 2, 4, 2, 2, 3, 2, 3, 4, 2, 2, 3, 2, 3, 2, 2, 4, 4, 2, 3, 4, 2, 2, 2, 2, 3, 2, 4, 2, 4, 3, 2, 2, 2, 4, 3, 4, 4, 3, 3, 4, 2, 2, 3, 2, 3, 2, 3, 2, 3
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 1,1
|
|
|
COMMENTS
| Note that a(n) <= 4 by Lagrange's four-square theorem. - T. D. Noe (noe(AT)sspectra.com), Jan 10 2005
Primes 2 and 4k+1 (A002313) require only 2 positive squares; primes 8k+3 (A007520) require 3 positive squares; primes 8k+7 (A007522) require 4 positive squares.
|
|
|
FORMULA
| a(n) = A002828(prime(n)) - T. D. Noe (noe(AT)sspectra.com), Jan 10 2005
|
|
|
EXAMPLE
| a(2)=3 because 3=1^2+1^2+1^2;
a(3)=2 because 5=1^2+2^2;
a(4)=4 because 7=2^2+1^2+1^2+1^2.
|
|
|
MATHEMATICA
| SquareCnt[n_] := If[SquaresR[1, n] > 0, 1, If[SquaresR[2, n] > 0, 2, If[SquaresR[3, n] > 0, 3, 4]]]; Table[p = Prime[n]; SquareCnt[p], {n, 150}] (* T. D. Noe, Jan 10 2005, revised Sep 27 2011 *)
|
|
|
CROSSREFS
| Cf. A002828 (least number of squares needed to represent n).
Sequence in context: A058973 A155520 A105117 * A089215 A205782 A070296
Adjacent sequences: A100873 A100874 A100875 * A100877 A100878 A100879
|
|
|
KEYWORD
| nonn
|
|
|
AUTHOR
| Giovanni Teofilatto (g.teofilatto(AT)tiscalinet.it), Jan 09 2005
|
|
|
EXTENSIONS
| More terms from T. D. Noe (noe(AT)sspectra.com), Jan 10 2005
|
| |
|
|