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.

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

A185969 Let S be the sequence of power towers built of 2 and 3 sorted by their height and for equal heights - in lexicographic order: 2, 3, 2^2, 2^3, 3^2, 3^3, 2^2^2, 2^2^3 etc. A(n) = the permutation of indexes which reorders S by magnitude.

Original entry on oeis.org

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

Views

Author

Vladimir Reshetnikov, Feb 07 2011

Keywords

Examples

			a(6) =  7; tower(7)  = 2^2^2 = 2^4 =  16.
a(7) =  6; tower(6)  = 3^3   =        27.
a(8) = 11; tower(11) = 3^2^2 = 3^4 =  81.
a(9) =  8; tower(8)  = 2^2^3 = 2^8 = 256.
		

Crossrefs

Cf. A032810, A081241, A248907, A256179, A256231, A375374 (colexicographic instead of lexicographic order).

Formula

a(2*n-1) = A081241(2*A081241(a(n-1))+1) and a(2*n) = A081241(A081241(a(2*n-1))+1) for n >= 7. - Pontus von Brömssen, Aug 10 2024

Extensions

More terms from Alois P. Heinz, Apr 05 2011

A375374 Let X be the sequence of power towers built of 2's and 3's, sorted first by their height and then colexicographically: 2, 3, 2^2, 3^2, 2^3, 3^3, 2^2^2, 3^2^2, etc. Sequence gives the permutation of indices which reorders X by magnitude.

Original entry on oeis.org

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

Views

Author

Pontus von Brömssen, Aug 13 2024

Keywords

Comments

The terms are less dispersed here compared to A185969, because colex order is more correlated to the magnitude of the power tower than lex order is, i.e., we often get a smaller value of the power tower by putting the small numbers high up in the tower. Specifically, the only integers x, y >= 2 for which x < y and x^y < y^x is x = 2, y = 3.

Crossrefs

3rd row of A375376.
Cf. A081241, A185969 (lexicographic instead of colexicographic order), A375375 (inverse permutation).

Formula

a(2*n-1) = 2*a(n-1)+1 and a(2*n) = a(2*n-1)+1 for n >= 7.
a(n) = A081241(A185969(n)).

A375375 Inverse permutation to A375374.

Original entry on oeis.org

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

Views

Author

Pontus von Brömssen, Aug 13 2024

Keywords

Crossrefs

3rd row of A375377.
Cf. A081241, A256231, A375374 (inverse permutation).

Formula

a(n) = A256231(A081241(n)).
Showing 1-4 of 4 results.