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 14 results. Next

A237984 Number of partitions of n whose mean is a part.

Original entry on oeis.org

1, 2, 2, 3, 2, 5, 2, 6, 5, 8, 2, 21, 2, 14, 22, 30, 2, 61, 2, 86, 67, 45, 2, 283, 66, 80, 197, 340, 2, 766, 2, 663, 543, 234, 703, 2532, 2, 388, 1395, 4029, 2, 4688, 2, 4476, 7032, 1005, 2, 17883, 2434, 9713, 7684, 14472, 2, 25348, 17562, 37829, 16786, 3721
Offset: 1

Views

Author

Clark Kimberling, Feb 27 2014

Keywords

Comments

a(n) = 2 if and only if n is a prime.

Examples

			a(6) counts these partitions:  6, 33, 321, 222, 111111.
From _Gus Wiseman_, Sep 14 2019: (Start)
The a(1) = 1 through a(10) = 8 partitions (A = 10):
  1  2   3    4     5      6       7        8         9          A
     11  111  22    11111  33      1111111  44        333        55
              1111         222              2222      432        22222
                           321              3221      531        32221
                           111111           4211      111111111  33211
                                            11111111             42211
                                                                 52111
                                                                 1111111111
(End)
		

Crossrefs

Cf. A238478.
The Heinz numbers of these partitions are A327473.
A similar sequence for subsets is A065795.
Dominated by A067538.
The strict case is A240850.
Partitions without their mean are A327472.

Programs

  • Mathematica
    Table[Count[IntegerPartitions[n], p_ /; MemberQ[p, Mean[p]]], {n, 40}]
  • Python
    from sympy.utilities.iterables import partitions
    def A237984(n): return sum(1 for s,p in partitions(n,size=True) if not n%s and n//s in p) # Chai Wah Wu, Sep 21 2023

Formula

a(n) = A000041(n) - A327472(n). - Gus Wiseman, Sep 14 2019

A290689 Number of transitive rooted trees with n nodes.

Original entry on oeis.org

1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 88, 143, 229, 370, 592, 955, 1527, 2457, 3929, 6304, 10081
Offset: 1

Views

Author

Gus Wiseman, Oct 19 2017

Keywords

Comments

A rooted tree is transitive if every proper terminal subtree is also a branch of the root. First differs from A206139 at a(13) = 143.
Regarding the notation, a rooted tree is a finite multiset of rooted trees. For example, the rooted tree (o(o)(oo)) is short for {{},{{}},{{},{}}}. Each "o" is a leaf. Each pair of parentheses corresponds to a non-leaf node (such as the root). Its contents "(...)" represent a branch. - Gus Wiseman, Nov 16 2024

Examples

			The a(7) = 8 7-node transitive rooted trees are: (o(oooo)), (oo(ooo)), (o(o)((o))), (o(o)(oo)), (ooo(oo)), (oo(o)(o)), (oooo(o)), (oooooo).
		

Crossrefs

The restriction to identity trees (A004111) is A279861, ranks A290760.
These trees are ranked by A290822.
The anti-transitive version is A306844, ranks A324758.
The totally transitive case is A318185 (by leaves A318187), ranks A318186.
A version for integer partitions is A324753, for subsets A324736.
The ordered version is A358453, ranks A358457, undirected A358454.

Programs

  • Mathematica
    nn=18;
    rtall[n_]:=If[n===1,{{}},Module[{cas},Union[Sort/@Join@@(Tuples[rtall/@#]&/@IntegerPartitions[n-1])]]];
    Table[Length[Select[rtall[n],Complement[Union@@#,#]==={}&]],{n,nn}]

Extensions

a(20) from Robert Price, Sep 13 2018
a(21)-a(22) from Robert P. P. McKone, Dec 16 2023

A065795 Number of subsets of {1,2,...,n} that contain the average of their elements.

Original entry on oeis.org

1, 2, 4, 6, 10, 16, 26, 42, 72, 124, 218, 390, 706, 1292, 2388, 4436, 8292, 15578, 29376, 55592, 105532, 200858, 383220, 732756, 1403848, 2694404, 5179938, 9973430, 19229826, 37125562, 71762396, 138871260, 269021848, 521666984, 1012520400, 1966957692, 3824240848
Offset: 1

Views

Author

John W. Layman, Dec 05 2001

Keywords

Comments

Also the number of subsets of {1,2,...,n} with sum of entries divisible by the largest element (compare A000016). See the Palmer Melbane link for a bijection. - Joel B. Lewis, Nov 13 2014

Examples

			a(4)=6, since {1}, {2}, {3}, {4}, {1,2,3} and {2,3,4} contain their averages.
From _Gus Wiseman_, Sep 14 2019: (Start)
The a(1) = 1 through a(6) = 16 subsets:
  {1}  {1}  {1}      {1}      {1}          {1}
       {2}  {2}      {2}      {2}          {2}
            {3}      {3}      {3}          {3}
            {1,2,3}  {4}      {4}          {4}
                     {1,2,3}  {5}          {5}
                     {2,3,4}  {1,2,3}      {6}
                              {1,3,5}      {1,2,3}
                              {2,3,4}      {1,3,5}
                              {3,4,5}      {2,3,4}
                              {1,2,3,4,5}  {2,4,6}
                                           {3,4,5}
                                           {4,5,6}
                                           {1,2,3,6}
                                           {1,4,5,6}
                                           {1,2,3,4,5}
                                           {2,3,4,5,6}
(End)
		

Crossrefs

Subsets containing n whose mean is an element are A000016.
The version for integer partitions is A237984.
Subsets not containing their mean are A327471.

Programs

  • Mathematica
    Table[ Sum[a = Select[Divisors[i], OddQ[ # ] &]; Apply[ Plus, 2^(i/a) * EulerPhi[a]]/i, {i, n}]/2, {n, 34}]
    (* second program *)
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,Mean[#]]&]],{n,0,10}] (* Gus Wiseman, Sep 14 2019 *)
  • PARI
    a(n) = (1/2)*sum(i=1, n, (1/i)*sumdiv(i, d, if (d%2, 2^(i/d)*eulerphi(d)))); \\ Michel Marcus, Dec 20 2020
    
  • Python
    from sympy import totient, divisors
    def A065795(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))>>1 # Chai Wah Wu, Feb 22 2023

Formula

a(n) = (1/2)*Sum_{i=1..n} (f(i) - 1) where f(i) = (1/i) * Sum_{d | i and d is odd} 2^(i/d) * phi(d).
a(n) = (n + A051293(n))/2.
a(n) = 2^n - A327471(n). - Gus Wiseman, Sep 14 2019

Extensions

Edited and extended by Robert G. Wilson v, Nov 15 2002

A353390 Number of compositions of n whose own run-lengths are a subsequence (not necessarily consecutive).

Original entry on oeis.org

1, 1, 0, 0, 1, 2, 3, 2, 2, 8, 17, 26, 43, 77, 129, 210, 351, 569
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(0) = 1 through a(9) = 8 compositions (empty columns indicated by dots):
  ()  (1)  .  .  (22)  (122)  (1122)  (11221)  (21122)  (333)
                       (221)  (1221)  (12211)  (22112)  (22113)
                              (2211)                    (22122)
                                                        (31122)
                                                        (121122)
                                                        (122112)
                                                        (211221)
                                                        (221121)
For example, the composition y = (2,2,3,3,1) has run-lengths (2,2,1), which form a (non-consecutive) subsequence, so y is counted under a(11).
		

Crossrefs

The version for partitions is A325702.
The recursive version is A353391, ranked by A353431.
The consecutive case is A353392, ranked by A353432.
These compositions are ranked by A353402.
The reverse version is A353403.
The recursive consecutive version is A353430.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A047966 counts uniform partitions, compositions A329738.
A169942 counts Golomb rulers, ranked by A333222.
A325676 counts knapsack compositions, ranked by A333223, partitions A108917.
A325705 counts partitions containing all of their distinct multiplicities.
A329739 counts compositions with all distinct run-lengths, for runs A351013.
A353400 counts compositions with all run-lengths > 2.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], MemberQ[Subsets[#],Length/@Split[#]]&]],{n,0,15}]

A353391 Number of compositions of n that are empty, a singleton, or whose run-lengths are a subsequence that is already counted.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 3, 1, 1, 4, 5, 7, 9, 11, 15, 22, 38, 45, 87, 93
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(9) = 4 through a(14) = 15 compositions (A..E = 10..14):
  (9)       (A)       (B)       (C)       (D)       (E)
  (333)     (2233)    (141122)  (2244)    (161122)  (2255)
  (121122)  (3322)    (221123)  (4422)    (221125)  (5522)
  (221121)  (131122)  (221132)  (151122)  (221134)  (171122)
            (221131)  (221141)  (221124)  (221143)  (221126)
                      (231122)  (221142)  (221152)  (221135)
                      (321122)  (221151)  (221161)  (221153)
                                (241122)  (251122)  (221162)
                                (421122)  (341122)  (221171)
                                          (431122)  (261122)
                                          (521122)  (351122)
                                                    (531122)
                                                    (621122)
                                                    (122121122)
                                                    (221121221)
		

Crossrefs

The non-recursive version is A353390, ranked by A353402.
The non-recursive consecutive version is A353392, ranked by A353432.
The non-recursive reverse version is A353403.
The unordered version is A353426, ranked by A353393 (nonprime A353389).
The consecutive version is A353430.
These compositions are ranked by A353431.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A329738 counts uniform compositions, partitions A047966.
A114901 counts compositions with no runs of length 1.
A169942 counts Golomb rulers, ranked by A333222.
A325676 counts knapsack compositions, ranked by A333223.
A325705 counts partitions containing all of their distinct multiplicities.
A329739 counts compositions with all distinct run-length.

Programs

  • Mathematica
    yosQ[y_]:=Length[y]<=1||MemberQ[Subsets[y],Length/@Split[y]]&&yosQ[Length/@Split[y]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],yosQ]],{n,0,15}]

A353402 Numbers k such that the k-th composition in standard order has its own run-lengths as a subsequence (not necessarily consecutive).

Original entry on oeis.org

0, 1, 10, 21, 26, 43, 53, 58, 107, 117, 174, 186, 292, 314, 346, 348, 349, 373, 430, 442, 570, 585, 586, 629, 676, 693, 696, 697, 698, 699, 804, 826, 858, 860, 861, 885, 954, 1082, 1141, 1173, 1210, 1338, 1353, 1387, 1392, 1393, 1394, 1396, 1397, 1398, 1466
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Comments

First differs from A353432 (the consecutive case) in having 0 and 53.
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.

Examples

			The initial terms, their binary expansions, and the corresponding standard compositions:
    0:          0  ()
    1:          1  (1)
   10:       1010  (2,2)
   21:      10101  (2,2,1)
   26:      11010  (1,2,2)
   43:     101011  (2,2,1,1)
   53:     110101  (1,2,2,1)
   58:     111010  (1,1,2,2)
  107:    1101011  (1,2,2,1,1)
  117:    1110101  (1,1,2,2,1)
  174:   10101110  (2,2,1,1,2)
  186:   10111010  (2,1,1,2,2)
  292:  100100100  (3,3,3)
  314:  100111010  (3,1,1,2,2)
  346:  101011010  (2,2,1,2,2)
  348:  101011100  (2,2,1,1,3)
  349:  101011101  (2,2,1,1,2,1)
  373:  101110101  (2,1,1,2,2,1)
  430:  110101110  (1,2,2,1,1,2)
  442:  110111010  (1,2,1,1,2,2)
		

Crossrefs

The version for partitions is A325755, counted by A325702.
These compositions are counted by A353390.
The recursive version is A353431, counted by A353391.
The consecutive case is A353432, counted by A353392.
A005811 counts runs in binary expansion.
A011782 counts compositions.
A066099 lists compositions in standard order, reverse A228351.
A333769 lists run-lengths of compositions in standard order.
Words with all distinct run-lengths: A032020, A044813, A098859, A130091, A329739, A351017.
Statistics of standard compositions:
- Length is A000120, sum A070939.
- Runs are counted by A124767, distinct A351014.
- Subsequences are counted by A334299, consecutive A124770/A124771.
- Runs-resistance is A333628.
Classes of standard compositions:
- Partitions are A114994, strict A333255, rev A225620, strict rev A333256.
- Runs are A272919.
- Golomb rulers are A333222, counted by A169942.
- Knapsack compositions are A333223, counted by A325676.
- Anti-runs are A333489, counted by A003242.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    rosQ[y_]:=Length[y]==0||MemberQ[Subsets[y],Length/@Split[y]];
    Select[Range[0,100],rosQ[stc[#]]&]

A353392 Number of compositions of n whose own run-lengths are a consecutive subsequence.

Original entry on oeis.org

1, 1, 0, 0, 1, 2, 2, 2, 2, 8, 12, 16, 20, 35, 46, 59, 81, 109, 144, 202, 282
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(0) = 0 through a(10) = 12 compositions (empty columns indicated by dots, 0 is the empty composition):
  0  1  .  .  22  122  1122  11221  21122  333     1333
                  221  2211  12211  22112  22113   2233
                                           22122   3322
                                           31122   3331
                                           121122  22114
                                           122112  41122
                                           211221  122113
                                           221121  131122
                                                   221131
                                                   311221
                                                   1211221
                                                   1221121
		

Crossrefs

The non-consecutive version for partitions is A325702.
The non-consecutive version is A353390, ranked by A353402.
The non-consecutive recursive version is A353391, ranked by A353431.
The non-consecutive reverse version is A353403.
The recursive version is A353430.
These compositions are ranked by A353432.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A169942 counts Golomb rulers, ranked by A333222.
A325676 counts knapsack compositions, ranked by A333223.
A329738 counts uniform compositions, partitions A047966.
A329739 counts compositions with all distinct run-lengths.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],#=={}||MemberQ[Join@@Table[Take[#,{i,j}],{i,Length[#]},{j,i,Length[#]}],Length/@Split[#]]&]],{n,0,15}]

A353403 Number of compositions of n whose own reversed run-lengths are a subsequence (not necessarily consecutive).

Original entry on oeis.org

1, 1, 0, 0, 3, 2, 5, 12, 16, 30, 45, 94, 159, 285, 477, 864, 1487, 2643
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(0) = 1 through a(7) = 12 compositions:
  ()  (1)  .  .  (22)   (1121)  (1113)  (1123)
                 (112)  (1211)  (1122)  (1132)
                 (211)          (1221)  (2311)
                                (2211)  (3211)
                                (3111)  (11131)
                                        (11212)
                                        (11221)
                                        (12112)
                                        (12211)
                                        (13111)
                                        (21121)
                                        (21211)
		

Crossrefs

The non-reversed version is A353390, ranked by A353402, partitions A325702.
The non-reversed recursive version is A353391, ranked by A353431.
The non-reversed consecutive case is A353392, ranked by A353432.
The non-reversed recursive consecutive version is A353430.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A169942 counts Golomb rulers, ranked by A333222.
A325676 counts knapsack compositions, ranked by A333223, partitions A108917.
A325705 counts partitions containing all of their distinct multiplicities.
A329739 counts compositions with all distinct run-lengths, for runs A351013.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@ IntegerPartitions[n],MemberQ[Subsets[#],Reverse[Length/@Split[#]]]&]],{n,0,15}]

A353431 Numbers k such that the k-th composition in standard order is empty, a singleton, or has its own run-lengths as a subsequence (not necessarily consecutive) that is already counted.

Original entry on oeis.org

0, 1, 2, 4, 8, 10, 16, 32, 43, 58, 64, 128, 256, 292, 349, 442, 512, 586, 676, 697, 826, 1024, 1210, 1338, 1393, 1394, 1396, 1594, 2048, 2186, 2234, 2618, 2696, 2785, 2786, 2792, 3130, 4096, 4282, 4410, 4666, 5178, 5569, 5570, 5572, 5576, 5584, 6202, 8192
Offset: 1

Views

Author

Gus Wiseman, May 16 2022

Keywords

Comments

First differs from A353696 (the consecutive version) in having 22318, corresponding to the binary word 101011100101110 and standard composition (2,2,1,1,3,2,1,1,2), whose run-lengths (2,2,1,1,2,1) are subsequence but not a consecutive subsequence.
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.

Examples

			The initial terms, their binary expansions, and the corresponding standard compositions:
     0:           0  ()
     1:           1  (1)
     2:          10  (2)
     4:         100  (3)
     8:        1000  (4)
    10:        1010  (2,2)
    16:       10000  (5)
    32:      100000  (6)
    43:      101011  (2,2,1,1)
    58:      111010  (1,1,2,2)
    64:     1000000  (7)
   128:    10000000  (8)
   256:   100000000  (9)
   292:   100100100  (3,3,3)
   349:   101011101  (2,2,1,1,2,1)
   442:   110111010  (1,2,1,1,2,2)
   512:  1000000000  (10)
   586:  1001001010  (3,3,2,2)
   676:  1010100100  (2,2,3,3)
   697:  1010111001  (2,2,1,1,3,1)
		

Crossrefs

The non-recursive version for partitions is A325755, counted by A325702.
These compositions are counted by A353391.
The version for partitions A353393, counted by A353426, w/o primes A353389.
The non-recursive version is A353402, counted by A353390.
The non-recursive consecutive case is A353432, counted by A353392.
The consecutive case is A353696, counted by A353430.
A005811 counts runs in binary expansion.
A011782 counts compositions.
A066099 lists compositions in standard order, rev A228351, run-lens A333769.
A329738 counts uniform compositions, partitions A047966.
Statistics of standard compositions:
- Length is A000120, sum A070939.
- Runs are counted by A124767, distinct A351014.
- Subsequences are counted by A334299, contiguous A124770/A124771.
- Runs-resistance is A333628.
Classes of standard compositions:
- Partitions are A114994, multisets A225620, strict A333255, sets A333256.
- Constant compositions are A272919, counted by A000005.
- Golomb rulers are A333222, counted by A169942.
- Knapsack compositions are A333223, counted by A325676.
- Anti-runs are A333489, counted by A003242.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    rorQ[y_]:=Length[y]<=1||MemberQ[Subsets[y],Length/@Split[y]]&& rorQ[Length/@Split[y]];
    Select[Range[0,100],rorQ[stc[#]]&]

A353432 Numbers k such that the k-th composition in standard order has its own run-lengths as a consecutive subsequence.

Original entry on oeis.org

0, 1, 10, 21, 26, 43, 58, 107, 117, 174, 186, 292, 314, 346, 348, 349, 373, 430, 442, 570, 585, 586, 629, 676, 696, 697, 804, 826, 860, 861, 885, 1082, 1141, 1173, 1210, 1338, 1387, 1392, 1393, 1394, 1396, 1594, 1653, 1700, 1720, 1721, 1882, 2106, 2165, 2186
Offset: 1

Views

Author

Gus Wiseman, May 16 2022

Keywords

Comments

First differs from A353402 (the non-consecutive version) in lacking 53.
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.

Examples

			The initial terms, their binary expansions, and the corresponding standard compositions:
     0:          0  ()
     1:          1  (1)
    10:       1010  (2,2)
    21:      10101  (2,2,1)
    26:      11010  (1,2,2)
    43:     101011  (2,2,1,1)
    58:     111010  (1,1,2,2)
   107:    1101011  (1,2,2,1,1)
   117:    1110101  (1,1,2,2,1)
   174:   10101110  (2,2,1,1,2)
   186:   10111010  (2,1,1,2,2)
   292:  100100100  (3,3,3)
   314:  100111010  (3,1,1,2,2)
   346:  101011010  (2,2,1,2,2)
   348:  101011100  (2,2,1,1,3)
   349:  101011101  (2,2,1,1,2,1)
   373:  101110101  (2,1,1,2,2,1)
   430:  110101110  (1,2,2,1,1,2)
   442:  110111010  (1,2,1,1,2,2)
		

Crossrefs

These compositions are counted by A353392.
This is the consecutive case of A353402, counted by A353390.
The non-consecutive recursive version is A353431, counted by A353391.
The recursive version is A353696, counted by A353430.
A005811 counts runs in binary expansion.
A011782 counts compositions.
A066099 lists compositions in standard order, rev A228351, run-lens A333769.
A329738 counts uniform compositions, partitions A047966.
Statistics of standard compositions:
- Length is A000120, sum A070939.
- Runs are counted by A124767, distinct A351014.
- Subsequences are counted by A334299, contiguous A124770/A124771.
- Runs-resistance is A333628.
Classes of standard compositions:
- Partitions are A114994, strict A333255, rev A225620, strict rev A333256.
- Runs are A272919, counted by A000005.
- Golomb rulers are A333222, counted by A169942.
- Anti-runs are A333489, counted by A003242.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    rorQ[y_]:=Length[y]==0||MemberQ[Join@@Table[Take[y,{i,j}],{i,Length[y]},{j,i,Length[y]}],Length/@Split[y]];
    Select[Range[0,10000],rorQ[stc[#]]&]
Showing 1-10 of 14 results. Next