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.

This page as a plain text file.
%I A161882 #24 Feb 16 2025 08:33:10
%S A161882 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,
%T A161882 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,
%U A161882 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
%N A161882 Smallest k such that n^2 = a_1^2 + ... + a_k^2 and all a_i are positive integers less than n.
%C A161882 Related to hypotenuse numbers: A161882(A009003(n))=2 for all n.
%C A161882 Jacobi's four-square theorem can be used to show that a(n) <= 4. - _Charles R Greathouse IV_, Jul 31 2011
%H A161882 Alois P. Heinz, <a href="/A161882/b161882.txt">Table of n, a(n) for n = 2..700</a>
%H A161882 Jean-Charles Meyrignac, <a href="http://euler.free.fr/">Computing minimal equal sums of like powers</a>.
%H A161882 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DiophantineEquation2ndPowers.html">Diophantine Equation 2nd Powers</a>.
%F A161882 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
%e A161882 2^2 = 1^2 + 1^2 + 1^2 + 1^2, so a(2)=4.
%e A161882 3^2 = 2^2 + 2^2 + 1^2, so a(3)=3.
%t A161882 f[n_, k_] := Select[PowersRepresentations[n^2, k, 2], AllTrue[#, 0<#<n&]&];
%t A161882 a[n_] := For[k = 2, True, k++, If[f[n, k] != {}, Return[k]]];
%t A161882 a /@ Range[2, 200] (* _Jean-François Alcover_, Oct 03 2020 *)
%o A161882 (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
%Y A161882 Cf. A161883, A161884, A161885.
%K A161882 nonn
%O A161882 2,1
%A A161882 _Dmitry Kamenetsky_, Jun 21 2009
%E A161882 More terms from _Alois P. Heinz_, Dec 04 2014