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 51-60 of 91 results. Next

A089177 Triangle read by rows: T(n,k) (n >= 0, 0 <= k <= 1+log_2(floor(n))) giving number of non-squashing partitions of n into k parts.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 2, 1, 4, 4, 1, 1, 5, 6, 2, 1, 6, 9, 4, 1, 7, 12, 6, 1, 8, 16, 10, 1, 1, 9, 20, 14, 2, 1, 10, 25, 20, 4, 1, 11, 30, 26, 6, 1, 12, 36, 35, 10, 1, 13, 42, 44, 14, 1, 14, 49, 56, 20, 1, 15, 56, 68, 26, 1, 16, 64, 84, 36, 1, 1, 17, 72, 100, 46, 2, 1, 18, 81, 120, 60, 4, 1
Offset: 0

Views

Author

N. J. A. Sloane, Dec 08 2003

Keywords

Comments

T(n,k) = A181322(n,k) - A181322(n,k-1) for n>0. - Alois P. Heinz, Jan 25 2014

Examples

			Triangle begins:
  1;
  1, 1;
  1, 2,  1;
  1, 3,  2;
  1, 4,  4,  1;
  1, 5,  6,  2;
  1, 6,  9,  4;
  1, 7, 12,  6;
  1, 8, 16, 10,  1;
		

Crossrefs

Cf. A078121, A089178. Columns give A002620, A008804, A088932, A088954. Row sums give A000123.

Programs

  • Maple
    T:= proc(n) option remember;
         `if`(n=0, 1, zip((x, y)-> x+y, [T(n-1)], [0, T(floor(n/2))], 0)[])
        end:
    seq(T(n), n=0..25);  # Alois P. Heinz, Apr 01 2012
  • Mathematica
    row[0] = {1}; row[1] = {1, 1}; row[n_] := row[n] = Plus @@ PadRight[ {row[n-1], Join[{0}, row[Floor[n/2]]]} ]; Table[row[n], {n, 0, 25}] // Flatten (* Jean-François Alcover, Jan 31 2014 *)

Formula

Row 0 = {1}, row 1 = {1 1}; for n >=2, row n = row n-1 + (row floor(n/2) shifted one place right).
G.f. for column k (k >= 2): x^(2^(k-2))/((1-x)*Product_{j=0..k-2} (1-x^(2^j))). [corrected by Jason Yuen, Jan 12 2025]
Conjecture: let R(n,x) be the n-th reversed row polynomial, then R(n,x) = Sum_{k=0..A000523(A053645(n)) + 1} T(A053645(n),k)*R(2^(A000523(n)-k),x) for n > 0, n != 2^m with R(0,x) = 1 where R(2^m,x) is the (m+1)-th row polynomial of A078121. - Mikhail Kurkov, Jun 28 2025

Extensions

More terms from Alford Arnold, May 22 2004

A218601 After the first zero, integers from 0 to A213709(n)-1 followed by integers from 0 to A213709(n+1)-1, etc.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0
Offset: 0

Views

Author

Antti Karttunen, Nov 10 2012

Keywords

Crossrefs

Needed for A218602. Cf. also A218599, A053645, A082853, A002262.

Programs

Formula

a(0)=0, and for n>0, a(n) = (n-A218600(A213711(n)-1))-1.

A227451 Number whose binary expansion encodes via runlengths the partition that is at the top of the main trunk of Bulgarian solitaire game tree drawn for the deck with n(n+1)/2 cards.

Original entry on oeis.org

0, 1, 5, 18, 77, 306, 1229, 4914, 19661, 78642, 314573, 1258290, 5033165, 20132658, 80530637, 322122546, 1288490189, 5153960754, 20615843021, 82463372082, 329853488333, 1319413953330, 5277655813325, 21110623253298, 84442493013197, 337769972052786, 1351079888211149
Offset: 0

Views

Author

Antti Karttunen, Jul 12 2013

Keywords

Comments

The terms have particular patterns in their binary expansion, which encodes for an "almost triangular partition" when runlength encoding of unordered partitions are used (please see A129594 for how that encoding works). These are obtained from the perfectly triangular partitions shown in A037481 by inserting 1 to the front of the partition and decrementing the last summand (the largest) by one:
n a(n) same in binary run lengths unordered partition
0 0 0 [] {}
1 1 1 [1] {1}
2 5 101 [1,1,1] {1+1+1}
3 18 10010 [1,2,1,1] {1+1+2+2}
4 77 1001101 [1,2,2,1,1] {1+1+2+3+3}
5 306 100110010 [1,2,2,2,1,1] {1+1+2+3+4+4}
6 1229 10011001101 [1,2,2,2,2,1,1] {1+1+2+3+4+5+5}
7 4914 1001100110010 [1,2,2,2,2,2,1,1] {1+1+2+3+4+5+6+6}
8 19661 100110011001101 [1,2,2,2,2,2,2,1,1] {1+1+2+3+4+5+6+7+7}
9 78642 10011001100110010 [1,2,2,2,2,2,2,2,1,1] {1+1+2+3+4+5+6+7+8+8}
These partitions occur at the tops of the main trunks of the game trees constructed for decks consisting of 1+2+3+...+k cards. See A037481 for the encoding of the roots of the main trunks of the same trees.

References

  • Martin Gardner, Colossal Book of Mathematics, Chapter 34, Bulgarian Solitaire and Other Seemingly Endless Tasks, pp. 455-467, W. W. Norton & Company, 2001.

Crossrefs

The left edge of the table A227452.

Programs

  • Mathematica
    LinearRecurrence[{4,1,-4},{0,1,5,18,77},40] (* Harvey P. Dale, Sep 22 2016 *)
  • PARI
    a(n)=if(n<1,0,if(n==1,1,(3*4^n+7*(-1)^n-5)/10)) \\ Ralf Stephan

Formula

a(0)=0, a(1)=1, for n>=2, a(n) = A053645(2*A037481(n)) + (1 - (n mod 2)). [Follows from the "insert 1 and decrement the largest part by one" operation on triangular partitions]
Alternatively:
a(0)=0, a(1)=1, and for n>=2, if n is even, then a(n) = 1 + (4*A182512((n-2)/2)) + 2^(2*(n-1)), and if n is odd, then a(n) = 2 + (16*A182512((n-3)/2)) + 2^(2*(n-1)).
From Ralf Stephan, Jul 20 2013: (Start)
a(n) = (1/10) * (3*4^n + 7*(-1)^n - 5).
a(n) = 4*a(n-1) + a(n-2) - 4*a(n-3), n>3.
G.f.: (4*x^4 - 3*x^3 + x^2 + x)/((1-x)*(1+x)*(1-4*x)). (End)

A061338 Increase in maximal number of comparisons for sorting n elements by list merging.

Original entry on oeis.org

0, 1, 2, 2, 4, 2, 3, 3, 8, 2, 3, 3, 5, 3, 4, 4, 16, 2, 3, 3, 5, 3, 4, 4, 9, 3, 4, 4, 6, 4, 5, 5, 32, 2, 3, 3, 5, 3, 4, 4, 9, 3, 4, 4, 6, 4, 5, 5, 17, 3, 4, 4, 6, 4, 5, 5, 10, 4, 5, 5, 7, 5, 6, 6, 64, 2, 3, 3, 5, 3, 4, 4, 9, 3, 4, 4, 6, 4, 5, 5, 17, 3, 4, 4, 6, 4, 5, 5, 10, 4, 5, 5, 7, 5, 6, 6, 33, 3, 4, 4
Offset: 0

Views

Author

Henry Bottomley, Apr 27 2001

Keywords

Comments

Or, first differences of A003071. - Zak Seidov, Dec 28 2011

Crossrefs

Cf. A003071.

Programs

  • Haskell
    a061338 0 = 0
    a061338 n = a006519 n + a000120 n - 1  -- Reinhard Zumkeller, Dec 29 2011
  • Mathematica
    nn=100; s={1}; m = Ceiling[Log[2, nn]]; Do[s=Join[s, {2^n}, s+1], {n,m}]; Prepend[Take[s,nn], 0] (* Zak Seidov, Dec 28 2011 *)

Formula

For n > 0: a(n) = A003071(n) - A003071(n - 1) = A006519(n) + A000120(n) - 1. If n is a power of 2 then a(n) = n, otherwise a(n) = a(A053645(n)) + 1 where A053645(n) = n - 2^floor(log_2(n)) is the amount by which n exceeds a power of 2.
G.f.: x/(1-x)^2 + (1/(1-x))*Sum_{k>=1} (-1 + (1-x)*2^(k-1))*x^2^k/(1-x^2^k). - Ralf Stephan, Apr 17 2003

A116549 a(0) = 1. a(m + 2^n) = a(n) + a(m), for 0 <= m <= 2^n - 1.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 6, 7, 5, 6, 7, 8, 8, 9, 10, 11, 5, 6, 7, 8, 8, 9, 10, 11, 9, 10, 11, 12, 12, 13, 14, 15, 6, 7, 8, 9, 9, 10, 11, 12, 10, 11, 12, 13, 13, 14, 15, 16, 10, 11, 12, 13, 13, 14, 15, 16, 14, 15, 16, 17, 17, 18, 19, 20
Offset: 0

Views

Author

Leroy Quet, Mar 16 2006

Keywords

Comments

Consider the following bijection between the natural numbers and hereditarily finite sets. For each n, write out n in binary. Assign to each set already given a natural number m the (m+1)-th digit of the binary number (reading from right to left). Let the set assigned to n contain all and only those sets which have a 1 for their digit. Then a(n) gives the number of pairs of braces appearing in the n-th set written out in full, e.g., for 3, we have {{{}}{}}, with 4 pairs of braces. - Thomas Anton, Mar 16 2019

Examples

			From _Gus Wiseman_, Jul 22 2019: (Start)
A finitary (or hereditarily finite) set is equivalent to a rooted identity tree. The following list shows the first few rooted identity trees together with their corresponding index in the sequence (o = leaf).
   0: o
   1: (o)
   2: ((o))
   3: (o(o))
   4: (((o)))
   5: (o((o)))
   6: ((o)((o)))
   7: (o(o)((o)))
   8: ((o(o)))
   9: (o(o(o)))
  10: ((o)(o(o)))
  11: (o(o)(o(o)))
  12: (((o))(o(o)))
  13: (o((o))(o(o)))
  14: ((o)((o))(o(o)))
  15: (o(o)((o))(o(o)))
  16: ((((o))))
  17: (o(((o))))
  18: ((o)(((o))))
  10: (o(o)(((o))))
(End)
		

Crossrefs

Programs

  • Haskell
    import Data.Function (on); import Data.List (genericIndex)
    a116549 = genericIndex a116549_list
    a116549_list = 1 : zipWith ((+) `on` a116549) a000523_list a053645_list
    -- Reinhard Zumkeller, Aug 27 2014
  • Mathematica
    Nest[Append[#1, #1[[#3 + 1]] + #1[[#2 - 2^#3 + 1]] & @@ {#1, #2, Floor@ Log2@ #2}] & @@ {#, Length@ #} &, {1}, 63] (* Michael De Vlieger, Apr 21 2019 *)
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    dab[n_]:=1+Total[dab/@(bpe[n]-1)];
    Array[dab,30,0] (* Gus Wiseman, Jul 22 2019 *)

Formula

For n > 0: a(n) = a(A000523(n)) + a(A053645(n)). - Reinhard Zumkeller, Aug 27 2014

A122198 Permutation of natural numbers: a recursed variant of A122155.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 25 2006

Keywords

Comments

Maps between A096115 and A096111.

Crossrefs

Inverse: A122199.

Programs

Formula

a(0)=0, otherwise a(n) = A122155(A053644(n)+a(A053645(n))).

A122199 Permutation of natural numbers: a recursed variant of A122155.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 25 2006

Keywords

Comments

Maps between A096111 and A096115.

Crossrefs

Programs

Formula

a(0)=0, otherwise a(n) = A053644(A122155(n)) + a(A053645(A122155(n))).

A136300 Numerator of ratio (the denominator being (n-1)!^2 = A001044(n-1)) giving the probability that the last of n persons drawing names randomly from a set of names draws their own, given that each person previously has drawn in succession and did not keep their own name. (Probability of derangements when allocated / rejected sequentially.)

Original entry on oeis.org

1, 0, 1, 5, 76, 1624, 52116, 2298708, 133929216, 9961180416, 921248743680, 103715841415680, 13967643016085760, 2217449301162071040, 409861043056032503040, 87262626872384643052800, 21202798521768886355558400, 5831660090586059239329792000, 1802587564536011525042697830400
Offset: 1

Views

Author

Brian Parsonnet, Mar 22 2008

Keywords

Comments

In "Secret Santa", if a person picks their own name, they pick another name and they throw their own name back in. If the last person draws their own name, there's a problem. What is that probability as a function of the number of people participating?

Examples

			If there is one person, the chance of the last person getting their own name is 100%, or 1 over 0!^2. For 2 people, it is 0 / 1!^2. For 3 people, it is 1 / 2!^2, creating a more interesting case. The possible drawings are {2,1,3}, {2,3,1} and {3,1,2}. All other drawings can't happen because the name is rejected and redrawn. But these 3 outcomes don't have equal probability, rather, they are 25%, 25% and 50% respectively. The first outcome is the only one in which the last person draws their own name. The first person has a 50% chance of drawing a 2 or 3. If 2, the second person has a 50% chance of drawing 1 or 3, for a total outcome probability of 1/4. Similarly with 4 people, the chance is 5/36, followed by 76/576 for 5 people, etc. For the case of 5 people, the above equations boil down to this end calculation: {1,5,2,1} * {12,8,9,6} summed, or 12 + 40 + 18 + 6 = 76.
		

Crossrefs

The sequence frequency table (sFreq) is A136301.

Programs

  • Mathematica
    maxP = 22;
    rows = Range[1, 2^(nP = maxP - 3)];
    pasc = Table[
       Binomial[p + 1, i] - If[i >= p, 1, 0], {p, nP}, {i, 0, p}];
    sFreq = Table[0, {maxP - 1}, {2^nP}]; sFreq[[2 ;; maxP - 1, 1]] = 1;
    For[p = 1, p <= nP, p++,
      For[s = 1, s <= p, s++, rS = Range[2^(s - 1) + 1, 2^s];
            sFreq[[p + 2, rS]] = pasc[[p + 1 - s, 1 ;; p + 2 - s]] .
                sFreq[[s ;; p + 1, 1 ;; 2^(s - 1)]]]];
    sProb = Table[p + 2 - BitGet[rows - 1, p - 1], {p, nP}];
    sProb = Table[Product[sProb[[i]], {i, p}], {p, nP}]*
       Table[If[r <= 2^p, 1, 0],
             {p, nP}, {r, rows}];
    rslt = Flatten[
      Prepend[Table[sProb[[p]] . sFreq[[p + 2]], {p, nP}], {1, 0, 1}]]
    prob = N[rslt/Array[(#1 - 1)!^2 & , maxP]] (* Brian Parsonnet, Feb 22 2011 *)

Formula

Sum of H(i, N-2) * X(i, N-2) for i=0..2^(N-3), N is the number of people and H(r,c) = sum of H(T(r),L(r)+j) * M(c-T(r)-1,j) for j = 0..c-L(r)-1 and X(r,c) = product of (3 + k - b(r,k)) for k = 0..(c-2) and M(y,z) = binomial distribution (y,z) when y - 1 > z and (y,z)-1 when (y-1)<=z and b(r,k) = bit k of r in base 2 and T(r) = A053645 and L(r) = A000523.
a(n) = (n-1)!*A102262(n)/A102263(n) for n > 1.

Extensions

Corrected and extended to a(19) by Brian Parsonnet, Feb 22 2011

A136301 Frequency of occurrence for each possible "probability of derangement" for a Secret Santa drawing in which each person draws a name in sequence and the only person who does not draw someone else's name is the one who draws the final name.

Original entry on oeis.org

1, 1, 1, 1, 5, 2, 1, 1, 13, 6, 13, 2, 6, 2, 1, 1, 29, 14, 73, 6, 42, 18, 29, 2, 18, 8, 14, 2, 6, 2, 1, 1, 61, 30, 301, 14, 186, 86, 301, 6, 102, 48, 186, 18, 102, 42, 61, 2, 42, 20, 86, 8, 48, 20, 30, 2, 18, 8, 14, 2, 6, 2, 1, 1, 125, 62, 1081, 30, 690, 330, 2069, 14, 414, 200, 1394
Offset: 3

Views

Author

Brian Parsonnet, Mar 22 2008

Keywords

Comments

The sequence is best represented as a series of columns 1..n, where each column j has 2^(j-1) rows (see Example). For more details, see A136300.
The first column represents the case for 3 people (offset 3).

Examples

			Represented as a series of columns, where column j has 2^(j-1) rows, the sequence begins:
  row |j = 1   2   3   4   5 ...
  ----+-------------------------
    1 |    1   1   1   1   1 ...
    2 |        1   5  13  29 ...
    3 |        2   6  14  30 ...
    4 |        1  13  73 301 ...
    5 |            2   6  14 ...
    6 |            6  42 186 ...
    7 |            2  18  86 ...
    8 |            1  29 301 ...
    9 |                2   6 ...
   10 |               18 102 ...
   11 |                8  48 ...
   12 |               14 186 ...
   13 |                2  18 ...
   14 |                6 102 ...
   15 |                2  42 ...
   16 |                1  61 ...
   17 |                    2 ...
  ... |                  ... ...
.
If there are 5 people, numbered 1-5 according to the order in which they draw a name, and person #5 draws name #5, the first four people must draw 1-4 as a proper derangement, and there are 9 ways of doing so: 21435 / 23415 / 24135 / 31425 / 34125 / 34215 / 41235 / 43125 / 43215.
But the probability of each derangement depends on how many choices exist at each successive draw. The first person can draw from 4 possibilities (2,3,4,5). The second person nominally has 3 to choose from, unless the first person drew number 2, in which case person 2 may draw 4 possibilities (1,3,4,5), and so on. The probabilities of 21435 and 24135 are both then
        1/4 * 1/4 * 1/2 * 1/2 = 1/64.
More generally, if there are n people, at the i-th turn (i = 1..n), person i has either (n-i) or (n-i+1) choices, depending on whether the name of the person who is drawing has been chosen yet. A way to represent the two cases above is 01010, where a 0 indicates that the person's number is not yet drawn, and a 1 indicates it is.
For the n-th person to be forced to choose his or her own name, the last digit of this pattern must be 0, by definition. Similarly, the 1st digit must be a 0, and the second to last digit must be a 1. So all the problem patterns start with 0 and end with 10. For 5 people, that leaves 4 target patterns which cover all 9 derangements. By enumeration, that distribution can be shown to be (for the 3rd column = 5 person case):
        0-00-10 1 occurrences
        0-01-10 5 occurrences
        0-10-10 2 occurrences
        0-11-11 1 occurrences
1;
1, 1;
1, 5, 2, 1;
1, 13, 6, 13, 2, 6, 2, 1;
1, 29, 14, 73, 6, 42, 18, 29, 2, 18, 8, 14, 2, 6, 2, 1;
		

Crossrefs

The application of this table towards final determination of the probabilities of derangements leads to sequence A136300, which is the sequence of numerators. The denominators are in A001044.
A048144 represents the peak value of all odd-numbers columns.
A000255 equals the sum of the bottom half of each column.
A000166 equals the sum of each column.
A047920 represents the frequency of replacements by person drawing at position n.
A008277, Triangle of Stirling numbers of 2nd kind, can be derived from A136301 through a series of transformations (see "Probability of Derangements.pdf").
Cf. A371761.

Programs

  • Mathematica
    maxP = 15;
    rows = Range[1, 2^(nP = maxP - 3)];
    pasc = Table[
       Binomial[p + 1, i] - If[i >= p, 1, 0], {p, nP}, {i, 0, p}];
    sFreq = Table[0, {maxP - 1}, {2^nP}]; sFreq[[2 ;; maxP - 1, 1]] = 1;
    For[p = 1, p <= nP, p++,
      For[s = 1, s <= p, s++, rS = Range[2^(s - 1) + 1, 2^s];
            sFreq[[p + 2, rS]] = pasc[[p + 1 - s, 1 ;; p + 2 - s]] .
                sFreq[[s ;; p + 1, 1 ;; 2^(s - 1)]]]];
    TableForm[ Transpose[ sFreq ] ]
    (* Code snippet to illustrate the conjectured connection with A371761: *)
    R[n_] := Table[Transpose[sFreq][[2^n]][[r]], {r, n + 1, maxP - 1}]
    For[n = 0, n <= 6, n++, Print[n + 1, ": ", R[n]]] (* Peter Luschny, Apr 10 2024 *)

Formula

H(r,c) = Sum_{j=0..c-L(r)-1} H(T(r), L(r)+j) * M(c-T(r)-1, j) where M(y,z) = binomial distribution (y,z) when y - 1 > z and (y,z)-1 when y-1 <= z and T(r) = A053645 and L(r) = A000523.
Conjecture: Assume the table represented as in the Example section. Then row 2^n is row n + 1 of A371761. - Peter Luschny, Apr 10 2024

Extensions

Edited by Brian Parsonnet, Mar 01 2011

A258004 Capless binary boundary codes for holeless strictly non-overlapping polyhexes, only the maximal representative from each equivalence class obtained by rotating.

Original entry on oeis.org

0, 63, 990, 3822, 15222, 15738, 15804, 60858, 62394, 62940, 224694, 241110, 241338, 243162, 243420, 244188, 249306, 249318, 249564, 249660, 251370, 251628, 251634, 252396, 252660, 252792, 964314, 964326, 965340, 972522, 972636, 973548, 976620, 990678, 995034, 995046, 997098, 997212, 998124, 998130, 1003242, 1005420
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 0 is a special case, indicating an empty path, which thus ends at the same vertex as where it started from.

Examples

			63 ("111111" in binary) is present as it encodes a single hex. This is because when we walk in honeycomb-lattice from vertex to vertex, at each vertex turning to the same direction, we will return to the starting vertex after enclosing a hex with six such steps.
		

Crossrefs

Subsequence of A255561 and A258014.

Programs

Formula

a(n) = A053645(A258003(n)).
Previous Showing 51-60 of 91 results. Next