|
|
A161882
|
|
Smallest k such that n^2 = a_1^2 + ... + a_k^2 and all a_i are positive integers less than n.
|
|
6
|
|
|
4, 3, 4, 2, 3, 3, 4, 3, 2, 3, 3, 2, 3, 2, 4, 2, 3, 3, 2, 3, 3, 3, 3, 2, 2, 3, 3, 2, 2, 3, 4, 3, 2, 2, 3, 2, 3, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 2, 3, 3, 2, 3, 2, 2, 3, 3, 4, 2, 3, 3, 2, 3, 2, 3, 3, 2, 2, 2, 3, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3, 2, 2, 2, 3, 3, 3, 2, 3, 2, 3, 3, 2, 2, 2, 3, 2, 2, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
a(n)=2 iff n is in A009003 (hypotenuse numbers), a(n)=4 iff n is in A000079 (powers of 2), otherwise a(n)=3. - M. F. Hasler, Dec 17 2014
|
|
EXAMPLE
|
2^2 = 1^2 + 1^2 + 1^2 + 1^2, so a(2)=4.
3^2 = 2^2 + 2^2 + 1^2, so a(3)=3.
|
|
MATHEMATICA
|
f[n_, k_] := Select[PowersRepresentations[n^2, k, 2], AllTrue[#, 0<#<n&]&];
a[n_] := For[k = 2, True, k++, If[f[n, k] != {}, Return[k]]];
|
|
PROG
|
(PARI) A161882(n)={vecmin(factor(n)[, 1]%4)==1 && return(2); if(n==1<<valuation(n, 2), 4, 3)} \\ M. F. Hasler, Dec 17 2014
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|