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

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

Original entry on oeis.org

1, 3, 40, 17, 74, 265, 31, 336, 11937, 1403, 8894, 3524, 33223, 126903, 3067, 109312, 390536, 553171, 280266, 962560, 1747112, 1740081, 30793169, 13109551, 118101037, 1077718187, 44908294, 1528865059, 1647265647, 3913429742, 10501492774, 4702573600, 81557258556, 107498528405
Offset: 1

Views

Author

Ralf Stephan, May 18 2003

Keywords

Examples

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

Crossrefs

Programs

  • C
    See Links section.
  • Python
    from itertools import count
    from math import isqrt
    def A084186(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 24 2024
    

Extensions

a(21)-a(29) from Chai Wah Wu, Jan 25 2024
a(30)-a(34) from Nick Hobson, Feb 15 2024

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 *)
Showing 1-3 of 3 results.