%I #94 Sep 09 2024 16:40:50
%S 1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,
%T 1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,
%U 1,0,0,1,0,1,1,1,1,1,0,1,1,0,0,0,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1
%N Expansion of sqrt(2) in base 2.
%C Bailey, Borwein, Crandall, & Pomerance prove a general result that the first n terms contain >> sqrt(n) 1's. Vandehey improves this to sqrt(2*n)(1 + o(1)). - _Charles R Greathouse IV_, Nov 07 2017
%H T. D. Noe, <a href="/A004539/b004539.txt">Table of n, a(n) for n = 1..1000</a>
%H B. Adamczewski and N. Rampersad, <a href="http://dx.doi.org/10.1090/S0002-9939-08-09319-2">On patterns occurring in binary algebraic numbers</a>, Proc. Amer. Math. Soc. 136 (2008), 3105-3109.
%H David H. Bailey, Jonathan M. Borwein, Richard E. Crandall, and Carl Pomerance, <a href="https://doi.org/10.5802/jtnb.457">On the binary expansions of algebraic numbers</a>, J. Théor. Nombres Bordeaux, 16 (2004), 487-518.
%H R. L. Graham and H. O. Pollak, <a href="http://www.jstor.org/stable/2688390">Note on a nonlinear recurrence related to sqrt(2)</a>, Mathematics Magazine, Volume 43, Pages 143-145, 1970. Zbl 201.04705.
%H R. K. Guy, <a href="/A005165/a005165.pdf">The strong law of small numbers</a>. Amer. Math. Monthly 95 (1988), no. 8, 697-712. [Annotated scanned copy]
%H Richard Isaac, <a href="http://arXiv.org/abs/math/0512404">On the simple normality to base 2 of the square root of s, for s not a perfect square.</a>, arXiv:math/0512404 [math.NT], 2005-2006.
%H Jason Kimberley, <a href="/wiki/User:Jason_Kimberley/sqrt_base">Index of expansions of sqrt(d) in base b</a>
%H Thomas Stoll, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL8/Stoll/stoll56.pdf">On families of nonlinear recurrences related to digits</a>, Journal of Integer Sequences 8 (2005), 05.3.2.
%H Thomas Stoll, <a href="http://dx.doi.org/10.4064/aa125-1-8">On a problem of Erdős and Graham concerning digits</a>, Acta Arithmetica 125 (2006), pp. 89-100.
%H Thomas Stoll, <a href="http://arxiv.org/abs/0902.4168">A fancy way to obtain the binary digits of 759250125 sqrt{2}</a>, (2009), Amer. Math. Monthly, 117 (2010), 611-617.
%H Joseph Vandehey, <a href="https://arxiv.org/abs/1711.01722">On the binary digits of sqrt(2)</a>, arXiv:1711.01722 [math.NT], 2017.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WolframsIteration.html">Wolfram's Iteration</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PythagorassConstant.html">Pythagoras's Constant</a>
%F a(k) = floor(Sum_{n>=1} A005875(n)/exp(Pi*n/(2^((2/3)*k+(1/3))))) mod 2. Will give the k-th binary digit of sqrt(2). A005875 : number of ways to write n as sum of 3 squares. - _Simon Plouffe_, Dec 30 2023
%e 1.0110101000001001111001...
%t N[Sqrt[2], 200]; RealDigits[%, 2]
%t RealDigits[Sqrt[2],2,120][[1]] (* _Harvey P. Dale_, Aug 03 2024 *)
%o (bc) obase=2 scale=200 sqrt(2)
%o (Haskell)
%o a004539 n = a004539_list !! (n-1)
%o a004539_list = w 2 0 where
%o w x r = bit : w (4 * (x - (4 * r + bit) * bit)) (2 * r + bit)
%o where bit = head (dropWhile (\b -> (4 * r + b) * b < x) [0..]) - 1
%o -- _Reinhard Zumkeller_, Dec 16 2013
%o (PARI) binary(sqrt(2)) \\ _Michel Marcus_, Nov 06 2017
%o (PARI) a(n) = floor(quadgen(8)<<(n-1))%2; \\ _Chittaranjan Pardeshi_, Sep 09 2024
%Y Cf. A002193 (decimal version), A233836 (run lengths of 0's and 1's).
%K nonn,base,cons
%O 1,1
%A _N. J. A. Sloane_