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.

Showing 1-3 of 3 results.

A261904 Largest x such that n can be written as n = x^2 + y^2 + z^2 with x >= y >= z >= 0, or -1 if no such x exists.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, -1, 2, 3, 3, 3, 2, 3, 3, -1, 4, 4, 4, 3, 4, 4, 3, -1, 4, 5, 5, 5, -1, 5, 5, -1, 4, 5, 5, 5, 6, 6, 6, -1, 6, 6, 5, 5, 6, 6, 6, -1, 4, 7, 7, 7, 6, 7, 7, -1, 6, 7, 7, 7, -1, 6, 7, -1, 8, 8, 8, 7, 8, 8, 6, -1, 8, 8, 8, 7, 6, 8, 7, -1, 8, 9, 9
Offset: 0

Views

Author

N. J. A. Sloane, Sep 08 2015

Keywords

Comments

a(n) = -1 iff n is in A004215, a(n) >= 0 iff n is in A000378.
Somehow maximizing x seems like the right thing to do (since it is natural to try a greedy algorithm first). If we minimize x we get A261915.

Examples

			Tabls showing initial values of n,x,y,z:
0 0 0 0
1 1 0 0
2 1 1 0
3 1 1 1
4 2 0 0
5 2 1 0
6 2 1 1
7 -1 -1 -1
8 2 2 0
9 3 0 0
10 3 1 0
11 3 1 1
12 2 2 2
13 3 2 0
14 3 2 1
15 -1 -1 -1
16 4 0 0
17 4 1 0
18 4 1 1
19 3 3 1
20 4 2 0
...
		

Crossrefs

Analogs for 4 squares: A178786 and A122921.

Extensions

More terms from David Consiglio, Jr., Sep 08 2015

A261915 Smallest x such that n can be written as n = x^2 + y^2 + z^2 with x >= y >= z >= 0, or -1 if no such x exists.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, -1, 2, 2, 3, 3, 2, 3, 3, -1, 4, 3, 3, 3, 4, 4, 3, -1, 4, 4, 4, 3, -1, 4, 5, -1, 4, 4, 4, 5, 4, 6, 5, -1, 6, 4, 5, 5, 6, 5, 6, -1, 4, 6, 5, 5, 6, 6, 5, -1, 6, 5, 7, 5, -1, 6, 6, -1, 8, 6, 5, 7, 6, 7, 6, -1, 6, 6, 7, 5, 6, 6, 7, -1, 8, 6, 8
Offset: 0

Views

Author

N. J. A. Sloane, Sep 11 2015

Keywords

Comments

a(n) = -1 iff n is in A004215, a(n) >= 0 iff n is in A000378.
If we maximize x we get A261904.

Examples

			Table showing initial values of n,x,y,z:
   0  0  0  0
   1  1  0  0
   2  1  1  0
   3  1  1  1
   4  2  0  0
   5  2  1  0
   6  2  1  1
   7 -1 -1 -1
   8  2  2  0
   9  2  2  1
  10  3  1  0
  11  3  1  1
  12  2  2  2
  13  3  2  0
  14  3  2  1
  15 -1 -1 -1
  16  4  0  0
  17  3  2  2
  18  3  3  0
  19  3  3  1
  20  4  2  0
  ...
		

Crossrefs

Analogs for 4 squares: A178786 and A122921.

Extensions

a(17) corrected, more terms from David Consiglio, Jr., Sep 11 2015

A285552 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.

Original entry on oeis.org

23, 224, 128, 3712, 896, 512, 1536, 54272, 14848, 11264, 3584, 11776, 2048, 6144, 20480, 833536, 217088, 94208, 59392, 45056, 116736, 22528, 14336, 118784, 47104, 8192, 63488, 24576, 49152, 81920, 294912, 13082624, 3334144, 1564672, 868352, 548864, 376832
Offset: 1

Views

Author

Jon E. Schoenfield, Jun 14 2017

Keywords

Comments

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.
Larger terms tend to be divisible by larger powers of two:
n a(n)
== ==================
1 23 = 2^0 * 23
2 224 = 2^5 * 7
3 128 = 2^7 * 1
4 3712 = 2^7 * 29
5 896 = 2^7 * 7
6 512 = 2^9 * 1
7 1536 = 2^9 * 3
8 54272 = 2^10 * 53
9 14848 = 2^9 * 29
10 11264 = 2^10 * 11
11 3584 = 2^9 * 7
12 11776 = 2^9 * 23
13 2048 = 2^11 * 1
14 6144 = 2^11 * 3
15 20480 = 2^12 * 5
16 833536 = 2^11 * 407
17 217088 = 2^12 * 53
18 94208 = 2^12 * 23
19 59392 = 2^11 * 29
20 45056 = 2^12 * 11
21 116736 = 2^11 * 57
22 22528 = 2^11 * 11
23 14336 = 2^11 * 7
24 118784 = 2^12 * 29
25 47104 = 2^11 * 23
26 8192 = 2^13 * 1
27 63488 = 2^11 * 31
28 24576 = 2^13 * 3
29 49152 = 2^14 * 3
30 81920 = 2^14 * 5
31 294912 = 2^15 * 9
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.,
a(1) < a(2) > a(3)
a(3) < a(4) > ... > a(6)
a(6) < ... < a(8) > ... > a(11)
a(13) < ... < a(16) > ... > a(20)
a(28) < ... < a(32) > ... > a(40)
a(59) < ... < a(64) > ... > a(75)
a(122) < ... < a(128) > ... > a(143)
a(248) < ... < a(256) > ... > a(275)

Examples

			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.
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.
		

Crossrefs

Cf. A178786.
Showing 1-3 of 3 results.