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.

A337210 Irregular triangle read by rows in which row n has the least number of integers such that the sum of the square root of those integers is the best approximation to and less than the square root of n.

This page as a plain text file.
%I A337210 #21 Oct 05 2020 12:50:28
%S A337210 0,1,2,3,4,1,2,6,1,3,8,2,3,1,5,1,6,12,3,4,2,6,3,5,2,7,4,5,1,11,1,12,2,
%T A337210 10,5,6,1,14,3,10,1,3,5,6,7,1,3,6,2,15,2,3,5,7,8,1,3,8,2,4,5,4,14,8,9,
%U A337210 6,12,2,21,1,5,8,9,10,4,18,6,15,1,5,10,10
%N A337210 Irregular triangle read by rows in which row n has the least number of integers such that the sum of the square root of those integers is the best approximation to and less than the square root of n.
%C A337210 All approximations are less than or equal to one. An approximation sqrt(n) - sqrt(n-1) < 1 for all n > 1.
%C A337210 Often integers of the form 4n-2 have as their best approximation just the two consecutive integers {n-1, n}.
%C A337210 Those that are not: 20, 21, 25, 27, 30, 31, 36, 37, 38, 40, 42, 44, 45, 46, 47, 48, 49, 52, ... .
%C A337210 Sometimes two approximations are equal, i.e.; for n = 39, sqrt(2) + sqrt(4) + sqrt(8) is the same as sqrt(4) + sqrt(18). In this sequence the simplest form is used, i.e.; {4, 18}.
%F A337210 s = sum(sqrt(i)) for carefully chosen integers i less than n such that s < n yet is the best approximation to n.
%e A337210 For row 1, just the sqrt(0) < sqrt(1);
%e A337210 for row 2, just the sqrt(1) < sqrt(2);
%e A337210 for row 3, just the sqrt(2) < sqrt(3);
%e A337210 for row 4, just the sqrt(3) < sqrt(4);
%e A337210 for row 5, just the sqrt(4) < sqrt(5);
%e A337210 for row 6, sqrt(1) + sqrt(2) < sqrt(6);
%e A337210 for row 7, just the sqrt(6) < sqrt(7);
%e A337210 for row 8, sqrt(1) + sqrt(3) < sqrt(8);
%e A337210 for row 9, just the sqrt(8) < sqrt(9);
%e A337210 for row 10, sqrt(2) + sqrt(3) is the best approximation;
%e A337210 for row 11, sqrt(1) + sqrt(5) < sqrt(11);
%e A337210 for row 12, sqrt(1) + sqrt(6) < sqrt(12);
%e A337210 for row 27, sqrt(1) + sqrt(3) + sqrt(6) is the best approximation;
%e A337210 for row 63, 2*sqrt(3) + 2*sqrt(5) is the best approximation and appears as the integers {12, 20};
%e A337210 for row 107, sqrt(3) + sqrt(6) + sqrt(9) + sqrt(10) is the best approximation;
%e A337210 for row 165, sqrt(1) + 2*sqrt(2) + 2*sqrt(3) + sqrt(5) + sqrt(11) is the best approximation and appears as the integers {1, 5, 8, 11, 12};
%e A337210 for row 218, sqrt(1) + sqrt(3) + sqrt(5) + sqrt(6) + sqrt(13) + sqrt(14) is the best approximation; etc.
%e A337210 Triangle begins:
%e A337210 0;
%e A337210 1;
%e A337210 2;
%e A337210 3;
%e A337210 4;
%e A337210 1, 2;
%e A337210 6;
%e A337210 1, 3;
%e A337210 8;
%e A337210 2, 3;
%e A337210 ...
%t A337210 y[x_] := Block[{lst = {x - 1}, min = Sqrt[x] - Sqrt[x - 1], rad = 1, sx = Sqrt[x]},
%t A337210   If[x > 5, lim = (sx - 1)^2;
%t A337210    Do[diff = sx - (Sqrt[a] + Sqrt[b]);
%t A337210     If[diff < min && diff > 0, min = diff; lst = {b, a}; rad = 2],
%t A337210     {a, 2, lim}, {b, 1, a - 1}]];
%t A337210   If[x > 17, lim = (sx - Sum[Sqrt[z], {z, 2}])^2;
%t A337210    Do[diff = sx - (Sqrt[a] + Sqrt[b] + Sqrt[c]);
%t A337210     If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff; lst = {c, b, a}; rad = 3],
%t A337210     {a, 3, lim}, {b, 2, a - 1}, {c, 1, b - 1}]];
%t A337210   If[x > 37, lim = (sx - Sum[Sqrt[z], {z, 3}])^2;
%t A337210    Do[diff = sx - (Sqrt[a] + Sqrt[b] + Sqrt[c] + Sqrt[d]);
%t A337210     If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff; lst = {d, c, b, a};
%t A337210      rad = 4],
%t A337210     {a, 4, lim}, {b, 3, a - 1}, {c, 2, b - 1}, {d, 1, c - 1}]];
%t A337210   If[x > 71, lim = (sx - Sum[Sqrt[z], {z, 4}])^2;
%t A337210    Do[diff = sx - (Sqrt[a] + Sqrt[b] + Sqrt[c] + Sqrt[d] + Sqrt[e]);
%t A337210     If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff; lst = {e, d, c, b, a};
%t A337210      rad = 5],
%t A337210     {a, 5, lim}, {b, 4, a - 1}, {c, 3, b - 1}, {d, 2, c - 1}, {e, 1,
%t A337210      d - 1}]];
%t A337210   If[x > 117, lim = (sx - Sum[Sqrt[z], {z, 5}])^2;
%t A337210    Do[diff =
%t A337210      sx - (Sqrt[a] + Sqrt[b] + Sqrt[c] + Sqrt[d] + Sqrt[e] + Sqrt[f]);
%t A337210      If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff; lst = {f, e, d, c, b, a};
%t A337210      rad = 6],
%t A337210     {a, 6, lim}, {b, 5, a - 1}, {c, 4, b - 1}, {d, 3, c - 1}, {e, 2,
%t A337210      d - 1}, {f, 1, e - 1}]];
%t A337210   If[x > 181, lim = (sx - Sum[Sqrt[z], {z, 6}])^2;
%t A337210    Do[diff =
%t A337210      sx - (Sqrt[a] + Sqrt[b] + Sqrt[c] + Sqrt[d] + Sqrt[e] + Sqrt[f] +
%t A337210          Sqrt[g]); If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff;
%t A337210      lst = {g, f, e, d, c, b, a}; rad = 7],
%t A337210     {a, 7, lim}, {b, 6, a - 1}, {c, 5, b - 1}, {d, 4, c - 1}, {e, 3,
%t A337210      d - 1}, {f, 2, e - 1}, {g, 1, f - 1}]];
%t A337210   If[x > 265, lim = (sx - Sum[Sqrt[z], {z, 7}])^2;
%t A337210    Do[diff =
%t A337210      sx - (Sqrt[a] + Sqrt[b] + Sqrt[c] + Sqrt[d] + Sqrt[e] + Sqrt[f] +
%t A337210          Sqrt[g] + Sqrt[h]); If[diff < 0, Continue[]];
%t A337210     If[diff < min && diff > 0, min = diff;
%t A337210      lst = {g, f, e, d, c, b, a}; rad = 8],
%t A337210     {a, 8, lim}, {b, 7, a - 1}, {c, 6, b - 1}, {d, 5, c - 1}, {e, 4,
%t A337210      d - 1}, {f, 3, e - 1}, {g, 2, f - 1}, {h, 1, g - 1}]];
%t A337210  lst];
%t A337210  Array[ y, 50] // Flatten
%Y A337210 Inspired by A045880.
%Y A337210 Cf. A337211.
%K A337210 nonn,tabf
%O A337210 1,3
%A A337210 _Robert G. Wilson v_, Aug 19 2020