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.

Showing 1-4 of 4 results.

A233836 Run lengths of ones and zeros in binary expansion of sqrt(2), cf. A004539.

Original entry on oeis.org

1, 1, 2, 1, 1, 1, 1, 5, 1, 2, 4, 2, 2, 2, 2, 2, 7, 2, 3, 1, 4, 2, 2, 2, 1, 2, 1, 4, 1, 3, 1, 1, 2, 2, 1, 1, 5, 1, 2, 3, 1, 2, 2, 1, 2, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 5, 1, 1, 2, 5, 3, 3, 1, 1, 1, 2, 1, 4, 1, 2, 5, 1, 1, 3, 1, 1, 1, 1, 3
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 16 2013

Keywords

Examples

			. A004539: 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 ...
.    runs: _ _ ___ _ _ _ _ _________ _ ___ _______ ___ ___ ___ ___ ...
. lengths: 1 1  2  1 1 1 1     5     1  2     4     2   2   2   2  ...
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a233836 n = a233836_list !! (n-1)
    a233836_list = map length $ group a004539_list
  • Mathematica
    Length/@Split[RealDigits[Sqrt[2],2,300][[1]]] (* Harvey P. Dale, Oct 11 2020 *)

A084185 First occurrence of binary n in the binary expansion of sqrt(2).

Original entry on oeis.org

1, 1, 3, 8, 1, 3, 17, 8, 14, 4, 1, 19, 3, 18, 17, 8, 62, 51, 14, 6, 4, 1, 42, 80, 19, 3, 41, 18, 40, 17, 31, 8, 57, 62, 128, 51, 69, 20, 14, 6, 104, 4, 111, 66, 1, 96, 42, 146, 80, 50, 19, 118, 3, 77, 41, 126, 18, 98, 40, 17, 75, 33, 31, 453, 8, 57
Offset: 1

Views

Author

Ralf Stephan, May 18 2003

Keywords

Comments

a(n)=1 iff n in A084188. a(2^(n+1)+1) = A084187(n)-1.

Examples

			The binary expansion of sqrt(2) is 1.0110101000001..(A004539) and binary(10)=1010 occurs first at index 4, so a(10)=4.
		

Crossrefs

Cf. A084186.

Programs

  • Mathematica
    With[{s2=RealDigits[Sqrt[2],2,1000][[1]],n2=IntegerDigits[n,2]}, Flatten[ Table[First[ Position[Partition[s2,Length[n2],1],n2]],{n,70}]]] (* Harvey P. Dale, Oct 11 2012 *)

A084187 First occurrence of exactly n 0's in the binary expansion of sqrt(2).

Original entry on oeis.org

2, 15, 63, 58, 9, 1003, 524, 454, 1303, 5335, 22472, 8882, 37469, 32279, 220311, 92988, 698343, 24002, 574131, 3333660, 5940559, 4079882, 8356569, 115885798, 76570753, 202460870, 1034477781, 457034356, 1005210009, 3753736439, 2204906858, 50747186116, 32242071604, 159423417084, 114244391078, 74632918239
Offset: 1

Views

Author

Ralf Stephan, May 18 2003

Keywords

Examples

			The binary expansion of sqrt(2) is 1.0110101000001..(A004539) and at position 9, there are five 0's, framed by 1's, so a(5)=9.
		

Crossrefs

Programs

  • C
    See Links section of A084186.
  • Mathematica
    With[{d=RealDigits[Sqrt[2],2,116*10^6][[1]]},Flatten[Table[SequencePosition[d,Join[ {1},PadRight[{},n,0],{1}],1][[All,1]],{n,25}]]]+1 (* Harvey P. Dale, Dec 12 2022 *)
  • Python
    from math import isqrt
    from itertools import count
    def A084187(n):
        a, b = 2, (1<>1)|1
        for k in count(1-n):
            if isqrt(a)&b==c:
                return k
            a<<=2 # Chai Wah Wu, Jan 25 2024
    

Extensions

More terms from Ryan Propper, May 09 2006
a(26)-a(29) from Chai Wah Wu, Jan 25 2024
a(30)-a(36) from Nick Hobson, Feb 15 2024

A084188 a(0)=1, a(n+1) = 2*a(n) + b(n+2), where b(n)=A004539(n) is the n-th bit in the binary expansion of sqrt(2).

Original entry on oeis.org

1, 2, 5, 11, 22, 45, 90, 181, 362, 724, 1448, 2896, 5792, 11585, 23170, 46340, 92681, 185363, 370727, 741455, 1482910, 2965820, 5931641, 11863283, 23726566, 47453132, 94906265, 189812531, 379625062, 759250124
Offset: 0

Views

Author

Ralf Stephan, May 18 2003

Keywords

Comments

Numerators in approximation sqrt(2) ~ a(n)/2^n.
a(n) is the number k such that {log_2(k)} < 1/2 < {log_2(k+1)}, where { } = fractional part. Equivalently, the jump sequence of f(x) = log_2(x), in the sense that these are the positive integers k for which round(log_2(k)) < round(log_2(k+1)); see A219085. - Clark Kimberling, Jan 01 2013
Largest k such that k^2 <= 2^(2n + 1). - Irina Gerasimova, Jul 07 2013

Crossrefs

Programs

  • Haskell
    a084188 n = a084188_list !! n
    a084188_list = scanl1 (\u v -> 2 * u + v) a004539_list
    -- Reinhard Zumkeller, Dec 16 2013
    
  • Magma
    [Isqrt(2^(2*n+1)):n in[0..40]]; // Jason Kimberley, Oct 25 2016
    
  • Maple
    A084188 := n->floor(sqrt(2)*2^n); # Peter Luschny, Sep 20 2011
  • Mathematica
    Table[Floor[Sqrt[2] 2^n],{n,0,30}] (* Harvey P. Dale, Aug 15 2013 *)
  • PARI
    a(n)=floor(sqrt(2)<Charles R Greathouse IV, Sep 22 2011
    
  • PARI
    {a(n) = sqrtint(2*4^n)}; /* Michael Somos, Oct 29 2016 */
    
  • Python
    from math import isqrt
    def A084188(n): return isqrt(1<<(n<<1)+1) # Chai Wah Wu, Jan 24 2024

Formula

a(n) = floor(sqrt(2)*2^n).
a(n) = A017910(2*n+1). - Peter Luschny, Sep 20 2011
Showing 1-4 of 4 results.