A325589
Number of compositions of n whose circular differences are all 1 or -1.
Original entry on oeis.org
0, 0, 2, 0, 2, 2, 2, 4, 4, 2, 8, 6, 8, 10, 12, 16, 18, 20, 28, 34, 42, 48, 62, 78, 92, 112, 146, 174, 216, 264, 326, 412, 500, 614, 770, 944, 1166, 1444, 1784, 2214, 2730, 3366, 4182, 5164, 6386, 7898, 9770, 12098, 14950, 18488, 22894, 28312, 35020, 43330, 53606
Offset: 1
The a(3) = 2 through a(11) = 8 compositions (empty columns not shown):
(12) (23) (1212) (34) (1232) (45) (2323) (56)
(21) (32) (2121) (43) (2123) (54) (3232) (65)
(2321) (121212) (121232)
(3212) (212121) (123212)
(212123)
(212321)
(232121)
(321212)
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],SameQ[1,##]&@@Abs[Differences[Append[#,First[#]]]]&]],{n,15}]
-
step(R,n,s)={matrix(n, n, i, j, if(i>j, if(j>s, R[i-j, j-s]) + if(j+s<=n, R[i-j, j+s])) )}
a(n)={sum(k=1, n, my(R=matrix(n,n,i,j,i==j&&abs(i-k)==1), t=0); while(R, R=step(R,n,1); t+=R[n,k]); t)} \\ Andrew Howroyd, Aug 23 2019
A325590
Number of necklace compositions of n with circular differences all equal to 1 or -1.
Original entry on oeis.org
0, 0, 1, 0, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 3, 3, 4, 4, 5, 7, 6, 7, 10, 10, 11, 15, 16, 18, 23, 25, 32, 38, 43, 53, 64, 73, 89, 108, 131, 153, 188, 223, 272, 329, 395, 475, 583, 697, 848, 1027, 1247, 1506, 1837, 2223, 2708, 3282, 3993, 4848, 5913, 7175, 8745, 10640
Offset: 1
The first 16 terms count the following compositions:
3: (12)
5: (23)
6: (1212)
7: (34)
8: (1232)
9: (45)
9: (121212)
10: (2323)
11: (56)
11: (121232)
12: (2343)
12: (12121212)
13: (67)
13: (123232)
14: (3434)
14: (12121232)
15: (78)
15: (123432)
15: (232323)
15: (1212121212)
16: (3454)
16: (12321232)
16: (12123232)
The a(21) = 7 necklace compositions:
(10,11)
(2,3,4,5,4,3)
(3,4,3,4,3,4)
(1,2,1,2,1,2,3,4,3,2)
(1,2,3,2,1,2,3,2,3,2)
(1,2,1,2,3,2,3,2,3,2)
(1,2,1,2,1,2,1,2,1,2,1,2,1,2)
-
neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],neckQ[#]&&(SameQ[1,##]&@@Abs[Differences[Append[#,First[#]]]])&]],{n,15}]
-
step(R,n,s)={matrix(n,n,i,j, if(i>j, if(j>s, R[i-j, j-s]) + if(j+s<=n, R[i-j, j+s])) )}
a(n)={sum(k=1, n, my(R=matrix(n,n,i,j,i==j&&abs(i-k)==1), t=0, m=1); while(R, R=step(R,n,1); m++; t+=sumdiv(n, d, R[d,k]*d*eulerphi(n/d))/m ); t/n)} \\ Andrew Howroyd, Aug 23 2019
A325551
Number of compositions of n with distinct circular differences.
Original entry on oeis.org
1, 1, 3, 6, 11, 8, 26, 50, 79, 121, 195, 265, 478, 742, 1269, 1914, 2929, 4462, 6825, 10309, 16324, 24633, 37213, 56828, 84482
Offset: 1
The a(1) = 1 through a(7) = 26 compositions:
(1) (2) (3) (4) (5) (6) (7)
(12) (13) (14) (15) (16)
(21) (31) (23) (24) (25)
(112) (32) (42) (34)
(121) (41) (51) (43)
(211) (113) (114) (52)
(122) (141) (61)
(131) (411) (115)
(212) (124)
(221) (133)
(311) (142)
(151)
(214)
(223)
(232)
(241)
(313)
(322)
(331)
(412)
(421)
(511)
(1213)
(1312)
(2131)
(3121)
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],UnsameQ@@Differences[Append[#,First[#]]]&]],{n,15}]
A309931
Triangle read by rows: T(n,k) is the number of compositions of n with k parts and circular differences all equal to 1, 0, or -1.
Original entry on oeis.org
1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 2, 3, 4, 1, 1, 1, 1, 6, 5, 1, 1, 2, 3, 4, 10, 6, 1, 1, 1, 3, 5, 10, 15, 7, 1, 1, 2, 1, 4, 10, 20, 21, 8, 1, 1, 1, 3, 6, 11, 21, 35, 28, 9, 1, 1, 2, 3, 4, 10, 24, 42, 56, 36, 10, 1, 1, 1, 1, 5, 10, 25, 49, 78, 84, 45, 11, 1
Offset: 1
Triangle begins:
1;
1, 1;
1, 2, 1;
1, 1, 3, 1;
1, 2, 3, 4, 1;
1, 1, 1, 6, 5, 1;
1, 2, 3, 4, 10, 6, 1;
1, 1, 3, 5, 10, 15, 7, 1;
1, 2, 1, 4, 10, 20, 21, 8, 1;
1, 1, 3, 6, 11, 21, 35, 28, 9, 1;
1, 2, 3, 4, 10, 24, 42, 56, 36, 10, 1;
1, 1, 1, 5, 10, 25, 49, 78, 84, 45, 11, 1;
1, 2, 3, 4, 10, 24, 56, 96, 135, 120, 55, 12, 1;
1, 1, 3, 6, 10, 21, 57, 116, 180, 220, 165, 66, 13, 1;
...
For n = 6 there are a total of 15 compositions:
k = 1: (6)
k = 2: (33)
k = 3: (222)
k = 4: (1122), (1212), (1221), (2112), (2121), (2211)
k = 5: (11112), (11121), (11211), (12111), (21111)
k = 6: (111111)
-
step(R,n)={matrix(n, n, i, j, if(i>j, if(j>1, R[i-j, j-1]) + R[i-j, j] + if(j+1<=n, R[i-j, j+1])) )}
T(n)={my(v=vector(n)); for(k=1, n, my(R=matrix(n, n, i, j, i==j&&abs(i-k)<=1), m=0); while(R, m++; v[m]+=R[n, k]; R=step(R, n))); v}
for(n=1, 12, print(T(n)));
Showing 1-4 of 4 results.
Comments