cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A161882 Smallest k such that n^2 = a_1^2 + ... + a_k^2 and all a_i are positive integers less than n.

Original entry on oeis.org

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
Offset: 2

Views

Author

Dmitry Kamenetsky, Jun 21 2009

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • Mathematica
    f[n_, k_] := Select[PowersRepresentations[n^2, k, 2], AllTrue[#, 0<#Jean-François Alcover, Oct 03 2020 *)
  • PARI
    A161882(n)={vecmin(factor(n)[,1]%4)==1 && return(2);  if(n==1<M. F. Hasler, Dec 17 2014

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

Extensions

More terms from Alois P. Heinz, Dec 04 2014