login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 0
1, 2, 3, 6, 7, 13, 21, 112, 243, 275, 466, 761, 1128, 4704, 9523, 10730, 17579, 28085, 41041, 165312, 331299, 372815, 607754, 967441, 1410360, 5648160, 11300259, 12713402, 20707831, 32942845, 48005301, 192060400, 384143763, 432165299, 703818922, 1119543881, 1631318640 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

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

LINKS

Table of n, a(n) for n=1..37.

EXAMPLE

a(6) = 13 because sqrt(2)+sqrt(13) is closer to an integer than any of the previous 5 terms.

MAPLE

R:= 1: delta:= sqrt(2)-1:

for r from 2 to 10000 do

   x0:= ceil((r - sqrt(2)-delta)^2);

   x1:= floor((r-sqrt(2)+delta)^2);

   for x from x0 to x1 do

     dx:= abs(sqrt(2)+sqrt(x)-r);

     if is(dx < delta) then

       delta:= dx;

       R:= R, x;

     fi

   od

od:

R; # Robert Israel, Aug 18 2019

MATHEMATICA

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 *)

PROG

(Python) import math

a = 2**(1/2)

l = []

closest = 1.0

for i in range(1, 100000000):

    b = i**(1/2)

    c = abs(a+b - round(a+b))

    if c < closest:

        print(i, c)

        closest = c

        l.append(i)

print(l)

CROSSREFS

Sequence in context: A294916 A233423 A328024 * A256800 A172105 A092482

Adjacent sequences:  A309812 A309813 A309814 * A309816 A309817 A309818

KEYWORD

nonn

AUTHOR

Ben Paul Thurston, Aug 18 2019

EXTENSIONS

More terms from Giovanni Resta, Aug 19 2019

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 29 05:25 EST 2020. Contains 332353 sequences. (Running on oeis4.)