%I #21 Jun 15 2017 06:05:41
%S 23,224,128,3712,896,512,1536,54272,14848,11264,3584,11776,2048,6144,
%T 20480,833536,217088,94208,59392,45056,116736,22528,14336,118784,
%U 47104,8192,63488,24576,49152,81920,294912,13082624,3334144,1564672,868352,548864,376832
%N Smallest number k that cannot be expressed as x^2 + y^2 + z^2 + w^2 where x >= y >= z >= w >= 0 and x > floor(sqrt(k)) - n, but can be so expressed if x = floor(sqrt(k)) - n.
%C Lagrange's theorem tells us that each positive integer k can be written as a sum of four squares. Some can be written as such a sum using a "greedy" algorithm in which x = floor(sqrt(k)), y = floor(sqrt(k - x^2)), z = floor(sqrt(k - x^2 - y^2)), and w = sqrt(k - x^2 - y^2 - z^2); e.g., 165 = 12^2 + 4^2 + 2^2 + 1^2, and x = floor(sqrt(165)) = floor(12.845...) = 12. For some other positive integers k, there is no sum x^2 + y^2 + z^2 + w^2 = k in which x = floor(sqrt(k)), no matter what values of y, z, and w are tested. For certain positive integers k, the largest x such that x^2 + y^2 + z^2 + w^2 = k is considerably less than floor(sqrt(k)). a(n) is the smallest number k such that there is no such sum in which floor(sqrt(k)) - x < n, but there is at least one such sum in which floor(sqrt(k)) - x = n.
%C Larger terms tend to be divisible by larger powers of two:
%C n a(n)
%C == ==================
%C 1 23 = 2^0 * 23
%C 2 224 = 2^5 * 7
%C 3 128 = 2^7 * 1
%C 4 3712 = 2^7 * 29
%C 5 896 = 2^7 * 7
%C 6 512 = 2^9 * 1
%C 7 1536 = 2^9 * 3
%C 8 54272 = 2^10 * 53
%C 9 14848 = 2^9 * 29
%C 10 11264 = 2^10 * 11
%C 11 3584 = 2^9 * 7
%C 12 11776 = 2^9 * 23
%C 13 2048 = 2^11 * 1
%C 14 6144 = 2^11 * 3
%C 15 20480 = 2^12 * 5
%C 16 833536 = 2^11 * 407
%C 17 217088 = 2^12 * 53
%C 18 94208 = 2^12 * 23
%C 19 59392 = 2^11 * 29
%C 20 45056 = 2^12 * 11
%C 21 116736 = 2^11 * 57
%C 22 22528 = 2^11 * 11
%C 23 14336 = 2^11 * 7
%C 24 118784 = 2^12 * 29
%C 25 47104 = 2^11 * 23
%C 26 8192 = 2^13 * 1
%C 27 63488 = 2^11 * 31
%C 28 24576 = 2^13 * 3
%C 29 49152 = 2^14 * 3
%C 30 81920 = 2^14 * 5
%C 31 294912 = 2^15 * 9
%C In some regions, a plot of the sequence looks fairly chaotic, but at each value of n = 2^k, a(n) reaches a local maximum, and the lengths of the monotonic runs on either side increases as k increases; e.g.,
%C a(1) < a(2) > a(3)
%C a(3) < a(4) > ... > a(6)
%C a(6) < ... < a(8) > ... > a(11)
%C a(13) < ... < a(16) > ... > a(20)
%C a(28) < ... < a(32) > ... > a(40)
%C a(59) < ... < a(64) > ... > a(75)
%C a(122) < ... < a(128) > ... > a(143)
%C a(248) < ... < a(256) > ... > a(275)
%H Jon E. Schoenfield, <a href="/A285552/b285552.txt">Table of n, a(n) for n = 1..1000</a>
%e At k = 128, floor(sqrt(k)) = 11, and there is no sum x^2 + y^2 + z^2 + w^2 = k in which x = 11, 10, or 9, but there is such a sum in which x = 8 (namely, 8^2 + 8^2 + 0^2 + 0^2 = 128); no smaller positive integer k has this property, so a(3) = 128.
%e At k = 13082624, floor(sqrt(k)) = 3616, and there is no sum x^2 + y^2 + z^2 + w^2 = k such that x > 3584 = 3616 - 32, but there is such a sum in which x = 3584 (namely, 3584^2 + 448^2 + 192^2 + 0^2 = 13082624); no smaller positive integer k has this property, so a(32) = 13082624.
%Y Cf. A178786.
%K nonn
%O 1,1
%A _Jon E. Schoenfield_, Jun 14 2017