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.

Previous Showing 11-20 of 86 results. Next

A059893 Reverse the order of all but the most significant bit in binary expansion of n: if n = 1ab..yz then a(n) = 1zy..ba.

Original entry on oeis.org

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

Views

Author

Marc LeBrun, Feb 06 2001

Keywords

Comments

A self-inverse permutation of the natural numbers.
a(n)=n if and only if A081242(n) is a palindrome. - Clark Kimberling, Mar 12 2003
a(n) is the position in B of the reversal of the n-th term of B, where B is the left-to-right binary enumeration sequence (A081242 with the empty word attached as first term). - Clark Kimberling, Mar 12 2003
From Antti Karttunen, Oct 28 2001: (Start)
When certain Stern-Brocot tree-related permutations are conjugated with this permutation, they induce a permutation on Z (folded to N), which is an infinite siteswap permutation (see, e.g., figure 7 in the Buhler and Graham paper, which is permutation A065174). We get:
A065260(n) = a(A057115(a(n))),
A065266(n) = a(A065264(a(n))),
A065272(n) = a(A065270(a(n))),
A065278(n) = a(A065276(a(n))),
A065284(n) = a(A065282(a(n))),
A065290(n) = a(A065288(a(n))). (End)
Every nonnegative integer has a unique representation c(1) + c(2)*2 + c(3)*2^2 + c(4)*2^3 + ..., where every c(i) is 0 or 1. Taking tuples of coefficients in lexical order (i.e., 0, 1; 01,11; 001,011,101,111; ...) yields A059893. - Clark Kimberling, Mar 15 2015
From Ed Pegg Jr, Sep 09 2015: (Start)
The reduced rationals can be ordered either as the Calkin-Wilf tree A002487(n)/A002487(n+1) or the Stern-Brocot tree A007305(n+2)/A047679(n). The present sequence gives the order of matching rationals in the other sequence.
For reference, the Calkin-Wilf tree is 1, 1/2, 2, 1/3, 3/2, 2/3, 3, 1/4, 4/3, 3/5, 5/2, 2/5, 5/3, 3/4, 4, 1/5, 5/4, 4/7, 7/3, 3/8, 8/5, 5/7, 7/2, 2/7, 7/5, 5/8, 8/3, 3/7, 7/4, 4/5, ..., which is A002487(n)/A002487(n+1).
The Stern-Brocot tree is 1, 1/2, 2, 1/3, 2/3, 3/2, 3, 1/4, 2/5, 3/5, 3/4, 4/3, 5/3, 5/2, 4, 1/5, 2/7, 3/8, 3/7, 4/7, 5/8, 5/7, 4/5, 5/4, 7/5, 8/5, 7/4, 7/3, 8/3, 7/2, ..., which is A007305(n+2)/A047679(n).
There is a great little OEIS-is-useful story here. I had code for the position of fractions in the Calkin-Wilf tree. The best I had for positions of fractions in the Stern-Brocot tree was the paper "Locating terms in the Stern-Brocot tree" by Bruce Bates, Martin Bunder, Keith Tognetti. The method was opaque to me, so I used my Calkin-Wilf code on the Stern-Brocot fractions, and got A059893. And thus the problem was solved. (End)

Examples

			a(11) = a(1011) = 1110 = 14.
With empty word e prefixed, A081242 becomes (e,1,2,11,21,12,22,111,211,121,221,112,...); (reversal of term #9) = (term #12); i.e., a(9)=12 and a(12)=9. - _Clark Kimberling_, Mar 12 2003
From _Philippe Deléham_, Jun 02 2015: (Start)
This sequence regarded as a triangle with rows of lengths 1, 2, 4, 8, 16, ...:
   1;
   2,  3;
   4,  6,  5,  7;
   8, 12, 10, 14,  9,  13,  11,  15;
  16, 24, 20, 28, 18,  26,  22,  30,  17,  25,  21,  29,  19,  27,  23,  31;
  32, 48, 40, 56, 36,  52,  44, ...
Row sums = A010036. (End)
		

Crossrefs

{A000027, A054429, A059893, A059894} form a 4-group.
The set of permutations {A059893, A080541, A080542} generates an infinite dihedral group.
In other bases: A351702 (balanced ternary), A343150 (Zeckendorf), A343152 (lazy Fibonacci).

Programs

  • Haskell
    a059893 = foldl (\v b -> v * 2 + b) 1 . init . a030308_row
    -- Reinhard Zumkeller, May 01 2013
    (Scheme, with memoization-macro definec)
    (definec (A059893 n) (if (<= n 1) n (let* ((k (- (A000523 n) 1)) (r (A059893 (- n (A000079 k))))) (if (= 2 (floor->exact (/ n (A000079 k)))) (* 2 r) (+ 1 r)))))
    ;; Antti Karttunen, May 16 2015
    
  • Maple
    # Implements Bottomley's formula
    A059893 := proc(n) option remember; local k; if(1 = n) then RETURN(1); fi; k := floor_log_2(n)-1; if(2 = floor(n/(2^k))) then RETURN(2*A059893(n-(2^k))); else RETURN(1+A059893(n-(2^k))); fi; end;
    floor_log_2 := proc(n) local nn,i; nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi; nn := floor(nn/2); od; end;
    # second Maple program:
    a:= proc(n) local i, m, r; m, r:= n, 0;
          for i from 0 while m>1 do r:= 2*r +irem(m,2,'m') od;
          r +2^i
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 28 2015
  • Mathematica
    A059893 = Reap[ For[n=1, n <= 100, n++, a=1; b=n; While[b > 1, a = 2*a + 2*FractionalPart[b/2]; b=Floor[b/2]]; Sow[a]]][[2, 1]] (* Jean-François Alcover, Jul 16 2012, after Harry J. Smith *)
    ro[n_]:=Module[{idn=IntegerDigits[n,2]},FromDigits[Join[{First[idn]}, Reverse[ Rest[idn]]],2]]; Array[ro,80] (* Harvey P. Dale, Oct 24 2012 *)
  • PARI
    a(n) = my(b=binary(n)); fromdigits(concat(b[1], Vecrev(vector(#b-1, k, b[k+1]))), 2); \\ Michel Marcus, Sep 29 2021
    
  • Python
    def a(n): return int('1' + bin(n)[3:][::-1], 2)
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 21 2017
  • R
    maxrow <- 6 # by choice
    a <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)) {
      a[2^(m+1)+    k] <- 2*a[2^m+k]
      a[2^(m+1)+2^m+k] <- 2*a[2^m+k] + 1
    }
    a
    # Yosu Yurramendi, Mar 20 2017
    
  • R
    maxblock <- 7 # by choice
    a <- 1
    for(n in 2:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      anbit[1:(length(anbit) - 1)] <- anbit[rev(1:(length(anbit)-1))]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Apr 25 2021
    

Formula

a(n) = A030109(n) + A053644(n). If 2*2^k <= n < 3*2^k then a(n) = 2*a(n-2^k); if 3*2^k <= n < 4*2^k then a(n) = 1 + a(n-2^k) starting with a(1)=1. - Henry Bottomley, Sep 13 2001

A048896 a(n) = 2^(A000120(n+1) - 1), n >= 0.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 4, 1, 2, 2, 4, 2, 4, 4, 8, 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 2, 4, 4
Offset: 0

Views

Author

Keywords

Comments

a(n) = 2^A048881 = 2^{maximal power of 2 dividing the n-th Catalan number (A000108)}. [Comment corrected by N. J. A. Sloane, Apr 30 2018]
Row sums of triangle A128937. - Philippe Deléham, May 02 2007
a(n) = sum of (n+1)-th row terms of triangle A167364. - Gary W. Adamson, Nov 01 2009
a(n), n >= 1: Numerators of Maclaurin series for 1 - ((sin x)/x)^2, A117972(n), n >= 2: Denominators of Maclaurin series for 1 - ((sin x)/x)^2, the correlation function in Montgomery's pair correlation conjecture. - Daniel Forgues, Oct 16 2011
For n > 0: a(n) = A007954(A007931(n)). - Reinhard Zumkeller, Oct 26 2012
a(n) = A261363(2*(n+1), n+1). - Reinhard Zumkeller, Aug 16 2015
From Gus Wiseman, Oct 30 2022: (Start)
Also the number of coarsenings of the (n+1)-th composition in standard order. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. See link for sequences related to standard compositions. For example, the a(10) = 4 coarsenings of (2,1,1) are: (2,1,1), (2,2), (3,1), (4).
Also the number of times n+1 appears in A357134. For example, 11 appears at positions 11, 20, 33, and 1024, so a(10) = 4.
(End)

Examples

			From _Omar E. Pol_, Jul 21 2009: (Start)
If written as a triangle:
  1;
  1,2;
  1,2,2,4;
  1,2,2,4,2,4,4,8;
  1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16;
  1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32;
  ...,
the first half-rows converge to Gould's sequence A001316.
(End)
		

Crossrefs

This is Guy Steele's sequence GS(3, 5) (see A135416).
Equals first right hand column of triangle A160468.
Equals A160469(n+1)/A002425(n+1).
Standard compositions are listed by A066099.
The opposite version (counting refinements) is A080100.
The version for Heinz numbers of partitions is A317141.

Programs

  • Haskell
    a048896 n = a048896_list !! n
    a048896_list = f [1] where f (x:xs) = x : f (xs ++ [x,2*x])
    -- Reinhard Zumkeller, Mar 07 2011
    
  • Haskell
    import Data.List (transpose)
    a048896 = a000079 . a000120
    a048896_list = 1 : concat (transpose
       [zipWith (-) (map (* 2) a048896_list) a048896_list,
        map (* 2) a048896_list])
    -- Reinhard Zumkeller, Jun 16 2013
    
  • Magma
    [Numerator(2^n / Factorial(n+1)): n in [0..100]]; // Vincenzo Librandi, Apr 12 2014
  • Maple
    a := n -> 2^(add(i,i=convert(n+1,base,2))-1): seq(a(n), n=0..97); # Peter Luschny, May 01 2009
  • Mathematica
    NestList[Flatten[#1 /. a_Integer -> {a, 2 a}] &, {1}, 4] // Flatten (* Robert G. Wilson v, Aug 01 2012 *)
    Table[Numerator[2^n / (n + 1)!], {n, 0, 200}] (* Vincenzo Librandi, Apr 12 2014 *)
    Denominator[Table[BernoulliB[2*n] / (Zeta[2*n]/Pi^(2*n)), {n, 1, 100}]] (* Terry D. Grant, May 29 2017 *)
    Table[Denominator[((2 n)!/2^(2 n + 1)) (-1)^n], {n, 1, 100}]/4 (* Terry D. Grant, May 29 2017 *)
    2^IntegerExponent[CatalanNumber[Range[0,100]],2] (* Harvey P. Dale, Apr 30 2018 *)
  • PARI
    a(n)=if(n<1,1,if(n%2,a(n/2-1/2),2*a(n-1)))
    
  • PARI
    a(n) = 1 << (hammingweight(n+1)-1); \\ Kevin Ryde, Feb 19 2022
    

Formula

a(n) = 2^A048881(n).
a(n) = 2^k if 2^k divides A000108(n) but 2^(k+1) does not divide A000108(n).
It appears that a(n) = Sum_{k=0..n} binomial(2*(n+1), k) mod 2. - Christopher Lenard (c.lenard(AT)bendigo.latrobe.edu.au), Aug 20 2001
a(0) = 1; a(2*n) = 2*a(2*n-1); a(2*n+1) = a(n).
a(n) = (1/2) * A001316(n+1). - Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 26 2004
It appears that a(n) = Sum_{k=0..2n} floor(binomial(2n+2, k+1)/2)(-1)^k = 2^n - Sum_{k=0..n+1} floor(binomial(n+1, k)/2). - Paul Barry, Dec 24 2004
a(n) = Sum_{k=0..n} (T(n,k) mod 2) where T = A039598, A053121, A052179, A124575, A126075, A126093. - Philippe Deléham, May 02 2007
a(n) = numerator(b(n)), where sin(x)^2/x = Sum_{n>0} b(n)*(-1)^n x^(2*n-1). - Vladimir Kruchinin, Feb 06 2013
a((2*n+1)*2^p-1) = A001316(n), p >= 0 and n >= 0. - Johannes W. Meijer, Feb 12 2013
a(n) = numerator(2^n / (n+1)!). - Vincenzo Librandi, Apr 12 2014
a(2n) = (2n+1)!/(n!n!)/A001803(n). - Richard Turk, Aug 23 2017
a(2n-1) = (2n-1)!/(n!(n-1)!)/A001790(n). - Richard Turk, Aug 23 2017

Extensions

New definition from N. J. A. Sloane, Mar 01 2008

A102659 List of Lyndon words on {1,2} sorted first by length and then lexicographically.

Original entry on oeis.org

1, 2, 12, 112, 122, 1112, 1122, 1222, 11112, 11122, 11212, 11222, 12122, 12222, 111112, 111122, 111212, 111222, 112122, 112212, 112222, 121222, 122222, 1111112, 1111122, 1111212, 1111222, 1112112, 1112122, 1112212, 1112222, 1121122
Offset: 1

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

A Lyndon word is primitive (not a power of another word) and is earlier in lexicographic order than any of its cyclic shifts.

Crossrefs

The "co" version is A329318.
A triangular version is A296657.
A sequence listing all Lyndon compositions is A294859.
Numbers whose binary expansion is Lyndon are A328596.
Length of the Lyndon factorization of the binary expansion is A211100.

Programs

  • Haskell
    cf. link.
    
  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    Join@@Table[FromDigits/@Select[Tuples[{1,2},n],lynQ],{n,5}] (* Gus Wiseman, Nov 14 2019 *)
  • PARI
    is_A102659(n)={ vecsort(d=digits(n))!=d&&for(i=1,#d-1, n>[1,10^(#d-i)]*divrem(n,10^i)&&return); fordiv(#d,L,L<#d && d==concat(Col(vector(#d/L,i,1)~*vecextract(d,2^L-1))~)&&return); !setminus(Set(d),[1,2])} \\ The last check is the least expensive one, but not useful if we test only numbers with digits {1,2}.
    for(n=1,6,p=vector(n,i,10^(n-i))~;forvec(d=vector(n,i,[1,2]),is_A102659(m=d*p)&&print1(m","))) \\ One could use is_A102660 instead of is_A102659 here. - M. F. Hasler, Mar 08 2014

Formula

A102659 = A102660 intersect A007931 = A213969 intersect A239016. - M. F. Hasler, Mar 10 2014

Extensions

More terms from Franklin T. Adams-Watters, Dec 14 2006
Definition improved by Reinhard Zumkeller, Mar 23 2012

A000126 A nonlinear binomial sum.

Original entry on oeis.org

1, 2, 4, 8, 15, 27, 47, 80, 134, 222, 365, 597, 973, 1582, 2568, 4164, 6747, 10927, 17691, 28636, 46346, 75002, 121369, 196393, 317785, 514202, 832012, 1346240, 2178279, 3524547, 5702855, 9227432, 14930318, 24157782, 39088133, 63245949
Offset: 1

Views

Author

Keywords

Comments

a(n)-1 counts ternary numbers with no 0 digit (A007931) and at least one 2 digit, where the total of ternary digits is <= n. E.g., a(4)-1 = 7: 2 12 21 22 112 121 211. - Frank Ellermann, Dec 02 2001
A107909(a(n-1)) = A000079(n-1) = 2^(n-1). - Reinhard Zumkeller, May 28 2005
a(n) is the permanent of the n X n 0-1 matrix whose (i,j) entry is 1 iff i=1 or j=n or |i-j|<=1. For example, a(5)=15 is per([[1, 1, 1, 1, 1], [1, 1, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]]). - David Callan, Jun 07 2006
Conjecture. Let S(1)={1} and, for n>1, let S(n) be the smallest set containing x+1 and 2x+1 for each element x in S(n-1). Then a(n) is the sum of the elements in S(n). (See A122554 for a sequence defined in this way.) - John W. Layman, Nov 21 2007
a(n+1) indexes the corner blocks on the Fibonacci spiral built from blocks of unit area (using F(1) and F(2) as the sides of the first block). - Paul Barry, Mar 06 2008
The number of length n binary words with fewer than 2 0-digits between any pair of consecutive 1-digits. - Jeffrey Liese, Dec 23 2010
If b(n) = a(n+1) then b(0) = 1 and 2*b(n) >= b(n+1) for all n > 1 which is sufficient for b(n) to be a complete sequence. - Frank M Jackson, Mar 17 2013
From Gus Wiseman, Feb 10 2019: (Start)
Also the number of non-singleton subsets of {1, ..., n + 1} with no successive elements. For example, the a(5) = 15 subsets are:
{},
{1,3}, {1,4}, {1,5}, {1,6}, {2,4}, {2,5}, {2,6}, {3,5}, {3,6}, {4,6},
{1,3,5}, {1,3,6}, {1,4,6}, {2,4,6}.
Also the number of binary sequences with all zeros or at least 2 ones and no adjacent ones. For example, the a(1) = 1 through a(4) = 8 sequences are:
(00) (000) (0000) (00000)
(101) (0101) (00101)
(1001) (01001)
(1010) (01010)
(10001)
(10010)
(10100)
(10101)
(End)

References

  • Ralph P. Grimaldi, A generalization of the Fibonacci sequence. Proceedings of the seventeenth Southeastern international conference on combinatorics, graph theory, and computing (Boca Raton, Fla., 1986). Congr. Numer. 54 (1986), 123--128. MR0885268 (89f:11030). - N. J. A. Sloane, Apr 08 2012
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Heap-transform of A000071. - John W. Layman
Cf. A007931: binary strings with leading 0's, or ternary strings without 0's.
Differences are A000071.
Cf. A122554.
Cf. A000045.

Programs

  • GAP
    List([1..40], n-> Fibonacci(n+3)-(n+1)); # G. C. Greubel, Jul 09 2019
  • Magma
    [Fibonacci(n+3)-(n+1): n in [1..40]]; // G. C. Greubel, Jul 09 2019
    
  • Maple
    a:= n-> (Matrix([[1,1,1,2]]). Matrix(4, (i,j)-> if (i=j-1) then 1 elif j=1 then [3,-2,-1,1][i] else 0 fi)^n)[1,2]; seq(a(n), n=1..36); # Alois P. Heinz, Aug 26 2008
    # alternative
    A000126 := proc(n)
        combinat[fibonacci](n+3)-n-1 ;
    end proc:
    seq(A000126(n),n=1..40) ; # R. J. Mathar, Aug 05 2022
  • Mathematica
    LinearRecurrence[{3,-2,-1,1},{1,2,4,8},40] (* or *) CoefficientList[ Series[-(1-x+x^3)/((x^2+x-1)(x-1)^2),{x,0,40}],x]  (* Harvey P. Dale, Apr 24 2011 *)
    Table[Length[Select[Subsets[Range[n]],Min@@Abs[Subtract@@@Partition[#,2,1,1]]>1&]],{n,15}] (* Gus Wiseman, Feb 10 2019 *)
  • PARI
    Vec((1-x+x^3)/(1-x-x^2)/(1-x)^2+O(x^40)) \\ Charles R Greathouse IV, Oct 06 2011
    
  • PARI
    vector(40, n, fibonacci(n+3) -(n+1)) \\ G. C. Greubel, Jul 09 2019
    
  • Python
    def seq(n):
        if n < 0:
            return 1
        a, b = 1, 1
        for i in range(n + 1):
            a, b = b, a + b + i
        return a
    [seq(i) for i in range(n)] # Reza K Ghazi, Mar 03 2019
    
  • Sage
    [fibonacci(n+3)-(n+1) for n in (1..40)] # G. C. Greubel, Jul 09 2019
    

Formula

G.f.: (1 - x + x^3 ) / (( 1 - x - x^2 )*( 1 - x )^2). - Simon Plouffe in his 1992 dissertation.
From Henry Bottomley, Oct 22 2001: (Start)
a(n) = Fibonacci(n+3) - (n+1) = a(n-1) + a(n-2) + n - 2
a(n) = A001924(n-1) + 1 = A065220(n+3) + 2. (End)
a(n) = 2*a(n-1) - a(n-3) + 1. - Franklin T. Adams-Watters, Jan 13 2006
a(n+1) = 1 + Sum_{k=0..n} (Fibonacci(k+2) - 1) = Sum_{k=0..n} Fibonacci(k+2) - n. - Paul Barry, Mar 06 2008
a(n) = 3*a(n-1)-2*a(n-2)-a(n-3)+a(n-4). - Harvey P. Dale, May 05 2011
Closed-form without extra leading 1: ((15+7*sqrt(5))*((1+sqrt(5))/2)^n+(15-7*sqrt(5))*((1-sqrt(5))/2)^n-10*n-20)/10; closed-form with extra leading 1: ((20+8*sqrt(5))*((1+sqrt(5))/2)^n+(20-8*sqrt(5))*((1-sqrt(5))/2)^n-20*n-20)/20. - Tim Monahan, Jul 16 2011
G.f. for closed-form with extra leading 1: (1-2*x+x^2+x^3)/((1-x-x^2)*(x-1)^2). - Tim Monahan, Jul 17 2011

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

A032810 Numbers using only digits 2 and 3.

Original entry on oeis.org

2, 3, 22, 23, 32, 33, 222, 223, 232, 233, 322, 323, 332, 333, 2222, 2223, 2232, 2233, 2322, 2323, 2332, 2333, 3222, 3223, 3232, 3233, 3322, 3323, 3332, 3333, 22222, 22223, 22232, 22233, 22322, 22323, 22332, 22333, 23222, 23223
Offset: 1

Views

Author

Keywords

Comments

Identical to A007931 with substitution of digits 2 -> 3, 1 -> 2, i.e., application of the function A048379 or A256079(n) = n + A002275(A055642(n)). - M. F. Hasler, Mar 21 2015

Crossrefs

Cf. A020458, A143967, A248907 (permutation).
Cf. A032804-A032816 (in other bases), A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9).

Programs

  • Haskell
    a032810 = f 0 . (+ 1) where
       f y 1 = a004086 y
       f y x = f (10 * y + m + 2) x' where (x', m) = divMod x 2
    -- Reinhard Zumkeller, Mar 18 2015
    
  • Magma
    [n: n in [1..24000] | Set(Intseq(n)) subset {2, 3}]; // Vincenzo Librandi, May 27 2012
    
  • Magma
    [n eq 1 select 2 else IsOdd(n) select 10*Self(Floor(n/2))+2 else Self(n-1)+1: n in [1..40]]; // Bruno Berselli, May 27 2012
    
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{2,3},n],{n,5}]] (* Vincenzo Librandi, May 27 2012 *)
  • PARI
    A032810(n)=vector(#n=binary(n+1)[2..-1],i,10^(#n-i))*n~+10^#n\9*2 \\ M. F. Hasler, Mar 26 2015
    
  • Python
    def A032810(n): return int(bin(n+1)[3:])+(10**((n+1).bit_length()-1)-1<<1)//9 # Chai Wah Wu, Jul 15 2023

Formula

a(n) = f(n+1, 0) with f(n, x) = if n=1 then A004086(x) else f(floor(n/2), 10*x + 2 + n mod 2). - Reinhard Zumkeller, Sep 06 2008
a(n) is Theta(n^(log_2 10)); there are about n^(log_10 2) members of this sequence up to n. - Charles R Greathouse IV, Mar 18 2010
a(n) = A007931(n) + A002275(A000523(n+1)). A055642(a(n)) = A000523(n+1). - M. F. Hasler, Mar 21 2015

A256290 Numbers which have only digits 4 and 5 in base 10.

Original entry on oeis.org

4, 5, 44, 45, 54, 55, 444, 445, 454, 455, 544, 545, 554, 555, 4444, 4445, 4454, 4455, 4544, 4545, 4554, 4555, 5444, 5445, 5454, 5455, 5544, 5545, 5554, 5555, 44444, 44445, 44454, 44455, 44544, 44545, 44554, 44555, 45444, 45445, 45454, 45455, 45544
Offset: 1

Views

Author

M. F. Hasler, Mar 27 2015

Keywords

Crossrefs

Cf. A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9).

Programs

  • Magma
    [n: n in [1..60000] | Set(IntegerToSequence(n, 10)) subset {5, 4}];
    
  • Magma
    [n: n in [1..100000] | Set(Intseq(n)) subset {4,5}]; // Vincenzo Librandi, Aug 19 2016
    
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{4,5},n],{n,5}]]
  • PARI
    A256290(n)=vector(#n=binary(n+1)[2..-1],i,10^(#n-i))*n~+10^#n\9*4
    
  • Python
    def A256290(n): return int(bin(n+1)[3:])+(10**((n+1).bit_length()-1)-1<<2)//9 # Chai Wah Wu, Jul 15 2023

Formula

a(n) = A007931(n) + A002277(A000523(n+1)) = A032834(n) + A256077(n) etc.

A256291 Numbers which have only digits 5 and 6 in base 10.

Original entry on oeis.org

5, 6, 55, 56, 65, 66, 555, 556, 565, 566, 655, 656, 665, 666, 5555, 5556, 5565, 5566, 5655, 5656, 5665, 5666, 6555, 6556, 6565, 6566, 6655, 6656, 6665, 6666, 55555, 55556, 55565, 55566, 55655, 55656, 55665, 55666, 56555, 56556
Offset: 1

Views

Author

M. F. Hasler, Mar 27 2015

Keywords

Crossrefs

Cf. A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9).

Programs

  • Magma
    [n: n in [1..60000] | Set(IntegerToSequence(n, 10)) subset {5, 6}];
    
  • Magma
    [n: n in [1..100000] | Set(Intseq(n)) subset {5,6}]; // :Vincenzo Librandi_, Aug 19 2016
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{5,6},n],{n,5}]]
  • PARI
    A256291(n)=vector(#n=binary(n+1)[2..-1],i,10^(#n-i))*n~+10^#n\9*5
    

Formula

a(n) = A007931(n) + A002278(A000523(n+1)) = A256290(n) + A256077(n) etc.

A031955 Numbers with exactly two distinct base-10 digits.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 110, 112, 113, 114, 115, 116, 117, 118, 119, 121, 122, 131, 133, 141, 144, 151, 155, 161, 166
Offset: 1

Views

Author

Keywords

Comments

The three-digit terms are given by A210666(1,...,244). For numbers with exactly two distinct (but unspecified) digits in other bases, see A031948-A031954. For numbers made of two *given* digits, see A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9), and A032804-A032816 (in other bases). - M. F. Hasler, Apr 04 2015
A235154 is a subsequence. - Altug Alkan, Dec 03 2015
A235717 is a subsequence. - Robert Israel, Dec 03 2015

Crossrefs

Programs

  • Haskell
    a031955 n = a031955_list !! (n-1)
    a031955_list = filter ((== 2) . a043537) [0..]
    -- Reinhard Zumkeller, Feb 05 2012
    
  • Maple
    M:= 5: # to get all terms < 10^M
    sort([seq(seq(seq(seq(add(10^(m-j)*`if`(member(j,S2),d2,d1),j=1..m)  ,
      S2 = combinat:-powerset({$2..m}) minus {{}}),
      d2 = {$0..9} minus {d1}), d1 = 1..9), m=2..M)]); # Robert Israel, Dec 03 2015
  • Mathematica
    Select[Range@ 166, Length@ Union@ IntegerDigits@ # == 2 &] (* Michael De Vlieger, Dec 03 2015 *)
  • PARI
    is_A031955(n)=#Set(digits(n))==2 \\ M. F. Hasler, Apr 04 2015
    
  • Python
    def ok(n): return len(set(str(n))) == 2
    print(list(filter(ok, range(167)))) # Michael S. Branicky, Oct 12 2021

Formula

A043537(a(n)) = 2. - Reinhard Zumkeller, Dec 03 2009

Extensions

Name edited by Charles R Greathouse IV, Feb 13 2017

A032834 Numbers with digits 3 and 4 only.

Original entry on oeis.org

3, 4, 33, 34, 43, 44, 333, 334, 343, 344, 433, 434, 443, 444, 3333, 3334, 3343, 3344, 3433, 3434, 3443, 3444, 4333, 4334, 4343, 4344, 4433, 4434, 4443, 4444, 33333, 33334, 33343, 33344, 33433, 33434, 33443, 33444, 34333, 34334
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A032829-A032833 (in other bases), A102659 (Lyndon words in this sequence), A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032810 (digits 2 & 3), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9).

Programs

  • Magma
    [n: n in [1..35000] | Set(IntegerToSequence(n, 10)) subset {3, 4}]; // Vincenzo Librandi, May 30 2012
    
  • Maple
    S[1]:= [3,4]:
    for d from 2 to 5 do S[d]:= map(t -> (10*t+3,10*t+4), S[d-1]) od:
    seq(op(S[d]),d=1..5); # Robert Israel, Apr 03 2017
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{3,4},n],{n,5}]] (* Vincenzo Librandi, May 30 2012 *)
  • PARI
    A032834(n)=vector(#n=binary(n+1)[2..-1],i,10^(#n-i))*n~+10^#n\3 \\ M. F. Hasler, Mar 27 2015

Formula

a(n) = A007931(n) + A002276(A000523(n+1)) = A032810(n) + A256077(n) etc. - M. F. Hasler, Mar 27 2015
From Robert Israel, Apr 03 2017: (Start)
a(2*n+1) = 10*a(n)+3.
a(2*n+2) = 10*a(n)+4.
G.f. g(x) satisfies g(x) = 10*(x+x^2)*g(x^2) + x*(3+4*x)/(1-x^2). (End)

Extensions

Crossrefs added by M. F. Hasler, Mar 27 2015
Name corrected by Robert Israel, Apr 03 2017
Previous Showing 11-20 of 86 results. Next