A216669
Total number of parts in all partitions of n into 2 sizes of parts (A002133).
Original entry on oeis.org
2, 5, 14, 20, 39, 52, 74, 102, 134, 158, 208, 259, 284, 361, 409, 488, 538, 634, 678, 838, 857, 1006, 1038, 1270, 1264, 1495, 1500, 1776, 1761, 2084, 2062, 2443, 2300, 2795, 2680, 3194, 3076, 3544, 3403, 4080, 3804, 4518, 4282, 5037, 4673, 5626, 5127, 6088
Offset: 3
-
nn=40;ss=Sum[Sum[y^2 x^(i+j)/(1-y x^i)/(1-y x^j),{j,1,i-1}], {i,1,nn}]; CoefficientList[Series[D[ss,y]/.y->1,{x,0,nn}],x]
Original entry on oeis.org
1, 2, 5, 6, 11, 13, 17, 22, 27, 29, 37, 44, 44, 55, 59, 68, 71, 81, 82, 102, 97, 112, 109
Offset: 3
A238279
Triangle read by rows: T(n,k) is the number of compositions of n into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=A004523(n-1).
Original entry on oeis.org
1, 1, 2, 2, 2, 3, 4, 1, 2, 10, 4, 4, 12, 14, 2, 2, 22, 29, 10, 1, 4, 26, 56, 36, 6, 3, 34, 100, 86, 31, 2, 4, 44, 148, 200, 99, 16, 1, 2, 54, 230, 374, 278, 78, 8, 6, 58, 322, 680, 654, 274, 52, 2, 2, 74, 446, 1122, 1390, 814, 225, 22, 1, 4, 88, 573, 1796, 2714, 2058, 813, 136, 10, 4, 88, 778, 2694, 4927
Offset: 0
Triangle starts:
00: 1;
01: 1;
02: 2;
03: 2, 2;
04: 3, 4, 1;
05: 2, 10, 4;
06: 4, 12, 14, 2;
07: 2, 22, 29, 10, 1;
08: 4, 26, 56, 36, 6;
09: 3, 34, 100, 86, 31, 2;
10: 4, 44, 148, 200, 99, 16, 1;
11: 2, 54, 230, 374, 278, 78, 8;
12: 6, 58, 322, 680, 654, 274, 52, 2;
13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1;
14: 4, 88, 573, 1796, 2714, 2058, 813, 136, 10;
15: 4, 88, 778, 2694, 4927, 4752, 2444, 618, 77, 2;
16: 5, 110, 953, 3954, 8531, 9930, 6563, 2278, 415, 28, 1;
...
Row n=5 is 2, 10, 4 because in the 16 compositions of 5
##: [composition] no. of changes
01: [ 1 1 1 1 1 ] 0
02: [ 1 1 1 2 ] 1
03: [ 1 1 2 1 ] 2
04: [ 1 1 3 ] 1
05: [ 1 2 1 1 ] 2
06: [ 1 2 2 ] 1
07: [ 1 3 1 ] 2
08: [ 1 4 ] 1
09: [ 2 1 1 1 ] 1
10: [ 2 1 2 ] 2
11: [ 2 2 1 ] 1
12: [ 2 3 ] 1
13: [ 3 1 1 ] 1
14: [ 3 2 ] 1
15: [ 4 1 ] 1
16: [ 5 ] 0
there are 2 with no changes, 10 with one change, and 4 with two changes.
Columns k=0-10 give:
A000005 (for n>0), 2*
A002133,
A244714,
A244715,
A244716,
A244717,
A244718,
A244719,
A244720,
A244721,
A244722.
The version counting adjacent equal parts is
A106356.
The version for ascents/descents is
A238343.
The version for weak ascents/descents is
A333213.
The k-th composition in standard-order has
A124762(k) adjacent equal parts,
A124767(k) maximal runs,
A333382(k) adjacent unequal parts, and
A333381(k) maximal anti-runs.
-
b:= proc(n, v) option remember; `if`(n=0, 1, expand(
add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=1..n)))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
seq(T(n), n=0..14);
-
b[n_, v_] := b[n, v] = If[n == 0, 1, Expand[Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Feb 11 2015, after Maple *)
Table[If[n==0,1,Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#]]==k+1&]]],{n,0,12},{k,0,If[n==0,0,Floor[2*(n-1)/3]]}] (* Gus Wiseman, Apr 10 2020 *)
-
T_xy(max_row) = {my(N=max_row+1, x='x+O('x^N),h=(1+ sum(i=1,N,(x^i-y*x^i)/(1+y*x^i-x^i)))/(1-sum(i=1,N, y*x^i/(1+y*x^i-x^i)))); for(n=0,N-1, print(Vecrev(polcoeff(h,n))))}
T_xy(16) \\ John Tyler Rascoe, Jul 10 2024
A116608
Triangle read by rows: T(n,k) is number of partitions of n having k distinct parts (n>=1, k>=1).
Original entry on oeis.org
1, 2, 2, 1, 3, 2, 2, 5, 4, 6, 1, 2, 11, 2, 4, 13, 5, 3, 17, 10, 4, 22, 15, 1, 2, 27, 25, 2, 6, 29, 37, 5, 2, 37, 52, 10, 4, 44, 67, 20, 4, 44, 97, 30, 1, 5, 55, 117, 52, 2, 2, 59, 154, 77, 5, 6, 68, 184, 117, 10, 2, 71, 235, 162, 20, 6, 81, 277, 227, 36, 4, 82, 338, 309, 58, 1
Offset: 1
T(6,2) = 6 because we have [5,1], [4,2], [4,1,1], [3,1,1,1], [2,2,1,1] and [2,1,1,1,1,1] ([6], [3,3], [3,2,1], [2,2,2] and [1,1,1,1,1,1] do not qualify).
Triangle starts:
1;
2;
2, 1;
3, 2;
2, 5;
4, 6, 1;
2, 11, 2;
4, 13, 5;
3, 17, 10;
4, 22, 15, 1;
...
-
g:=product(1+t*x^j/(1-x^j),j=1..30)-1: gser:=simplify(series(g,x=0,27)): for n from 1 to 23 do P[n]:=sort(coeff(gser,x^n)) od: for n from 1 to 23 do seq(coeff(P[n],t^j),j=1..floor(sqrt(1+8*n)/2-1/2)) od; # yields sequence in triangular form
# second Maple program:
b:= proc(n, i) option remember; local j; if n=0 then 1
elif i<1 then 0 else []; for j from 0 to n/i do zip((x, y)
->x+y, %, [`if`(j>0, 0, [][]), b(n-i*j, i-1)], 0) od; %[] fi
end:
T:= n-> subsop(1=NULL, [b(n, n)])[]:
seq(T(n), n=1..30); # Alois P. Heinz, Nov 07 2012
# third program
nDiffParts := proc(L)
nops(convert(L,set)) ;
end proc:
A116608 := proc(n,k)
local a,L;
a :=0 ;
for L in combinat[partition](n) do
if nDiffParts(L) = k then
a := a+1 ;
end if;
end do:
a ;
end proc: # R. J. Mathar, Jun 07 2024
-
p=Product[1+(y x^i)/(1-x^i),{i,1,20}];f[list_]:=Select[list,#>0&];Flatten[Map[f,Drop[CoefficientList[Series[p,{x,0,20}],{x,y}],1]]] (* Geoffrey Critzer, Nov 28 2011 *)
Table[Length /@ Split[Sort[Length /@ Union /@ IntegerPartitions@n]], {n, 22}] // Flatten (* Robert Price, Jun 13 2020 *)
-
from math import isqrt
from itertools import count, islice
from sympy.utilities.iterables import partitions
def A116608_gen(): # generator of terms
return (sum(1 for p in partitions(n) if len(p)==k) for n in count(1) for k in range(1,(isqrt((n<<3)+1)-1>>1)+1))
A116608_list = list(islice(A116608_gen(),30)) # Chai Wah Wu, Sep 14 2023
-
from functools import cache
@cache
def P(n: int, k: int, r: int) -> int:
if n == 0: return 1 if k == 0 else 0
if k == 0: return 0
if r == 0: return 0
return sum(P(n - r * j, k - 1, r - 1)
for j in range(1, n // r + 1)) + P(n, k, r - 1)
def A116608triangle(rows: int) -> list[int]:
return list(filter(None, [P(n, k, n) for n in range(1, rows)
for k in range(1, n + 1)]))
print(A116608triangle(22)) # Peter Luschny, Sep 14 2023, courtesy of Amir Livne Bar-on
A238130
Triangle read by rows: T(n,k) is the number of compositions into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=n.
Original entry on oeis.org
1, 1, 0, 2, 0, 0, 2, 2, 0, 0, 3, 4, 1, 0, 0, 2, 10, 4, 0, 0, 0, 4, 12, 14, 2, 0, 0, 0, 2, 22, 29, 10, 1, 0, 0, 0, 4, 26, 56, 36, 6, 0, 0, 0, 0, 3, 34, 100, 86, 31, 2, 0, 0, 0, 0, 4, 44, 148, 200, 99, 16, 1, 0, 0, 0, 0, 2, 54, 230, 374, 278, 78, 8, 0, 0, 0, 0, 0, 6, 58, 322, 680, 654, 274, 52, 2, 0, 0, 0, 0, 0
Offset: 0
Triangle starts:
00: 1,
01: 1, 0,
02: 2, 0, 0,
03: 2, 2, 0, 0,
04: 3, 4, 1, 0, 0,
05: 2, 10, 4, 0, 0, 0,
06: 4, 12, 14, 2, 0, 0, 0,
07: 2, 22, 29, 10, 1, 0, 0, 0,
08: 4, 26, 56, 36, 6, 0, 0, 0, 0,
09: 3, 34, 100, 86, 31, 2, 0, 0, 0, 0,
10: 4, 44, 148, 200, 99, 16, 1, 0, 0, 0, 0,
11: 2, 54, 230, 374, 278, 78, 8, 0, 0, 0, 0, 0,
12: 6, 58, 322, 680, 654, 274, 52, 2, 0, 0, 0, 0, 0,
13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1, 0, 0, 0, 0, 0,
...
Row 5 is [2, 10, 4, 0, 0, 0] because in the 16 compositions of 5
##: [composition] no. of changes
01: [ 1 1 1 1 1 ] 0
02: [ 1 1 1 2 ] 1
03: [ 1 1 2 1 ] 2
04: [ 1 1 3 ] 1
05: [ 1 2 1 1 ] 2
06: [ 1 2 2 ] 1
07: [ 1 3 1 ] 2
08: [ 1 4 ] 1
09: [ 2 1 1 1 ] 1
10: [ 2 1 2 ] 2
11: [ 2 2 1 ] 1
12: [ 2 3 ] 1
13: [ 3 1 1 ] 1
14: [ 3 2 ] 1
15: [ 4 1 ] 1
16: [ 5 ] 0
there are 2 with no changes, 10 with one change, and 4 with two changes.
Cf.
A238279 (same sequence with zeros omitted).
Cf.
A106356 (compositions with k successive parts same).
Cf.
A225084 (compositions with maximal up-step k).
-
b:= proc(n, v) option remember; `if`(n=0, 1, expand(
add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=1..n)))
end:
T:= n-> seq(coeff(b(n, 0), x, i), i=0..n):
seq(T(n), n=0..14);
-
b[n_, v_] := b[n, v] = If[n == 0, 1, Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]; T[n_] := Table[Coefficient[b[n, 0], x, i], {i, 0, n}]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Jan 12 2015, translated from Maple *)
A060177
Triangle of generalized sum of divisors function, read by rows.
Original entry on oeis.org
1, 2, 1, 2, 2, 3, 5, 2, 1, 6, 4, 2, 11, 2, 5, 13, 4, 10, 17, 3, 1, 15, 22, 4, 2, 25, 27, 2, 5, 37, 29, 6, 10, 52, 37, 2, 20, 67, 44, 4, 1, 30, 97, 44, 4, 2, 52, 117, 55, 5, 5, 77, 154, 59, 2, 10, 117, 184, 68, 6, 20, 162, 235, 71, 2, 36, 227, 277, 81, 6, 1, 58, 309, 338
Offset: 1
Triangle turned on its side begins:
1 2 2 3 2 4 2 4 3 4 2 6 ...
1 2 5 6 11 13 17 22 27 29 ...
1 2 5 10 15 25 37 ...
1 2 5 ...
-
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
expand(b(n, i-1) +x*add(b(n-i*j, i-1), j=1..n/i))))
end:
T:= n->(p->seq(coeff(p, x, degree(p)-k), k=0..degree(p)-1))(b(n$2)):
seq(T(n), n=1..25); # Alois P. Heinz, Jan 29 2014
-
Reverse /@ Table[Length /@ Split[ Sort[Map[Length, Split /@ IntegerPartitions[n], {1}]]], {n, 24}] (* Wouter Meeussen, Apr 21 2012, updated by Jean-François Alcover, Jan 29 2014 *)
-
from math import isqrt
from itertools import count, islice
from sympy.utilities.iterables import partitions
def A060177_gen(): # generator of terms
return (sum(1 for p in partitions(n) if len(p)==k) for n in count(1) for k in range(isqrt((n<<3)+1)-1>>1,0,-1))
A060177_list = list(islice(A060177_gen(),30)) # Chai Wah Wu, Sep 15 2023
A100073
Number of representations of n as the difference of two positive squares.
Original entry on oeis.org
0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 1, 1, 0, 1, 1, 2, 0, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 1, 1, 3, 0, 1, 3, 1, 0, 2, 1, 1, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 2, 2, 0, 1, 1, 2, 0, 1, 3, 1, 0, 3, 1, 2, 0, 1, 3, 2, 0, 1, 2, 2, 0, 2, 2, 1, 0, 2, 1, 2, 0, 2, 4, 1, 0, 3, 1, 1, 0, 1, 2, 4
Offset: 1
a(15) = 2 because 15 = 16 - 1 = 64 - 49.
Cf.
A056924 (number of divisors of n that are less than sqrt(n)),
A016825 (numbers not the difference of two squares),
A034178 (number of representations of n as the difference of two squares).
-
A100073:= proc(n)
if n::odd then floor(numtheory:-tau(n)/2)
elif (n/2)::odd then 0
else floor(numtheory:-tau(n/4)/2)
fi
end proc:
map(A100073, [$1..200]); # Robert Israel, Jul 10 2018
-
nn=150; a=Table[0, {nn}]; Do[y=x-1; While[d=x^2-y^2; d<=nn&&y>0, a[[d]]++; y-- ], {x, 1+nn/2}]; a
-
a(n) = if (n % 2, ceil((numdiv(n)-1)/2), if (!(n%4), ceil((numdiv(n/4)-1)/2), 0)); \\ Michel Marcus, Mar 07 2016
-
A100073(n)=if(bittest(n,0),numdiv(n)\2,!bittest(n,1),numdiv(n\4)\2) \\ or shorter: a(n)=if(n%4!=2,numdiv(n\4^!(n%2))\2) \\ - M. F. Hasler, Jul 10 2018
A309058
Partitions of n with parts having at most 3 distinct magnitudes.
Original entry on oeis.org
1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 41, 54, 72, 91, 115, 145, 177, 215, 258, 308, 364, 424, 491, 568, 651, 742, 838, 940, 1065, 1181, 1320, 1454, 1619, 1757, 1957, 2124, 2329, 2510, 2763, 2934, 3244, 3432, 3752, 3964, 4329, 4531, 4965, 5179, 5627, 5872, 6391, 6577, 7178, 7405
Offset: 0
a(10) = 41 because all of the 42 integer partitions of 10 count (i.e., 10 = 10, 10 = 9+1 = 8+1+1, etc.), except the partition 10 = 4+3+2+1.
-
b:= proc(n, i, t) option remember; `if`(n=0, 1, `if`(i<1, 0,
`if`(t=1, `if`(irem(n, i)=0, 1, 0)+b(n, i-1, t),
add(b(n-i*j, i-1, t-`if`(j=0, 0, 1)), j=0..n/i))))
end:
a:= n-> b(n$2, 3):
seq(a(n), n=0..100); # Alois P. Heinz, Jul 11 2019
-
b[n_, i_, t_] := b[n, i, t] = If[n == 0, 1, If[i < 1, 0, If[t == 1, If[Mod[n, i] == 0, 1, 0] + b[n, i - 1, t], Sum[b[n - i*j, i - 1, t - If[j == 0, 0, 1]], {j, 0, n/i}]]]];
a[n_] := b[n, n, 3];
a /@ Range[0, 100] (* Jean-François Alcover, Feb 27 2020, after Alois P. Heinz *)
A059820
Expansion of series related to Liouville's Last Theorem: g.f. Sum_{t>0} (-1)^(t+1) *x^(t*(t+1)/2) / ( (1-x^t)^3 *Product_{i=1..t} (1-x^i) ).
Original entry on oeis.org
0, 1, 4, 9, 19, 30, 52, 70, 107, 136, 191, 226, 314, 352, 463, 523, 664, 717, 919, 964, 1205, 1282, 1546, 1603, 1992, 2009, 2414, 2504, 2958, 2974, 3606, 3553, 4223, 4273, 4936, 4912, 5885, 5685, 6634, 6654, 7664, 7454, 8822, 8454, 9845
Offset: 0
-
Mk := proc(k) -1*add( (-1)^n*q^(n*(n+1)/2)/(1-q^n)^k/mul(1-q^i,i=1..n), n=1..101): end; # with k=3
-
D(x, y, n) = sum(k=1, n-1, sigma(k, x)*sigma(n-k, y));
D000(n) = sum(k=1, n-1, sigma(k, 0)*D(0, 0, n-k));
a(n) = if(n==0, 0, (3*D(0, 0, n)+3*D(0, 1, n)+D000(n)+2*sigma(n, 0)+3*sigma(n)+sigma(n, 2))/6); \\ Seiichi Manyama, Jul 26 2024
A365676
Triangle read by rows: T(n, k) is the number of partitions of n having exactly k distinct part sizes, for 0 <= k <= n.
Original entry on oeis.org
1, 0, 1, 0, 2, 0, 0, 2, 1, 0, 0, 3, 2, 0, 0, 0, 2, 5, 0, 0, 0, 0, 4, 6, 1, 0, 0, 0, 0, 2, 11, 2, 0, 0, 0, 0, 0, 4, 13, 5, 0, 0, 0, 0, 0, 0, 3, 17, 10, 0, 0, 0, 0, 0, 0, 0, 4, 22, 15, 1, 0, 0, 0, 0, 0, 0, 0, 2, 27, 25, 2, 0, 0, 0, 0, 0, 0, 0, 0, 6, 29, 37, 5, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0
Triangle T(n, k) starts:
[0] 1;
[1] 0, 1;
[2] 0, 2, 0;
[3] 0, 2, 1, 0;
[4] 0, 3, 2, 0, 0;
[5] 0, 2, 5, 0, 0, 0;
[6] 0, 4, 6, 1, 0, 0, 0;
[7] 0, 2, 11, 2, 0, 0, 0, 0;
[8] 0, 4, 13, 5, 0, 0, 0, 0, 0;
[9] 0, 3, 17, 10, 0, 0, 0, 0, 0, 0;
Cf.
A000041 (row sums),
A000005 (T(n,1)),
A002133 (T(n,2)),
A002134 (T(n,3)),
A365630 (T(n,4)),
A365631 (T(n,5)).
-
P := proc(n, k, r) option remember; local j; # after Amir Livne Bar-on
if n = 0 then return ifelse(k = 0, 1, 0) fi;
if k = 0 or r = 0 then return 0 fi;
add(P(n - r * j, k - 1, r - 1), j = 1..iquo(n, r)) + P(n, k, r - 1) end:
A365676row := n -> local k; seq(P(n, k, n), k = 0..n):
seq(print(A365676row(n)), n = 0..9);
# Using the generating function:
p := product(1 + t*x^j/(1 - x^j), j = 1..20):
ser := series(p, x, 20):
seq(seq(coeff(coeff(ser, x, n), t, k), k = 0..n), n = 0..9);
-
P[n_, k_, r_] := P[n, k, r] = Which[n == 0, If[k == 0, 1, 0], k == 0 || r == 0, 0, True, Sum[P[n-r*j, k-1, r-1], {j, 1, Quotient[n, r]}]+P[n, k, r-1]]; A365676row[n_] := Table[P[n, k, n], {k, 0, n}]; Table[A365676row[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Oct 21 2023, from 1st Maple program *)
-
T(n,k) = my(nb=0); forpart(p=n, if (#Set(p) == k, nb++)); nb; \\ Michel Marcus, Sep 17 2023
-
# after Amir Livne Bar-on
from functools import cache
@cache
def P(n: int, k: int, r: int) -> int:
if n == 0: return 1 if k == 0 else 0
if k == 0 or r == 0: return 0
return sum(P(n - r * j, k - 1, r - 1)
for j in range(1, n // r + 1)) + P(n, k, r - 1)
def A365676Row(n) -> list[int]:
return [P(n, k, n) for k in range(n + 1)]
for n in range(10): print(A365676Row(n))
Showing 1-10 of 33 results.
Comments