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

A171758 Binary expansion of numbers in A171757.

Original entry on oeis.org

10, 100, 1000, 1010, 10000, 10010, 10100, 10110, 100000, 100010, 100100, 100110, 101000, 101010, 101100, 101110, 1000000, 1000010, 1000100, 1000110, 1001000, 1001010, 1001100, 1001110, 1010000, 1010010, 1010100, 1010110, 1011000, 1011010, 1011100, 1011110
Offset: 1

Views

Author

N. J. A. Sloane, Oct 12 2010

Keywords

Crossrefs

Programs

  • Mathematica
    bin[n_] := FromDigits[IntegerDigits[n, 2]]; bin /@ Select[Range[2, 100, 2], IntegerDigits[#, 2][[1 ;; 2]] == {1, 0} &] (* Amiram Eldar, Sep 01 2020 *)

Formula

a(n) = A007088(A171757(n)). - Amiram Eldar, Sep 01 2020

A076478 The binary Champernowne sequence: concatenate binary vectors of lengths 1, 2, 3, ... in numerical order.

Original entry on oeis.org

0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

N. J. A. Sloane, Nov 10 2002

Keywords

Comments

Can also be seen as triangle where row n contains all binary vectors of length n+1. - Reinhard Zumkeller, Aug 18 2015
From Clark Kimberling, Jul 18 2021: (Start)
In the following list, W represents the sequence of words w(n) represented by A076478. The list includes five partitions and two self-inverse permutations of the positive integers.
length of w(n): A000523
positions in W of words w(n) such that # 0's = # 1's: A258410;
positions in W of words w(n) such that # 0's < # 1's: A346299;
positions in W of words w(n) such that # 0's > # 1's: A346300;
positions in W of words w(n) that end with 0: A005498;
positions in W of words w(n) that end with 1: A005843;
positions in W of words w(n) such that first digit = last digit: A346301;
positions in W of words w(n) such that first digit != last digit: A346302;
positions in W of words w(n) such that 1st digit = 0 and last digit 0: A171757;
positions in W of words w(n) such that 1st digit = 0 and last digit 1: A346303;
positions in W of words w(n) such that 1st digit = 1 and last digit 0: A346304;
positions in W of words w(n) such that 1st digit = 1 and last digit 1: A346305;
position in W of n-th positive integer (base 2): A206332;
positions in W of binary complement of w(n): A346306;
sum of digits in w(n): A048881;
number of runs in w(n): A346307;
positions in W of palindromes: A346308;
positions in W of words such that #0's - #1's is odd: A346309;
positions in W of words such that #0's - #1's is even: A346310;
positions in W of the reversal of the n-th word in W: A081241. (End)

Examples

			0,
1,
0,0,
0,1,
1,0,
1,1,
0,0,0,
0,0,1,
0,1,0,
0,1,1,
1,0,0,
1,0,1,
...
		

References

  • Bodil Branner, Dynamics, Chap. IV.14 of The Princeton Companion to Mathematics, ed. T. Gowers, p. 499.
  • K. Dajani and C. Kraaikamp, Ergodic Theory of Numbers, Math. Assoc. America, 2002, p. 72.

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr)
    a076478 n = a076478_list !! n
    a076478_list = concat $ tail $ map (tail . reverse . unfoldr
       (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2 )) [1..]
    -- Reinhard Zumkeller, Feb 08 2012
    
  • Haskell
    a076478_row n = a076478_tabf !! n :: [[Int]]
    a076478_tabf = tail $ iterate (\bs -> map (0 :) bs ++ map (1 :) bs) [[]]
    a076478_list' = concat $ concat a076478_tabf
    -- Reinhard Zumkeller, Aug 18 2015
    
  • Mathematica
    d[n_] := Rest@IntegerDigits[n + 1, 2] + 1; -1 + Flatten[Array[d, 50]] (* Clark Kimberling, Feb 07 2012 *)
    z = 1000;
    t1 = Table[Tuples[{0, 1}, n], {n, 1, 10}];
    "All binary words, lexicographic order:"
    tt = Flatten[t1, 1]; (* all binary words, lexicographic order *)
    "All binary words, flattened:"
    Flatten[tt];
    w[n_] := tt[[n]];
    "List tt of all binary words:"
    tt = Table[w[n], {n, 1, z}]; (*  all the binary words *)
    u1 = Flatten[tt]; (* words, concatenated, A076478, binary Champernowne sequence *)
    u2 = Map[Length, tt];
    "Positions of 0^n:"
    Flatten[Position[Map[Union, tt], {0}]]
    "Positions of 1^n:"
    Flatten[Position[Map[Union, tt], {1}]]
    "Positions of words in which #0's = #1's:"  (* A258410 *)
    "This and the next two sequences partition N."
    u3 = Select[Range[Length[tt]], Count[tt[[#]], 0] == Count[tt[[#]], 1] &]
    "Positions of words in which #0's < #1's:"  (* A346299 *)
    u4 = Select[Range[Length[tt]], Count[tt[[#]], 0] < Count[tt[[#]], 1] &]
    "Positions of words in which #0's > #1's:"  (* A346300 *)
    u5 = Select[Range[Length[tt]], Count[tt[[#]], 0] > Count[tt[[#]], 1] &]
    "Positions of words ending with 0:" (* A005498 *)
    u6 = Select[Range[Length[tt]], Last[tt[[#]]] == 0 &]
    "Positions of words ending with 1:" (* A005843 *)
    u7 = Select[Range[Length[tt]], Last[tt[[#]]] == 1 &]
    "Positions of words starting and ending with same digit:" (* A346301 *)
    u8 = Select[Range[Length[tt]], First[tt[[#]]] == Last[tt[[#]]] &]
    "Positions of words starting and ending with opposite digits:" (* A346302  *)
    u9 = Select[Range[Length[tt]], First[tt[[#]]] != Last[tt[[#]]] &]
    "Positions of words starting with 0 and ending with 0:" (* A346303 *)
    "This and the next three sequences partition N."
    u10 = Select[Range[Length[tt]], First[tt[[#]]] == 0 && Last[tt[[#]]] == 0 &]
    "Positions of words starting with 0 and ending with 1:" (* A171757 *)
    u11 = Select[Range[Length[tt]], First[tt[[#]]] == 0 && Last[tt[[#]]] == 1 &]
    "Positions of words starting with 1 and ending with 0:" (* A346304 *)
    u12 = Select[Range[Length[tt]], First[tt[[#]]] == 1 && Last[tt[[#]]] == 0 &]
    "Positions of words starting with 1 and ending with 1:" (* A346305 *)
    u13 = Select[Range[Length[tt]], First[tt[[#]]] == 1 && Last[tt[[#]]] == 1 &]
    "Position of n-th positive integer (base 2) in tt:"
    d[n_] := If[First[w[n]] == 1, FromDigits[w[n], 2]];
    u14 = Flatten[Table[Position[Table[d[n], {n, 1, 200}], n], {n, 1, 200}]] (* A206332 *)
    "Position of binary complement of w(n):"
    u15 = comp = Flatten[Table[Position[tt, 1 - w[n]], {n, 1, 50}]] (* A346306 *)
    "Sum of digits of w(n):"
    u16 = Table[Total[w[n]], {n, 1, 100}] (* A048881 *)
    "Number of runs in w(n):"
    u17 = Map[Length, Table[Map[Length, Split[w[n]]], {n, 1, 100}]] (* A346307 *)
    "Palindromes:"
    Select[tt, # == Reverse[#] &]
    "Positions of palindromes:"
    u18 = Select[Range[Length[tt]], tt[[#]] == Reverse[tt[[#]]] &] (* A346308 *)
    "Positions of words in which #0's - #1's is odd:"
    u19 = Select[Range[Length[tt]], OddQ[Count[w[#], 0] - Count[w[#], 1]] &] (* A346309 *)
    "Positions of words in which #0's - #1's is even:"
    u20 = Select[Range[Length[tt]], EvenQ[Count[w[#], 0] - Count[w[#], 1]] &] (* A346310 *)
    "Position of the reversal of the n-th word:"  (* A081241 *)
    u21 = Flatten[Table[Position[tt, Reverse[w[n]]], {n, 1, 150}]]
    (* Clark Kimberling, Jul 18 2011 *)
  • PARI
    {m=5; for(d=1,m, for(k=0,2^d-1,v=binary(k); while(matsize(v)[2]
    				
  • PARI
    listn(n)= my(a=List(), i=0, s=0); while(s<=n, listput(~a, binary(i++)[^1]); s+=#a[#a]); concat(a)[1..n+1]; \\ Ruud H.G. van Tol, Mar 17 2025
    
  • Python
    from itertools import count, product
    def agen():
        for digits in count(1):
            for b in product([0, 1], repeat=digits):
                yield from b
    g = agen()
    print([next(g) for n in range(105)]) # Michael S. Branicky, Jul 18 2021

Formula

To get the m-th binary vector, write m+1 in base 2 and remove the initial 1. - Clark Kimberling, Feb 07 2010

Extensions

Extended by Klaus Brockhaus, Nov 11 2002

A346303 Positions of words in A076478 that start with 0 and end with 0.

Original entry on oeis.org

1, 3, 7, 9, 15, 17, 19, 21, 31, 33, 35, 37, 39, 41, 43, 45, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179
Offset: 1

Views

Author

Clark Kimberling, Jul 21 2021

Keywords

Comments

The sequences A346303, A171757, A346304, A346305 partition the positive integers. See A076478 for a guide to related sequences.
The position of the words 0, 00, 000, 0000, ... (all-zero) in A076478 is given by A000225. So this sequence is given by the subsequence A000225 and filling the gaps halfway up (until the leading 0 toggles) with odd numbers, from 7 to 9, from 15 to 21, from 31 to 45 etc. So the first differences are 2, 4, 2, 6, 2, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, ... which is A052548 with 1, 3, 7, 15,... (A000225) intermediate 2's. - R. J. Mathar, Sep 08 2021

Examples

			The first fourteen words w(n) are 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, so that a(3) = 7.
		

Crossrefs

Programs

A346304 Positions of words in A076478 that start with 1 and end with 0.

Original entry on oeis.org

5, 11, 13, 23, 25, 27, 29, 47, 49, 51, 53, 55, 57, 59, 61, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237
Offset: 1

Views

Author

Clark Kimberling, Jul 21 2021

Keywords

Comments

The sequences A346303, A171757, A346304, A346305 partition the positive integers. See A076478 for a guide to related sequences.

Examples

			The first fourteen words w(n) are 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, so that a(1) = 5.
		

Crossrefs

Programs

A171763 Odd numbers whose binary expansion begins 10.

Original entry on oeis.org

5, 9, 11, 17, 19, 21, 23, 33, 35, 37, 39, 41, 43, 45, 47, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179
Offset: 1

Views

Author

N. J. A. Sloane, Oct 12 2010

Keywords

Crossrefs

A subsequence of A004754.

Programs

  • Mathematica
    Select[Range[3,181,2],Take[IntegerDigits[#,2],2]=={1,0}&] (* Harvey P. Dale, Jun 09 2016 *)

A346305 Positions of words in A076478 that start with 1 and end with 1.

Original entry on oeis.org

2, 6, 12, 14, 24, 26, 28, 30, 48, 50, 52, 54, 56, 58, 60, 62, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238
Offset: 1

Views

Author

Clark Kimberling, Aug 16 2021

Keywords

Comments

The sequences A346303, A171757, A346304, and this sequence partition the positive integers. See A076478 for a guide to related sequences.
Is this A079946 with a 2 added in front? - R. J. Mathar, Sep 07 2021

Examples

			The first fourteen words w(n) are 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, so that a(1) = 2.
		

Crossrefs

Programs

A171781 Numbers for which the second bit of the binary expansion is equal to the last bit.

Original entry on oeis.org

2, 3, 4, 7, 8, 10, 13, 15, 16, 18, 20, 22, 25, 27, 29, 31, 32, 34, 36, 38, 40, 42, 44, 46, 49, 51, 53, 55, 57, 59, 61, 63, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125
Offset: 1

Views

Author

N. J. A. Sloane, Oct 12 2010

Keywords

Comments

Note that A005843 INTERSECT A171781 = A171757. This is an example of two sequences which both have a limiting density, but whose intersection does not.

Examples

			10 is a term since its binary representation is 1010 and both its second and last bits are 0. - _Amiram Eldar_, Sep 01 2020
		

Crossrefs

Programs

  • Mathematica
    Select[Range[2, 125], (d = IntegerDigits[#, 2])[[2]] == d[[-1]] &] (* Amiram Eldar, Sep 01 2020 *)

A346306 Position in A076478 of the binary complement of the n-th word in A076478.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Aug 16 2021

Keywords

Comments

Permutation of the positive integers obtained by reversing their order within successive subsets of length 2, 4, 8, 16, ... - Paolo Xausa, Mar 09 2023

Examples

			The first fourteen words w(n) are 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, so that a(3) = 6.
From _Paolo Xausa_, Mar 09 2023: (Start)
Written as an irregular triangle, where row r >= 1 has length 2^r and row sum is A103897(r), the sequence begins:
   2,  1;
   6,  5,  4,  3;
  14, 13, 12, 11, 10,  9,  8,  7;
  30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15;
  ... (End)
		

Crossrefs

Programs

  • Mathematica
    (See A007931.)
    A346306[rowmax_]:=Table[Range[2^(r+1)-2,2^r-1,-1],{r,rowmax}]; A346306[6] (* Paolo Xausa, Mar 09 2023 *)
  • Python
    from itertools import product
    def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z})
    def wgen(maxdigits):
        for digits in range(1, maxdigits+1):
            for b in product("01", repeat=digits):
                yield "".join(b)
    def auptod(maxdigits):
        w = [None] + [wn for wn in wgen(maxdigits)]
        return [w.index(comp(w[n])) for n in range(1, 2**(maxdigits+1) - 1)]
    print(auptod(6)) # Michael S. Branicky, Sep 03 2021

Formula

a(n) = 3*(2^d - 1) - n, where 2^d - 1 <= n <= 2^(d+1) - 2. - Michael S. Branicky, Sep 03 2021
Showing 1-8 of 8 results.