login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

Related to hypotenuse numbers: A161882(A009003(n))=2 for all n.

Jacobi's four-square theorem can be used to show that a(n) <= 4. - Charles R Greathouse IV, Jul 31 2011

LINKS

Alois P. Heinz, Table of n, a(n) for n = 2..700

Jean-Charles Meyrignac, Computing minimal equal sums of like powers

Weisstein, Eric W., Diophantine Equation 2nd Powers

FORMULA

a(n)=2 iff n is in A009003 (hypotenuse numbers) , a(n)=4 iff n is in A000079 (powers of 2), else 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]]];

a /@ Range[2, 200] (* Jean-François Alcover, Oct 03 2020 *)

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

Cf. A161883, A161884, A161885.

Sequence in context: A215597 A266110 A204819 * A276789 A082125 A058290

Adjacent sequences:  A161879 A161880 A161881 * A161883 A161884 A161885

KEYWORD

nonn

AUTHOR

Dmitry Kamenetsky, Jun 21 2009

EXTENSIONS

More terms from Alois P. Heinz, Dec 04 2014

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 16 21:35 EDT 2021. Contains 346077 sequences. (Running on oeis4.)