A331623
Number of sequences with n copies each of 1,2,...,n avoiding absolute differences between adjacent elements larger than one.
Original entry on oeis.org
1, 1, 6, 92, 11482, 8956752, 54331653686, 2535604038015218, 951645881858020642746, 2911820015993491302722966990, 73784388170659542104264761249115686, 15642058800086197220958447712819197014917632, 27980772370697320617389378491983217784996780441605354
Offset: 0
a(0) = 1: the empty sequence.
a(1) = 1: 1.
a(2) = 6: 1122, 1212, 1221, 2112, 2121, 2211.
a(3) = 92: 111222333, 111223233, 111223323, 111223332, ..., 333221112, 333221121, 333221211, 333222111.
-
b:= proc(l, q) option remember; (n-> `if`(n<2, 1, add(
`if`(l[j]=1, `if`(j in [1, n], b(subsop(j=[][], l),
`if`(j=1, 0, n)), 0), b(subsop(j=l[j]-1, l), j)), j=
`if`(q<0, 1..n, max(1, q-1)..min(n, q+1)))))(nops(l))
end:
a:= n-> b([n$n], -1):
seq(a(n), n=0..6);
-
b[l_, q_] := b[l, q] = With[{n = Length[l]}, If[n < 2, 1, Sum[
If[l[[j]] == 1, If[j == 1 || j == n, b[ReplacePart[l, j -> Nothing],
If[j == 1, 0, n]], 0], b[ReplacePart[l, j -> l[[j]] - 1], j]], {j,
If[q < 0, Range[n], Range[Max[1, q - 1], Min[n, q + 1]]]}]]];
a[n_] := b[Table[n, {n}], -1];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 8}] (* Jean-François Alcover, Jan 04 2021, after Alois P. Heinz *)
A347810
Number of n-dimensional lattice walks from {n}^n to {0}^n using steps that decrease the Euclidean distance to the origin and that change each coordinate by at most 1.
Original entry on oeis.org
1, 1, 25, 2062017739, 255053951339165796439851848897794625
Offset: 0
-
s:= proc(n) option remember;
`if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1)))
end:
b:= proc(l) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`(
add(i^2, i=h) b([n$n]):
seq(a(n), n=0..5);
-
s[n_] := s[n] = If[n == 0, {{}}, Sequence @@ Table[Append[#, i], {i, -1, 1}]& /@ s[n-1]];
b[l_List] := b[l] = With[{n = Length[l]}, If[l == Table[0, {n}], 1, Sum[With[{h = l+x}, If[h.h < l.l, b[Sort[h]], 0]], {x, s[n]}]]];
a[n_] := b[Table[n, {n}]];
Table[a[n], {n, 0, 5}] (* Jean-François Alcover, Nov 04 2021, after Alois P. Heinz *)
A378588
Triangle read by rows: T(n,k) is the number of maximal chains in the poset of all k-ary words of length <= n, ordered by B covers A iff A_i <= B_{i+k} for all i in A and some k >= 0.
Original entry on oeis.org
1, 1, 2, 1, 5, 6, 1, 16, 22, 23, 1, 57, 94, 102, 103, 1, 226, 446, 507, 517, 518, 1, 961, 2308, 2764, 2855, 2867, 2868, 1, 4376, 12900, 16333, 17121, 17248, 17262, 17263, 1, 21041, 77092, 103666, 110487, 111739, 111908, 111924, 111925, 1, 106534, 489430, 701819, 761751, 773888, 775758, 775975, 775993, 775994, 1, 563961, 3282956, 5038344, 5578041, 5696293, 5716382, 5719046, 5719317, 5719337, 5719338
Offset: 1
Triangle begins:
k=1 2 3 4 5 6 7
n=1 1;
n=2 1, 2;
n=3 1, 5, 6;
n=4 1, 16, 22, 23;
n=5 1, 57, 94, 102, 103;
n=6 1, 226, 446, 507, 517, 518;
n=7 1, 961, 2308, 2764, 2855, 2867, 2868;
...
T(3,3) = 6:
() < (1) < (1,1) < (1,1,1),
() < (1) < (1,1) < (1,2),
() < (1) < (1,1) < (2,1),
() < (1) < (2) < (1,2),
() < (1) < (2) < (2,1),
() < (1) < (2) < (3).
-
def mchains(n,k):
B,d1,S1 = [1,1],{(1,): 1},{(1,)}
for i in range(n-1):
d2,S2 = dict(),set()
for j in S1:
for x in [j+(1,), (1,)+j]+[j[:z]+tuple([j[z]+1])+j[z+1:] for z in range(len(j)) if j[z] < k]:
if x not in S2: S2.add(x); d2[x] = d1[j]
elif x != tuple([1]*(i+2)): d2[x] += d1[j]
B.append(sum(d2.values())); d1 = d2; S1 = S2
return B[:n+1]
def A378588_list(max_n):
B = [mchains(max_n,i+1) for i in range(max_n)]
return [[B[k][j+1] for k in range(j+1)] for j in range(max_n)]
A378608
Number of maximal chains in the poset of all n-ary words of length <= n, ordered by B covers A iff A_i <= B_{i+k} for all i in A and some k >= 0.
Original entry on oeis.org
1, 1, 2, 6, 23, 103, 518, 2868, 17263, 111925, 775994, 5719338, 44592007, 366259499, 3157877470, 28492791496, 268307662047, 2630577754281, 26795670672626, 283038010150702, 3094882721541239, 34977231456293519, 407991690851302646, 4905431774834649852, 60721792897771836879
Offset: 0
a(3) = 6:
() < (1) < (1,1) < (1,1,1),
() < (1) < (1,1) < (1,2),
() < (1) < (1,1) < (2,1),
() < (1) < (2) < (1,2),
() < (1) < (2) < (2,1),
() < (1) < (2) < (3).
A062716
Number of arrangements of 1,2,..,n*n in an n X n matrix such that each row is increasing or decreasing.
Original entry on oeis.org
1, 2, 24, 13440, 1009008000, 19947543780003840, 170891375144777551827763200, 942542805268120269309770939139883008000, 4650425326497486529782791149613966242353671284224000000
Offset: 1
Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 14 2001
A377135
Number of maximal chains in the poset of n-ary words of length n ordered by B covers A iff A_i <= B_i for 1 <= i <= n.
Original entry on oeis.org
1, 1, 2, 90, 369600, 305540235000, 88832646059788350720, 14007180988362844601443040716800, 1707750599894443404262670865631874246246400000, 217425846656446788579638892849417587480505167467321080630000000
Offset: 0
For a(2) = (1,1) < (2,1) < (2,2), (1,1) < (1,2) < (2,2).
For n = 3 one chain is (1,1,1) < (1,2,1) < (1,2,2) < (1,2,3) < (1,3,3) < (2,3,3) < (3,3,3).
-
a:= n-> (t-> (n*t)!/t!^n)(max(n-1, 0)):
seq(a(n), n=0..10); # Alois P. Heinz, Nov 27 2024
-
a[n_]:=Product[Binomial[(n-1)*(n-i),n-1],{i,0,n-2}]; Array[a,10,0] (* Stefano Spezia, Nov 27 2024 *)
-
a(n) = {if(n<1,1,(n*(n-1))!/(n-1)!^n)}
A377601
Number of permutations of the multiset {1^n, 2^n,..., n^n} excluding permutations where all objects of all types are contiguous.
Original entry on oeis.org
0, 0, 4, 1674, 63062976, 623360743125000, 2670177736637149247308080, 7363615666157189603982585462030330960, 18165723931630806756964027928179555634194028453959680, 53130688706387569792052442448845648519471103327391407016237759999637120
Offset: 0
For n=2, the multiset is {1,1,2,2} and the a(2)=4 permutations counted are 1212, 1221, 2112, 2121 (but neither 1122 nor 2211).
Comments