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-10 of 83 results. Next

A059966 a(n) = (1/n) * Sum_{ d divides n } mu(n/d) * (2^d - 1).

Original entry on oeis.org

1, 1, 2, 3, 6, 9, 18, 30, 56, 99, 186, 335, 630, 1161, 2182, 4080, 7710, 14532, 27594, 52377, 99858, 190557, 364722, 698870, 1342176, 2580795, 4971008, 9586395, 18512790, 35790267, 69273666, 134215680, 260300986, 505286415, 981706806
Offset: 1

Views

Author

Roland Bacher, Mar 05 2001

Keywords

Comments

Dimensions of the homogeneous parts of the free Lie algebra with one generator in 1,2,3, etc. (Lie analog of the partition numbers).
This sequence is the Lie analog of the partition sequence (which gives the dimensions of the homogeneous polynomials with one generator in each degree) or similarly, of the partitions into distinct (or odd numbers) (which gives the dimensions of the homogeneous parts of the exterior algebra with one generator in each dimension).
The number of cycles of length n of rectangle shapes in the process of repeatedly cutting a square off the end of the rectangle. For example, the one cycle of length 1 is the golden rectangle. - David Pasino (davepasino(AT)yahoo.com), Jan 29 2009
In music, the number of distinct rhythms, at a given tempo, produced by a continuous repetition of measures with identical patterns of 1's and 0's (where 0 means no beat, and 1 means one beat), where each measure allows for n possible beats of uniform character, and when counted under these two conditions: (i) the starting and ending times for the measure are unknown or irrelevant and (ii) identical rhythms that can be produced by using a measure with fewer than n possible beats are excluded from the count. - Richard R. Forberg, Apr 22 2013
Richard R. Forberg's comment does not hold for n=1 because a(1)=1 but there are the two possible rhythms: "0" and "1". - Herbert Kociemba, Oct 24 2016
The comment does hold for n=1 as the rhythm "0" can be produced by using a measure of 0 beats and so is properly excluded from a(1)=1 by condition (ii) of the comment. - Travis Scott, May 28 2022
a(n) is also the number of Lyndon compositions (aperiodic necklaces of positive integers) with sum n. - Gus Wiseman, Dec 19 2017
Mobius transform of A008965. - Jianing Song, Nov 13 2021
a(n) is the number of cycles of length n for the map x->1 - abs(2*x-1) applied on rationals 0Michel Marcus, Jul 16 2025

Examples

			a(4)=3: the 3 elements [a,c], [a[a,b]] and d form a basis of all homogeneous elements of degree 4 in the free Lie algebra with generators a of degree 1, b of degree 2, c of degree 3 and d of degree 4.
From _Gus Wiseman_, Dec 19 2017: (Start)
The sequence of Lyndon compositions organized by sum begins:
  (1),
  (2),
  (3),(12),
  (4),(13),(112),
  (5),(14),(23),(113),(122),(1112),
  (6),(15),(24),(114),(132),(123),(1113),(1122),(11112),
  (7),(16),(25),(115),(34),(142),(124),(1114),(133),(223),(1213),(1132),(1123),(11113),(1222),(11212),(11122),(111112). (End)
		

References

  • C. Reutenauer, Free Lie algebras, Clarendon press, Oxford (1993).

Crossrefs

Apart from initial terms, same as A001037.

Programs

  • Haskell
    a059966 n = sum (map (\x -> a008683 (n `div` x) * a000225 x)
                         [d | d <- [1..n], mod n d == 0]) `div` n
    -- Reinhard Zumkeller, Nov 18 2011
    
  • Mathematica
    Table[1/n Apply[Plus, Map[(MoebiusMu[n/# ](2^# - 1)) &, Divisors[n]]], {n, 20}]
    (* Second program: *)
    Table[(1/n) DivisorSum[n, MoebiusMu[n/#] (2^# - 1) &], {n, 35}] (* Michael De Vlieger, Jul 22 2019 *)
  • Python
    from sympy import mobius, divisors
    def A059966(n): return sum(mobius(n//d)*(2**d-1) for d in divisors(n,generator=True))//n # Chai Wah Wu, Feb 03 2022

Formula

G.f.: Product_{n>0} (1-q^n)^a(n) = 1-q-q^2-q^3-q^4-... = 2-1/(1-q).
Inverse Euler transform of A011782. - Alois P. Heinz, Jun 23 2018
G.f.: Sum_{k>=1} mu(k)*log((1 - x^k)/(1 - 2*x^k))/k. - Ilya Gutkovskiy, May 19 2019
a(n) ~ 2^n / n. - Vaclav Kotesovec, Aug 10 2019
Dirichlet g.f.: f(s+1)/zeta(s+1) - 1, where f(s) = Sum_{n>=1} 2^n/n^s. - Jianing Song, Nov 13 2021

Extensions

Explicit formula from Paul D. Hanna, Apr 15 2002
Description corrected by Axel Kleinschmidt, Sep 15 2002

A007052 Number of order-consecutive partitions of n.

Original entry on oeis.org

1, 3, 10, 34, 116, 396, 1352, 4616, 15760, 53808, 183712, 627232, 2141504, 7311552, 24963200, 85229696, 290992384, 993510144, 3392055808, 11581202944, 39540700160, 135000394752, 460920178688, 1573679925248, 5372879343616, 18344157523968, 62630871408640, 213835170586624
Offset: 0

Views

Author

Colin Mallows, N. J. A. Sloane, and Simon Plouffe

Keywords

Comments

After initial terms, first differs from A291292 at a(6) = 1352, A291292(8) = 1353.
Joe Keane (jgk(AT)jgk.org) observes that this sequence (beginning at 3) is "size of raises in pot-limit poker, one blind, maximum raising".
It appears that this sequence is the BinomialMean transform of A001653 (see A075271). - John W. Layman, Oct 03 2002
Number of (s(0), s(1), ..., s(2n+1)) such that 0 < s(i) < 8 and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n+1, s(0) = 3, s(2n+1) = 4. - Herbert Kociemba, Jun 12 2004
Equals the INVERT transform of (1, 2, 5, 13, 34, 89, ...). - Gary W. Adamson, May 01 2009
a(n) is the number of compositions of n when there are 3 types of ones. - Milan Janjic, Aug 13 2010
a(n)/a(n-1) tends to (4 + sqrt(8))/2 = 3.414213.... Gary W. Adamson, Jul 30 2013
a(n) is the first subdiagonal of array A228405. - Richard R. Forberg, Sep 02 2013
Number of words of length n over {0,1,2,3,4} in which binary subwords appear in the form 10...0. - Milan Janjic, Jan 25 2017
From Gus Wiseman, Mar 05 2020: (Start)
Also the number of unimodal sequences of length n + 1 covering an initial interval of positive integers, where a sequence of integers is unimodal if it is the concatenation of a weakly increasing and a weakly decreasing sequence. For example, the a(0) = 1 through a(2) = 10 sequences are:
(1) (1,1) (1,1,1)
(1,2) (1,1,2)
(2,1) (1,2,1)
(1,2,2)
(1,2,3)
(1,3,2)
(2,1,1)
(2,2,1)
(2,3,1)
(3,2,1)
Missing are: (2,1,2), (2,1,3), (3,1,2).
Conjecture: Also the number of ordered set partitions of {1..n + 1} where no element of any block is greater than any element of a non-adjacent consecutive block. For example, the a(0) = 1 through a(2) = 10 ordered set partitions are:
{{1}} {{1,2}} {{1,2,3}}
{{1},{2}} {{1},{2,3}}
{{2},{1}} {{1,2},{3}}
{{1,3},{2}}
{{2},{1,3}}
{{2,3},{1}}
{{3},{1,2}}
{{1},{2},{3}}
{{1},{3},{2}}
{{2},{1},{3}}
a(n-1) is the number of hexagonal directed-column convex polyominoes having area n (see Baril et al. at page 4). - Stefano Spezia, Oct 14 2023

Examples

			G.f. = 1 + 3*x + 10*x^2 + 34*x^3 + 116*x^4 + 396*x^5 + 1352*x^6 + 4616*x^7 + ...
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    [Floor((2+Sqrt(2))^n*(1/2+Sqrt(2)/4)+(2-Sqrt(2))^n*(1/2-Sqrt(2)/4)): n in [0..30] ] ; // Vincenzo Librandi, Aug 20 2011
  • Mathematica
    a[n_]:=(MatrixPower[{{3,1},{1,1}},n].{{2},{1}})[[2,1]]; Table[a[n],{n,0,40}] (* Vladimir Joseph Stephan Orlovsky, Feb 20 2010 *)
    a[ n_] := ((2 + Sqrt[2])^(n + 1) + (2 - Sqrt[2])^(n + 1)) / 4 // Simplify; (* Michael Somos, Jan 25 2017 *)
    LinearRecurrence[{4, -2}, {1, 3}, 24] (* Jean-François Alcover, Jan 07 2019 *)
    unimodQ[q_]:=Or[Length[q]<=1,If[q[[1]]<=q[[2]],unimodQ[Rest[q]],OrderedQ[Reverse[q]]]];
    allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
    Table[Length[Select[Union@@Permutations/@allnorm[n],unimodQ]],{n,6}] (* Gus Wiseman, Mar 06 2020 *)
  • PARI
    {a(n) = real((2 + quadgen(8))^(n+1)) / 2}; /* Michael Somos, Mar 06 2003 */
    

Formula

a(n+1) = 4*a(n) - 2*a(n-1).
G.f.: (1-x)/(1-4*x+2*x^2).
Binomial transform of Pell numbers 1, 2, 5, 12, ... (A000129).
a(n) = A006012(n+1)/2 = A056236(n+1)/4. - Michael Somos, Mar 06 2003
a(n) = (A035344(n)+1)/2; a(n) = (2+sqrt(2))^n(1/2+sqrt(2)/4)+(2-sqrt(2))^n(1/2-sqrt(2)/4). - Paul Barry, Jul 16 2003
Second binomial transform of (1, 1, 2, 2, 4, 4, ...). a(n) = Sum_{k=1..floor(n/2)}, C(n, 2k)*2^(n-k-1). - Paul Barry, Nov 22 2003
a(n) = ( (2-sqrt(2))^(n+1) + (2+sqrt(2))^(n+1) )/4. - Herbert Kociemba, Jun 12 2004
a(n) = both left and right terms in M^n * [1 1 1], where M = the 3 X 3 matrix [1 1 1 / 1 2 1 / 1 1 1]. M^n * [1 1 1] = [a(n) A007070(n) a(n)]. E.g., a(3) = 34. M^3 * [1 1 1] = [34 48 34] (center term is A007070(3)). - Gary W. Adamson, Dec 18 2004
The i-th term of the sequence is the entry (2, 2) in the i-th power of the 2 X 2 matrix M = ((1, 1), (1, 3)). - Simone Severini, Oct 15 2005
E.g.f.: exp(2*x)*(cosh(sqrt(2)*x)+sinh(sqrt(2)*x)/sqrt(2)). - Paul Barry, Nov 20 2003
a(n) = A007068(2*n), n>0. - R. J. Mathar, Aug 17 2009
If p[i]=Fibonacci(2i-1) and if A is the Hessenberg matrix of order n defined by: A[i,j]=p[j-i+1], (i<=j), A[i,j]=-1, (i=j+1), and A[i,j]=0 otherwise. Then, for n>=1, a(n-1)= det A. - Milan Janjic, May 08 2010
a(n-1) = Sum_{k=-floor(n/4)..floor(n/4)} (-1)^k*binomial(2*n,n+4*k)/2. - Mircea Merca, Jan 28 2012
G.f.: G(0)*(1-x)/(2*x) + 1 - 1/x, where G(k) = 1 + 1/(1 - x*(2*k-1)/(x*(2*k+1) - (1-x)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 26 2013
a(n) = 3*a(n-1) + a(n-2) + a(n-3) + a(n-4) + ... + a(0). - Gary W. Adamson, Aug 12 2013
a(n) = a(-2-n) * 2^(n+1) for all n in Z. - Michael Somos, Jan 25 2017

A131689 Triangle of numbers T(n,k) = k!*Stirling2(n,k) = A000142(k)*A048993(n,k) read by rows, T(n, k) for 0 <= k <= n.

Original entry on oeis.org

1, 0, 1, 0, 1, 2, 0, 1, 6, 6, 0, 1, 14, 36, 24, 0, 1, 30, 150, 240, 120, 0, 1, 62, 540, 1560, 1800, 720, 0, 1, 126, 1806, 8400, 16800, 15120, 5040, 0, 1, 254, 5796, 40824, 126000, 191520, 141120, 40320, 0, 1, 510, 18150, 186480, 834120, 1905120, 2328480, 1451520, 362880
Offset: 0

Views

Author

Philippe Deléham, Sep 14 2007

Keywords

Comments

Triangle T(n,k), 0 <= k <= n, read by rows given by [0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,...] DELTA [1,1,2,2,3,3,4,4,5,5,6,6,...] where DELTA is the operator defined in A084938; another version of A019538.
See also A019538: version with n > 0 and k > 0. - Philippe Deléham, Nov 03 2008
From Peter Bala, Jul 21 2014: (Start)
T(n,k) gives the number of (k-1)-dimensional faces in the interior of the first barycentric subdivision of the standard (n-1)-dimensional simplex. For example, the barycentric subdivision of the 1-simplex is o--o--o, with 1 interior vertex and 2 interior edges, giving T(2,1) = 1 and T(2,2) = 2.
This triangle is used when calculating the face vectors of the barycentric subdivision of a simplicial complex. Let S be an n-dimensional simplicial complex and write f_k for the number of k-dimensional faces of S, with the usual convention that f_(-1) = 1, so that F := (f_(-1), f_0, f_1,...,f_n) is the f-vector of S. If M(n) denotes the square matrix formed from the first n+1 rows and n+1 columns of the present triangle, then the vector F*M(n) is the f-vector of the first barycentric subdivision of the simplicial complex S (Brenti and Welker, Lemma 2.1). For example, the rows of Pascal's triangle A007318 (but with row and column indexing starting at -1) are the f-vectors for the standard n-simplexes. It follows that A007318*A131689, which equals A028246, is the array of f-vectors of the first barycentric subdivision of standard n-simplexes. (End)
This triangle T(n, k) appears in the o.g.f. G(n, x) = Sum_{m>=0} S(n, m)*x^m with S(n, m) = Sum_{j=0..m} j^n for n >= 1 as G(n, x) = Sum_{k=1..n} (x^k/(1 - x)^(k+2))*T(n, k). See also the Eulerian triangle A008292 with a Mar 31 2017 comment for a rewritten form. For the e.g.f. see A028246 with a Mar 13 2017 comment. - Wolfdieter Lang, Mar 31 2017
T(n,k) = the number of alignments of length k of n strings each of length 1. See Slowinski. An example is given below. Cf. A122193 (alignments of strings of length 2) and A299041 (alignments of strings of length 3). - Peter Bala, Feb 04 2018
The row polynomials R(n,x) are the Fubini polynomials. - Emanuele Munarini, Dec 05 2020
From Gus Wiseman, Feb 18 2022: (Start)
Also the number of patterns of length n with k distinct parts (or with maximum part k), where we define a pattern to be a finite sequence covering an initial interval of positive integers. For example, row n = 3 counts the following patterns:
(1,1,1) (1,2,2) (1,2,3)
(2,1,2) (1,3,2)
(2,2,1) (2,1,3)
(1,1,2) (2,3,1)
(1,2,1) (3,1,2)
(2,1,1) (3,2,1)
(End)
Regard A048994 as a lower-triangular matrix and divide each term A048994(n,k) by n!, then this is the matrix inverse. Because Sum_{k=0..n} (A048994(n,k) * x^n / n!) = A007318(x,n), Sum_{k=0..n} (A131689(n,k) * A007318(x,k)) = x^n. - Natalia L. Skirrow, Mar 23 2023
T(n,k) is the number of ordered partitions of [n] into k blocks. - Alois P. Heinz, Feb 21 2025

Examples

			The triangle T(n,k) begins:
  n\k 0 1    2     3      4       5        6        7        8        9      10 ...
  0:  1
  1:  0 1
  2:  0 1    2
  3:  0 1    6     6
  4:  0 1   14    36     24
  5:  0 1   30   150    240     120
  6:  0 1   62   540   1560    1800      720
  7:  0 1  126  1806   8400   16800    15120     5040
  8:  0 1  254  5796  40824  126000   191520   141120    40320
  9:  0 1  510 18150 186480  834120  1905120  2328480  1451520   362880
  10: 0 1 1022 55980 818520 5103000 16435440 29635200 30240000 16329600 3628800
  ... reformatted and extended. - _Wolfdieter Lang_, Mar 31 2017
From _Peter Bala_, Feb 04 2018: (Start)
T(4,2) = 14 alignments of length 2 of 4 strings of length 1. Examples include
  (i) A -    (ii) A -    (iii) A -
      B -         B -          - B
      C -         - C          - C
      - D         - D          - D
There are C(4,1) = 4 alignments of type (i) with a single gap character - in column 1, C(4,2) = 6 alignments of type (ii) with two gap characters in column 1 and C(4,3) = 4 alignments of type (iii) with three gap characters in column 1, giving a total of 4 + 6 + 4 = 14 alignments. (End)
		

Crossrefs

Case m=1 of the polynomials defined in A278073.
Cf. A000142 (diagonal), A000670 (row sums), A000012 (alternating row sums), A210029 (central terms).
Cf. A008292, A028246 (o.g.f. and e.g.f. of sums of powers).
A version for partitions is A116608, or by maximum A008284.
A version for compositions is A235998, or by maximum A048004.
Classes of patterns:
- A000142 = strict
- A005649 = anti-run, complement A069321
- A019536 = necklace
- A032011 = distinct multiplicities
- A060223 = Lyndon
- A226316 = (1,2,3)-avoiding, weakly A052709, complement A335515
- A296975 = aperiodic
- A345194 = alternating, up/down A350354, complement A350252
- A349058 = weakly alternating
- A351200 = distinct runs
- A351292 = distinct run-lengths

Programs

  • Julia
    function T(n, k)
        if k < 0 || k > n return 0 end
        if n == 0 && k == 0 return 1 end
        k*(T(n-1, k-1) + T(n-1, k))
    end
    for n in 0:7
        println([T(n, k) for k in 0:n])
    end
    # Peter Luschny, Mar 26 2020
    
  • Maple
    A131689 := (n,k) -> Stirling2(n,k)*k!: # Peter Luschny, Sep 17 2011
    # Alternatively:
    A131689_row := proc(n) 1/(1-t*(exp(x)-1)); expand(series(%,x,n+1)); n!*coeff(%,x,n); PolynomialTools:-CoefficientList(%,t) end:
    for n from 0 to 9 do A131689_row(n) od; # Peter Luschny, Jan 23 2017
  • Mathematica
    t[n_, k_] := k!*StirlingS2[n, k]; Table[t[n, k], {n, 0, 9}, {k, 0, n}] // Flatten (* Jean-François Alcover, Feb 25 2014 *)
    T[n_, k_] := If[n <= 0 || k <= 0, Boole[n == 0 && k == 0], Sum[(-1)^(i + k) Binomial[k, i] i^(n + k), {i, 0, k}]]; (* Michael Somos, Jul 08 2018 *)
  • PARI
    {T(n, k) = if( n<0, 0, sum(i=0, k, (-1)^(k + i) * binomial(k, i) * i^n))};
    /* Michael Somos, Jul 08 2018 */
    
  • SageMath
    @cached_function
    def F(n): # Fubini polynomial
        R. = PolynomialRing(ZZ)
        if n == 0: return R(1)
        return R(sum(binomial(n, k)*F(n - k)*x for k in (1..n)))
    for n in (0..9): print(F(n).list()) # Peter Luschny, May 21 2021

Formula

T(n,k) = k*(T(n-1,k-1) + T(n-1,k)) with T(0,0)=1. Sum_{k=0..n} T(n,k)*x^k = (-1)^n*A000629(n), A033999(n), A000007(n), A000670(n), A004123(n+1), A032033(n), A094417(n), A094418(n), A094419(n) for x = -2, -1, 0, 1, 2, 3, 4, 5, 6 respectively. [corrected by Philippe Deléham, Feb 11 2013]
Sum_{k=0..n} T(n,k)*x^(n-k) = A000012(n), A000142(n), A000670(n), A122704(n) for x=-1, 0, 1, 2 respectively. - Philippe Deléham, Oct 09 2007
Sum_{k=0..n} (-1)^k*T(n,k)/(k+1) = Bernoulli numbers A027641(n)/A027642(n). - Peter Luschny, Sep 17 2011
G.f.: F(x,t) = 1 + x*t + (x+x^2)*t^2/2! + (x+6*x^2+6*x^3)*t^3/3! + ... = Sum_{n>=0} R(n,x)*t^n/n!.
The row polynomials R(n,x) satisfy the recursion R(n+1,x) = (x+x^2)*R'(n,x) + x*R(n,x) where ' indicates differentiation with respect to x. - Philippe Deléham, Feb 11 2013
T(n,k) = [t^k] (n! [x^n] (1/(1-t*(exp(x)-1)))). - Peter Luschny, Jan 23 2017
The n-th row polynomial has the form x o x o ... o x (n factors), where o denotes the black diamond multiplication operator of Dukes and White. See also Bala, Example E8. - Peter Bala, Jan 08 2018

A275692 Numbers k such that every rotation of the binary digits of k is less than k.

Original entry on oeis.org

0, 1, 2, 4, 6, 8, 12, 14, 16, 20, 24, 26, 28, 30, 32, 40, 48, 50, 52, 56, 58, 60, 62, 64, 72, 80, 84, 96, 98, 100, 104, 106, 108, 112, 114, 116, 118, 120, 122, 124, 126, 128, 144, 160, 164, 168, 192, 194, 196, 200, 202, 208, 210, 212, 216, 218, 224, 226, 228
Offset: 1

Views

Author

Robert Israel, Aug 05 2016

Keywords

Comments

0, and terms of A065609 that are not in A121016.
Number of terms with d binary digits is A001037(d).
Take the binary representation of a(n), reverse it, add 1 to each digit. The result is the decimal representation of A102659(n).
From Gus Wiseman, Apr 19 2020: (Start)
Also numbers k such that the k-th composition in standard order (row k of A066099) is a Lyndon word. For example, the sequence of all Lyndon words begins:
0: () 52: (1,2,3) 118: (1,1,2,1,2)
1: (1) 56: (1,1,4) 120: (1,1,1,4)
2: (2) 58: (1,1,2,2) 122: (1,1,1,2,2)
4: (3) 60: (1,1,1,3) 124: (1,1,1,1,3)
6: (1,2) 62: (1,1,1,1,2) 126: (1,1,1,1,1,2)
8: (4) 64: (7) 128: (8)
12: (1,3) 72: (3,4) 144: (3,5)
14: (1,1,2) 80: (2,5) 160: (2,6)
16: (5) 84: (2,2,3) 164: (2,3,3)
20: (2,3) 96: (1,6) 168: (2,2,4)
24: (1,4) 98: (1,4,2) 192: (1,7)
26: (1,2,2) 100: (1,3,3) 194: (1,5,2)
28: (1,1,3) 104: (1,2,4) 196: (1,4,3)
30: (1,1,1,2) 106: (1,2,2,2) 200: (1,3,4)
32: (6) 108: (1,2,1,3) 202: (1,3,2,2)
40: (2,4) 112: (1,1,5) 208: (1,2,5)
48: (1,5) 114: (1,1,3,2) 210: (1,2,3,2)
50: (1,3,2) 116: (1,1,2,3) 212: (1,2,2,3)
(End)

Examples

			6 is in the sequence because its binary representation 110 is greater than all the rotations 011 and 101.
10 is not in the sequence because its binary representation 1010 is unchanged under rotation by 2 places.
From _Gus Wiseman_, Oct 31 2019: (Start)
The sequence of terms together with their binary expansions and binary indices begins:
    1:       1 ~ {1}
    2:      10 ~ {2}
    4:     100 ~ {3}
    6:     110 ~ {2,3}
    8:    1000 ~ {4}
   12:    1100 ~ {3,4}
   14:    1110 ~ {2,3,4}
   16:   10000 ~ {5}
   20:   10100 ~ {3,5}
   24:   11000 ~ {4,5}
   26:   11010 ~ {2,4,5}
   28:   11100 ~ {3,4,5}
   30:   11110 ~ {2,3,4,5}
   32:  100000 ~ {6}
   40:  101000 ~ {4,6}
   48:  110000 ~ {5,6}
   50:  110010 ~ {2,5,6}
   52:  110100 ~ {3,5,6}
   56:  111000 ~ {4,5,6}
   58:  111010 ~ {2,4,5,6}
(End)
		

Crossrefs

A similar concept is A328596.
Numbers whose binary expansion is aperiodic are A328594.
Numbers whose reversed binary expansion is a necklace are A328595.
Binary necklaces are A000031.
Binary Lyndon words are A001037.
Lyndon compositions are A059966.
Length of Lyndon factorization of binary expansion is A211100.
Length of co-Lyndon factorization of binary expansion is A329312.
Length of Lyndon factorization of reversed binary expansion is A329313.
Length of co-Lyndon factorization of reversed binary expansion is A329326.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Rotational symmetries are counted by A138904.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Lyndon compositions are A275692 (this sequence).
- Co-Lyndon compositions are A326774.
- Rotational period is A333632.
- Co-necklaces are A333764.
- Co-Lyndon factorizations are counted by A333765.
- Lyndon factorizations are counted by A333940.
- Reversed necklaces are A333943.

Programs

  • Maple
    filter:= proc(n) local L, k;
      L:= convert(convert(n,binary),string);
      for k from 1 to length(L)-1 do
        if lexorder(L,StringTools:-Rotate(L,k)) then return false fi;
      od;
      true
    end proc:
    select(filter, [$0..1000]);
  • Mathematica
    filterQ[n_] := Module[{bits, rr}, bits = IntegerDigits[n, 2]; rr = NestList[RotateRight, bits, Length[bits]-1] // Rest; AllTrue[rr, FromDigits[#, 2] < n&]];
    Select[Range[0, 1000], filterQ] (* Jean-François Alcover, Apr 29 2019 *)
  • Python
    def ok(n):
        b = bin(n)[2:]
        return all(b[i:] + b[:i] < b for i in range(1, len(b)))
    print([k for k in range(230) if ok(k)]) # Michael S. Branicky, May 26 2022

A019536 Number of length n necklaces with integer entries that cover an initial interval of positive integers.

Original entry on oeis.org

1, 2, 5, 20, 109, 784, 6757, 68240, 787477, 10224812, 147512053, 2340964372, 40527565261, 760095929840, 15352212731933, 332228417657960, 7668868648772701, 188085259070219000, 4884294069438337429
Offset: 1

Views

Author

Manfred Goebel (goebel(AT)informatik.uni-tuebingen.de)

Keywords

Comments

Original name: a(n) = number of necklaces of n beads with up to n unlabeled colors.
The Moebius transform of this sequence is A060223.

Examples

			a(3) = 5 since there are the following length 3 words up to rotation:
     111,  112, 122, 123, 132.
a(4) = 20 since there are the following length 4 words up to rotation:
     1111,
     1112, 1122, 1212, 1222,
     1123, 1132, 1213, 1223, 1232, 1233, 1322, 1323, 1332,
     1234, 1243, 1324, 1342, 1423, 1432.
		

Crossrefs

Programs

  • Mathematica
    Needs["DiscreteMath`Combinatorica`"];
    mult[li:{__Integer}] := Multinomial @@ Length /@ Split[Sort[li]];
    neck[li:{__Integer}] := Module[{n, d}, n=Plus @@ li; d=n-First[li];Fold[ #1+(EulerPhi[ #2]*(n/#2)!)/Times @@ ((li/#2)!)&, 0, Divisors[GCD @@ li]]/n];
    Table[(mult /@ Partitions[n]).(neck /@ Partitions[n]), {n, 24}]
    (* second program: *)
    a[n_] := Sum[DivisorSum[n, EulerPhi[#]*StirlingS2[n/#, k] k! &]/n, {k, 1, n}];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Mar 31 2016, after Philippe Deléham *)
  • PARI
    a(n) = sum(k=1, n, sumdiv(n, d, eulerphi(d)*stirling(n/d, k, 2)*k!)/n); \\ Michel Marcus, Mar 31 2016

Formula

See Mathematica code.
a(n) ~ (n-1)! / (2 * log(2)^(n+1)). - Vaclav Kotesovec, Jul 21 2019
From Petros Hadjicostas, Aug 19 2019: (Start)
The first formula is due to Philippe Deléham from the Crossrefs (see also the programs below). The second one follows easily from the first one. The third one follows from the second one using the associative property of Dirichlet convolutions.
a(n) = Sum_{k = 1..n} (k!/n) * Sum_{d|n} phi(d) * S2(n/d, k), where S2(n, k) = Stirling numbers of 2nd kind (A008277).
a(n) = (1/n) * Sum_{d|n} phi(d) * A000670(n/d).
a(n) = Sum_{d|n} A060223(d).
(End)
From Richard L. Ollerton, May 07 2021: (Start)
a(n) = (1/n)*Sum_{k=1..n} A000670(gcd(n,k)).
a(n) = (1/n)*Sum_{k=1..n} A000670(n/gcd(n,k))*phi(gcd(n,k))/phi(n/gcd(n,k)). (End)

Extensions

Edited by Wouter Meeussen, Aug 06 2002
Corrected by T. D. Noe, Oct 31 2006
Edited by Andrew Howroyd, Aug 19 2019

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

A211100 Number of factors in Lyndon factorization of binary expansion of n.

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 2, 4, 3, 4, 4, 5, 2, 3, 2, 4, 3, 3, 2, 5, 3, 4, 3, 5, 4, 5, 5, 6, 2, 3, 2, 4, 2, 3, 2, 5, 3, 4, 2, 4, 3, 3, 2, 6, 3, 4, 3, 5, 4, 4, 3, 6, 4, 5, 4, 6, 5, 6, 6, 7, 2, 3, 2, 4, 2, 3, 2, 5, 3, 3, 2, 4, 2, 3, 2, 6, 3, 4, 3, 5, 4, 3, 2, 5, 3, 4, 3, 4, 3, 3, 2, 7, 3, 4, 3, 5, 3, 4, 3, 6, 4, 5, 3, 5, 4, 4, 3, 7, 4, 5, 4, 6, 5, 5, 4, 7
Offset: 0

Views

Author

N. J. A. Sloane, Mar 31 2012

Keywords

Comments

Any binary word has a unique factorization as a product of nonincreasing Lyndon words (see Lothaire). a(n) = number of factors in Lyndon factorization of binary expansion of n.
It appears that a(n) = k for the first time when n = 2^(k-1)+1.
We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Equivalently, a Lyndon word is a finite sequence that is lexicographically strictly less than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. - Gus Wiseman, Nov 12 2019

Examples

			n=25 has binary expansion 11001, which has Lyndon factorization (1)(1)(001) with three factors, so a(25) = 3.
Here are the Lyndon factorizations for small values of n:
.0.
.1.
.1.0.
.1.1.
.1.0.0.
.1.01.
.1.1.0.
.1.1.1.
.1.0.0.0.
.1.001.
.1.01.0.
.1.011.
.1.1.0.0.
...
		

References

  • M. Lothaire, Combinatorics on Words, Addison-Wesley, Reading, MA, 1983. See Theorem 5.1.5, p. 67.
  • G. Melançon, Factorizing infinite words using Maple, MapleTech Journal, vol. 4, no. 1, 1997, pp. 34-42

Crossrefs

Cf. A001037 (number of Lyndon words of length m); A102659 (list thereof).
A211095 and A211096 give information about the smallest (or rightmost) factor. Cf. A211097, A211098, A211099.
Row-lengths of A329314.
The "co-" version is A329312.
Positions of 2's are A329327.
The reversed version is A329313.
The inverted version is A329312.
Ignoring the first digit gives A211097.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#]]&]]]];
    Table[Length[lynfac[IntegerDigits[n,2]]],{n,0,30}] (* Gus Wiseman, Nov 12 2019 *)

A328509 Number of non-unimodal sequences of length n covering an initial interval of positive integers.

Original entry on oeis.org

0, 0, 0, 3, 41, 425, 4287, 45941, 541219, 7071501, 102193755, 1622448861, 28090940363, 526856206877, 10641335658891, 230283166014653, 5315654596751659, 130370766738143517, 3385534662263335179, 92801587315936355325, 2677687796232803000171, 81124824998464533181661
Offset: 0

Views

Author

Gus Wiseman, Feb 19 2020

Keywords

Comments

A sequence of integers is unimodal if it is the concatenation of a weakly increasing and a weakly decreasing sequence.

Examples

			The a(3) = 3 sequences are (2,1,2), (2,1,3), (3,1,2).
The a(4) = 41 sequences:
  (1212)  (2113)  (2134)  (2413)  (3142)  (3412)
  (1213)  (2121)  (2143)  (3112)  (3212)  (4123)
  (1312)  (2122)  (2212)  (3121)  (3213)  (4132)
  (1323)  (2123)  (2213)  (3122)  (3214)  (4213)
  (1324)  (2131)  (2312)  (3123)  (3231)  (4231)
  (1423)  (2132)  (2313)  (3124)  (3241)  (4312)
  (2112)  (2133)  (2314)  (3132)  (3312)
		

Crossrefs

Not requiring non-unimodality gives A000670.
The complement is counted by A007052.
The case where the negation is not unimodal either is A332873.
Unimodal compositions are A001523.
Non-unimodal permutations are A059204.
Non-unimodal compositions are A115981.
Unimodal compositions covering an initial interval are A227038.
Numbers whose unsorted prime signature is not unimodal are A332282.
Covering partitions with unimodal run-lengths are A332577.
Non-unimodal compositions covering an initial interval are A332743.

Programs

  • Mathematica
    allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
    unimodQ[q_]:=Or[Length[q]<=1,If[q[[1]]<=q[[2]],unimodQ[Rest[q]],OrderedQ[Reverse[q]]]];
    Table[Length[Select[Union@@Permutations/@allnorm[n],!unimodQ[#]&]],{n,0,5}]
  • PARI
    seq(n)=Vec( serlaplace(1/(2-exp(x + O(x*x^n)))) - (1 - 3*x + x^2)/(1 - 4*x + 2*x^2), -(n+1)) \\ Andrew Howroyd, Jan 28 2024

Formula

a(n) = A000670(n) - A007052(n-1) for n > 0. - Andrew Howroyd, Jan 28 2024

Extensions

a(9) from Robert Price, Jun 19 2021
a(10) onwards from Andrew Howroyd, Jan 28 2024

A329312 Length of the co-Lyndon factorization of the binary expansion of n.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 3, 1, 2, 2, 3, 1, 2, 1, 4, 1, 2, 2, 3, 1, 3, 2, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 2, 3, 2, 3, 2, 4, 1, 2, 3, 4, 2, 3, 2, 5, 1, 2, 1, 3, 1, 2, 2, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 2, 3, 2, 3, 2, 4, 1, 3, 3, 4, 2, 3, 2, 5, 1, 2, 2, 3, 1, 4, 3
Offset: 1

Views

Author

Gus Wiseman, Nov 10 2019

Keywords

Comments

The co-Lyndon product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling the sequences together. For example, the co-Lyndon product of (231) and (213) is (212313), the product of (221) and (213) is (212213), and the product of (122) and (2121) is (1212122). A co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product. Equivalently, a co-Lyndon word is a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into co-Lyndon words, and if these factors are arranged in a certain order, their concatenation is equal to their co-Lyndon product. For example, (1001) has sorted co-Lyndon factorization (1)(100).
Also the length of the Lyndon factorization of the inverted binary expansion of n, where the inverted digits are 1 minus the binary digits.

Examples

			The binary indices of 1..20 together with their co-Lyndon factorizations are:
   1:     (1) = (1)
   2:    (10) = (10)
   3:    (11) = (1)(1)
   4:   (100) = (100)
   5:   (101) = (10)(1)
   6:   (110) = (110)
   7:   (111) = (1)(1)(1)
   8:  (1000) = (1000)
   9:  (1001) = (100)(1)
  10:  (1010) = (10)(10)
  11:  (1011) = (10)(1)(1)
  12:  (1100) = (1100)
  13:  (1101) = (110)(1)
  14:  (1110) = (1110)
  15:  (1111) = (1)(1)(1)(1)
  16: (10000) = (10000)
  17: (10001) = (1000)(1)
  18: (10010) = (100)(10)
  19: (10011) = (100)(1)(1)
  20: (10100) = (10100)
		

Crossrefs

The non-"co" version is A211100.
Positions of 1's are A275692.
The reversed version is A329326.

Programs

  • Mathematica
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    colynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[colynfac[Drop[q,i]],Take[q,i]]]@Last[Select[Range[Length[q]],colynQ[Take[q,#]]&]]];
    Table[Length[colynfac[IntegerDigits[n,2]]],{n,100}]

A334028 Number of distinct parts in the n-th composition in standard order.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 1, 3, 3, 2, 2, 3, 1, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 2
Offset: 0

Views

Author

Gus Wiseman, Apr 18 2020

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (row k of 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.

Examples

			The 77th composition is (3,1,2,1), so a(77) = 3.
		

Crossrefs

Number of distinct prime indices is A001221.
Positions of first appearances (offset 1) are A246534.
Positions of 1's are A272919.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Runs are counted by A124767.
- Rotational symmetries are counted by A138904.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Aperiodic compositions are A328594.
- Rotational period is A333632.
- Dealings are A333939.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[Length[Union[stc[n]]],{n,0,100}]
Showing 1-10 of 83 results. Next