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.

A309815 a(n) is the smallest positive integer x such that sqrt(2) + sqrt(x) is closer to an integer than any other value already in the sequence.

This page as a plain text file.
%I A309815 #18 Aug 20 2019 01:13:28
%S A309815 1,2,3,6,7,13,21,112,243,275,466,761,1128,4704,9523,10730,17579,28085,
%T A309815 41041,165312,331299,372815,607754,967441,1410360,5648160,11300259,
%U A309815 12713402,20707831,32942845,48005301,192060400,384143763,432165299,703818922,1119543881,1631318640
%N A309815 a(n) is the smallest positive integer x such that sqrt(2) + sqrt(x) is closer to an integer than any other value already in the sequence.
%C A309815 If b(n) = round(sqrt(2) + sqrt(a(n))), then (b(n)^2 + 2 - a(n))/(2*b(n)) is an approximation for sqrt(2).  Conjecture: all convergents of the continued fraction of sqrt(2) except 1 arise in this way. - _Robert Israel_, Aug 18 2019
%e A309815 a(6) = 13 because sqrt(2)+sqrt(13) is closer to an integer than any of the previous 5 terms.
%p A309815 R:= 1: delta:= sqrt(2)-1:
%p A309815 for r from 2 to 10000 do
%p A309815    x0:= ceil((r - sqrt(2)-delta)^2);
%p A309815    x1:= floor((r-sqrt(2)+delta)^2);
%p A309815    for x from x0 to x1 do
%p A309815      dx:= abs(sqrt(2)+sqrt(x)-r);
%p A309815      if is(dx < delta) then
%p A309815        delta:= dx;
%p A309815        R:= R, x;
%p A309815      fi
%p A309815    od
%p A309815 od:
%p A309815 R; # _Robert Israel_, Aug 18 2019
%t A309815 d[x_] := Abs[x - Round[x]]; dm = 1; s = {}; Do[If[(d1 = d[Sqrt[2] + Sqrt[n]]) < dm, dm = d1; AppendTo[s, n]], {n, 1, 10^5}]; s (* _Amiram Eldar_, Aug 18 2019 *)
%o A309815 (Python) import math
%o A309815 a = 2**(1/2)
%o A309815 l = []
%o A309815 closest = 1.0
%o A309815 for i in range(1, 100000000):
%o A309815     b = i**(1/2)
%o A309815     c = abs(a+b - round(a+b))
%o A309815     if c < closest:
%o A309815         print(i, c)
%o A309815         closest = c
%o A309815         l.append(i)
%o A309815 print(l)
%K A309815 nonn
%O A309815 1,2
%A A309815 _Ben Paul Thurston_, Aug 18 2019
%E A309815 More terms from _Giovanni Resta_, Aug 19 2019