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-6 of 6 results.

A175948 Let @ denote binary concatenation. Then a(n) = A175945(n)@A175946(n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 11, 10, 9, 12, 13, 14, 15, 16, 23, 22, 19, 20, 21, 18, 17, 24, 27, 26, 25, 28, 29, 30, 31, 32, 47, 46, 39, 44, 41, 38, 35, 40, 43, 42, 45, 36, 37, 34, 33, 48, 55, 54, 51, 52, 53, 50, 49, 56, 59, 58, 57, 60, 61, 62, 63, 64, 95, 94, 79, 92, 81, 78, 71, 88
Offset: 1

Views

Author

Dylan Hamilton, Oct 28 2010

Keywords

Comments

Apparently this means: take the run lengths of the 1's, then the run lengths of the 0's in the binary representation of n (scanned MSB to LSB), concatenate both lists and interpret the long list as a list of run length of alternatingly 1's and 0's. Example: n = 9 = 8+1 is 1001 in binary. Run lengths of 1's are 11 (two runs each of length 1). Run lengths of 0's are 2 (one run of length 2). The concatenation is 112, which is interpreted as 1 one, 1 zero, 2 ones, binary 1011, and recoded to decimal as a(9) = 8+2+1=11. [R. J. Mathar, Dec 07 2010]

Programs

  • Mathematica
    takelist[l_, t_] := Module[{lent, term},Set[lent, Length[t]]; Table[l[[t[[y]]]], {y, 1, lent}]]
    frombinrep[x_] := FromDigits[Flatten[Table[Table[If[OddQ[n], 1, 0], {d, 1, x[[n]]}], {n, 1, Length[x]}]], 2]
    binrep[x_] := repcount[IntegerDigits[x, 2]]
    onebinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[1,Length[b],2]]]
    zerobinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[2,Length[b],2]]]
    Table[frombinrep[Flatten[{onebinrep[n], zerobinrep[n]}]], {n,START,END}]

A175949 Numbers obtained by concatenation of the binary representation of A175946(n) and A175945(n).

Original entry on oeis.org

1, 2, 3, 6, 5, 4, 7, 14, 13, 10, 11, 12, 9, 8, 15, 30, 29, 26, 27, 18, 21, 20, 23, 28, 25, 22, 19, 24, 17, 16, 31, 62, 61, 58, 59, 50, 53, 52, 55, 34, 37, 42, 43, 36, 41, 40, 47, 60, 57, 54, 51, 38, 45, 44, 39, 56, 49, 46, 35, 48, 33, 32, 63, 126, 125, 122, 123, 114, 117, 116
Offset: 1

Views

Author

Dylan Hamilton, Oct 28 2010

Keywords

Comments

The operation as in A175948, but the run-length encoding of zeros (A175946) is placed left from the run-length encoding of ones (A175945).

Examples

			n=9 is 1001 in binary. Run lengths of 0's are 2 (one run of length 2) and of 1's are 11 (two runs each of length 1). The concatenation of these lengths is 211, which is interpreted as 2 one's, 1 zero, 1 one, binary 1101, and recoded decimal as a(9)=8+4+1 =13.
		

Programs

  • Mathematica
    takelist[l_, t_] := Module[{lent, term},Set[lent, Length[t]]; Table[l[[t[[y]]]], {y, 1, lent}]]
    frombinrep[x_] := FromDigits[Flatten[Table[Table[If[OddQ[n], 1, 0], {d, 1, x[[n]]}], {n, 1, Length[x]}]], 2]
    binrep[x_] := repcount[IntegerDigits[x, 2]]
    onebinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[1,Length[b],2]]]
    zerobinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[2,Length[b],2]]]
    Table[frombinrep[Flatten[{zerobinrep[n], onebinrep[n]}]], {n,START,END}]

A175947 A175945(n)-A175946(n).

Original entry on oeis.org

1, 0, 3, -2, 1, 2, 7, -6, -1, 0, 3, 0, 5, 6, 15, -14, -5, -4, 1, -2, 3, 2, 7, -4, 3, 4, 11, 4, 13, 14, 31, -30, -13, -12, -3, -10, -1, -2, 5, -6, 1, 0, 9, 0, 7, 6, 15, -12, -1, 0, 9, 2, 11, 10, 23, 0, 11, 12, 27, 12, 29, 30, 63, -62, -29, -28, -11, -26, -9, -10, 1, -22, -7, -8, 5, -8
Offset: 1

Views

Author

Dylan Hamilton, Oct 28 2010

Keywords

Programs

  • Mathematica
    takelist[l_, t_] := Module[{lent, term},Set[lent, Length[t]]; Table[l[[t[[y]]]], {y, 1, lent}]]
    frombinrep[x_] := FromDigits[Flatten[Table[Table[If[OddQ[n], 1, 0], {d, 1, x[[n]]}], {n, 1, Length[x]}]], 2]
    binrep[x_] := repcount[IntegerDigits[x, 2]]
    onebinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[1,Length[b],2]]]
    zerobinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[2,Length[b],2]]]
    Table[frombinrep[onebinrep[n]], {n,START,END}]-Table[frombinrep[zerobinrep[n]], {n,START,END}]

A175946 List the run lengths of n's binary runs of zeros, then interpret this list as lengths of runs of alternating ones and zeros in binary.

Original entry on oeis.org

0, 1, 0, 3, 1, 1, 0, 7, 3, 2, 1, 3, 1, 1, 0, 15, 7, 6, 3, 4, 2, 2, 1, 7, 3, 2, 1, 3, 1, 1, 0, 31, 15, 14, 7, 12, 6, 6, 3, 8, 4, 5, 2, 4, 2, 2, 1, 15, 7, 6, 3, 4, 2, 2, 1, 7, 3, 2, 1, 3, 1, 1, 0, 63, 31, 30, 15, 28, 14, 14, 7, 24, 12, 13, 6, 12, 6, 6, 3, 16, 8, 9, 4, 11, 5, 5, 2, 8, 4, 5, 2, 4, 2, 2, 1
Offset: 1

Views

Author

Dylan Hamilton, Oct 28 2010

Keywords

Comments

A variant of A175945, where in the first (analyzing) step not the runs of 1's but the runs of 0's determine the list of run lengths. The second (synthesizing) step is the same in both sequences. - R. J. Mathar, May 28 2011

Examples

			From _R. J. Mathar_, May 28 2011: (Start)
N=16 is 10000 in binary which has one run of 4 zeros, and its run-length encoding is 4. This is interpreted as one run of 4 one's, 1111, which back to decimal is a(16)=15.
N=14 is 1110 in binary which has one run of 1 zero, and its run-length encoding is 1. This is interpreted as one run of 1 one, 1, which is in decimal a(14)=1.
N=19 is 10011 in binary which has one run of 2 zeros, and its run-length encoding is 2. This is interpreted as one run of 2 ones, 11, which back to decimal is a(19)=3. (End)
		

Programs

  • Mathematica
    takelist[l_, t_] := Module[{lent, term},Set[lent, Length[t]]; Table[l[[t[[y]]]], {y, 1, lent}]]
    frombinrep[x_] := FromDigits[Flatten[Table[Table[If[OddQ[n], 1, 0], {d, 1, x[[n]]}], {n, 1, Length[x]}]], 2]
    binrep[x_] := repcount[IntegerDigits[x, 2]]
    onebinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[1,Length[b],2]]]
    zerobinrep[x_]:=Module[{b},b=binrep[x];takelist[b,Range[2,Length[b],2]]]
    Table[frombinrep[zerobinrep[n]], {n,START,END}]

A378472 Position of start of first run of exactly n zeros in the base-2 representation of Pi, or -1 if no such run exists.

Original entry on oeis.org

17, 1, 26, 7, 109, 135, 96, 189, 2610, 902, 4267, 36139, 17317, 8375, 479166, 11791, 112954, 436893, 1286743, 726844, 5572140, 27456324, 2005750, 42248747, 200643872, 547151636, 171498580, 469458286, 1222711767, 2151391703, 1407238214
Offset: 1

Views

Author

James S. DeArmon, Nov 27 2024

Keywords

Comments

In base-2, Pi is: 11.00100100001111110110101010001... For this sequence, the integer part of Pi is ignored, and the first fractional bit is numbered one.
No further terms <= 4*10^9. - Michael S. Branicky, Dec 04 2024

Examples

			The first run of a single "0" bit is at position 17, so a(1) = 17.
The first run of exactly 2 zeros is at position 1, so a(2) = 1.
		

Crossrefs

Programs

  • Python
    import gmpy2
    gmpy2.get_context().precision = 2000000
    pi = gmpy2.const_pi()
    # Convert Pi to binary representation
    binary_pi = gmpy2.digits(pi, 2)[0] # zero-th element is the string of bits
    outVec = []
    for lenRun in range(1,20):
      str0 = "".join( ["0" for _ in range (lenRun)])
      l1 = binary_pi.find("1"+str0+"1")
      outVec.append(l1)
    print(outVec)

Formula

a(n) >= A178708(n). - Michael S. Branicky, Dec 13 2024

Extensions

a(21)-a(31) from Michael S. Branicky, Dec 04 2024
Clarified definition, added escape clause - N. J. A. Sloane, Dec 23 2024

A382307 Position of start of first run of alternating bit values in the base-2 representation of Pi, or -1 if no such run exists.

Original entry on oeis.org

1, 2, 2, 19, 19, 19, 19, 19, 1195, 1697, 1890, 1890, 1890, 1890, 15081, 63795, 206825, 206825, 206825, 470577, 470577, 557265, 557265, 557265, 557265, 557265, 447666572, 447666572, 699793337, 699793337, 2049646803, 2250772991
Offset: 1

Views

Author

James S. DeArmon, Mar 21 2025

Keywords

Comments

In base-2, Pi is: 11.00100100001111110110101010001... For this sequence, the integer part of Pi is ignored, and the first fractional bit is numbered one.
The bit substring may begin with either 0 or 1.
a(27) > 4*10^6. - Michael S. Branicky, Mar 23 2025
Conjecture: no term is -1 (would follow from a proof that Pi is normal in base 2). - Sean A. Irvine, Mar 30 2025
a(33) > 4*10^9. - Pontus von Brömssen, Apr 06 2025

Examples

			The first alternating bit run is "0", at position 1, so a(1) = 1. The second and third alternating bit runs are "01" and "010", starting at position 2, so a(2) and a(3) are both 2.
a(4)-a(8) = 19 since the binary digits of Pi are "10101010" starting at position 19.
		

Crossrefs

Programs

  • Python
    def binary_not(binary_string):
        return ''.join('1' if bit == '0' else '0' for bit in binary_string)
    # !pip install gmpy2   # may be necessary
    import gmpy2
    gmpy2.get_context().precision = 12000000
    pi = gmpy2.const_pi()
    # Convert Pi to binary representation
    binary_pi = gmpy2.digits(pi, 2)[0] # zero-th element is the string of bits
    binary_pi = binary_pi[2:] # remove leading "11" left of decimal point
    outVec = []
    strSearch0 = "" # this substring starts with "0"
    for lenRun in range(1,30):
      strSearch0 += "0" if lenRun%2==1 else "1"
      strSearch1 = binary_not(strSearch0)
      l0 = binary_pi.find(strSearch0)+1 # incr origin-0 result
      l1 = binary_pi.find(strSearch1)+1
      outVec.append(min(l0,l1))
    print(outVec)

Extensions

a(26)-a(32) from Pontus von Brömssen, Apr 06 2025
Showing 1-6 of 6 results.