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.

A004539 Expansion of sqrt(2) in base 2.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Comments

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

Examples

			1.0110101000001001111001...
		

Crossrefs

Cf. A002193 (decimal version), A233836 (run lengths of 0's and 1's).

Programs

  • Haskell
    a004539 n = a004539_list !! (n-1)
    a004539_list = w 2 0 where
       w x r = bit : w (4 * (x - (4 * r + bit) * bit)) (2 * r + bit)
         where bit = head (dropWhile (\b -> (4 * r + b) * b < x) [0..]) - 1
    -- Reinhard Zumkeller, Dec 16 2013
    
  • Mathematica
    N[Sqrt[2], 200]; RealDigits[%, 2]
    RealDigits[Sqrt[2],2,120][[1]] (* Harvey P. Dale, Aug 03 2024 *)
  • PARI
    binary(sqrt(2)) \\ Michel Marcus, Nov 06 2017
    
  • PARI
    a(n) = floor(quadgen(8)<<(n-1))%2; \\ Chittaranjan Pardeshi, Sep 09 2024
  • bc
    obase=2 scale=200 sqrt(2)
    

Formula

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