login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Numbers of the form m * (k_1^2 + k_2^2 + ... + k_m^2).
1

%I #17 Jan 27 2025 02:21:53

%S 1,4,9,10,16,18,20,25,26,27,28,33,34,36,40,42,48,49,50,51,52,54,55,57,

%T 58,60,63,64,65,66,68,70,72,74,76,78,80,81,82,84,85,87,88,90,91,92,95,

%U 99,100,102,104,105,106,108,110,112,114,115,116,120,121,122,123,124,125

%N Numbers of the form m * (k_1^2 + k_2^2 + ... + k_m^2).

%C From _Franklin T. Adams-Watters_, Aug 29 2009: (Start)

%C The k_i must all be positive integers.

%C Note that every integer > 33 is the sum of 5 positive squares, and for n > 5, every integer > n+13 is the sum of n positive squares. (End)

%C The complement of this sequence includes: A000040, A037074, A143206, 2 * A002145, and 3 * A094712. - _Robert Israel_, Jan 27 2025

%H Robert Israel, <a href="/A164098/b164098.txt">Table of n, a(n) for n = 1..10000</a>

%e 34 = 2*(4^2 + 1^2), 42 = 3*(3^2 + 2^2 + 1^2), thus 34 and 42 are in the sequence.

%p g:= proc(y,m)

%p # can we write y as sum of m positive squares?

%p option remember;

%p local x;

%p if y < m then return false fi;

%p if m = 1 then return issqr(y) fi;

%p if issqr(y-m+1) then return true fi;

%p for x from 1 while x^2 + m-1 < y do

%p if procname(y-x^2,m-1) then return true fi

%p od;

%p false

%p end proc:

%p filter:= proc(n)

%p ormap(t -> g(n/t, t), numtheory:-divisors(n))

%p end proc:

%p select(filter, [$1..1000]); # _Robert Israel_, Jan 26 2025

%o (PARI) issumsqs(n,k) = if(n<=0||k<=0,return(k==0&&n==0)); forstep(j=sqrtint(n),max(sqrtint(n\k),1),-1,if(issumsqs(n-j^2,k-1),return(1)));0

%o isa(n)=local(ds);ds=divisors(n);for(k=1,(#ds+1)\2,if(issumsqs(n\ds[k],ds[k]),return(1)));0

%o for(n=1,200,if(isa(n),print1(n","))) \\ _Franklin T. Adams-Watters_, Aug 29 2009

%Y Cf. A000290, A000404, A000408, A000414, A047700, A111178. [From _Franklin T. Adams-Watters_, Aug 29 2009]

%Y Cf. A000040, A002145, A037074, A094712, A143206.

%K nonn,changed

%O 1,2

%A _Jonas Wallgren_, Aug 10 2009, Aug 17 2009

%E More terms from _Franklin T. Adams-Watters_, Aug 29 2009