A193374
E.g.f.: A(x) = exp( Sum_{n>=1} x^(n*(n+1)/2) / (n*(n+1)/2) ).
Original entry on oeis.org
1, 1, 1, 3, 9, 21, 201, 1191, 4593, 36009, 620721, 5297931, 40360761, 474989373, 4345942329, 122776895151, 2118941145441, 21344580276561, 303071564084193, 4476037678611219, 59935820004483561, 3838519441659950181, 78361805638079449641, 949279542954821272503
Offset: 0
E.g.f.: A(x) = 1 + x + x^2/2! + 3*x^3/3! + 9*x^4/4! + 21*x^5/5! + 201*x^6/6! +...
where
log(A(x)) = x + x^3/3 + x^6/6 + x^10/10 + x^15/15 + x^21/21 +...
-
a:= proc(n) option remember; `if`(n=0, 1, add(`if`(issqr(8*j+1),
a(n-j)*(j-1)!*binomial(n-1, j-1), 0), j=1..n))
end:
seq(a(n), n=0..25); # Alois P. Heinz, May 12 2016
-
a[n_] := a[n] = If[n == 0, 1, Sum[If[IntegerQ @ Sqrt[8*j + 1], a[n - j]*(j - 1)!*Binomial[n - 1, j - 1], 0], {j, 1, n}]];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Jun 05 2018, after Alois P. Heinz *)
-
{a(n)=n!*polcoeff(exp(sum(m=1,sqrtint(2*n+1),x^(m*(m+1)/2)/(m*(m+1)/2)+x*O(x^n))),n)}
A317128
Number of permutations of [n] whose lengths of increasing runs are Fibonacci numbers.
Original entry on oeis.org
1, 1, 2, 6, 23, 112, 652, 4425, 34358, 299971, 2910304, 31059715, 361603228, 4560742758, 61947243329, 901511878198, 13994262184718, 230811430415207, 4030772161073249, 74301962970014978, 1441745847111969415, 29374226224980834077, 626971133730275593916
Offset: 0
-
g:= n-> (t-> `if`(issqr(t+4) or issqr(t-4), 1, 0))(5*n^2):
b:= proc(u, o, t) option remember; `if`(u+o=0, g(t),
`if`(g(t)=1, add(b(u-j, o+j-1, 1), j=1..u), 0)+
add(b(u+j-1, o-j, t+1), j=1..o))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..27);
-
g[n_] := With[{t = 5n^2}, If[IntegerQ@Sqrt[t+4] || IntegerQ@Sqrt[t-4], 1, 0]];
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, g[t],
If[g[t] == 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}], 0] +
Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 27] (* Jean-François Alcover, Mar 29 2021, after Alois P. Heinz *)
A317129
Number of permutations of [n] whose lengths of increasing runs are squares.
Original entry on oeis.org
1, 1, 1, 1, 2, 9, 40, 151, 571, 2897, 19730, 140190, 953064, 6708323, 54631552, 510143776, 4987278692, 49168919669, 505209884549, 5638095015594, 67921924172174, 852861260421398, 10992380368532792, 147296144926635359, 2082906807168675698, 30973237281668975230
Offset: 0
a(3) = 1: 321.
a(4) = 2: 1234, 4321.
a(5) = 9: 12354, 12453, 13452, 21345, 23451, 31245, 41235, 51234, 54321.
-
g:= n-> `if`(issqr(n), 1, 0):
b:= proc(u, o, t) option remember; `if`(u+o=0, g(t),
`if`(g(t)=1, add(b(u-j, o+j-1, 1), j=1..u), 0)+
add(b(u+j-1, o-j, t+1), j=1..o))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..27);
-
g[n_] := If[IntegerQ@Sqrt[n], 1, 0];
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, g[t],
If[g[t] == 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}], 0] +
Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 27] (* Jean-François Alcover, Mar 29 2021, after Alois P. Heinz *)
A317131
Number of permutations of [n] whose lengths of increasing runs are prime numbers.
Original entry on oeis.org
1, 0, 1, 1, 5, 19, 80, 520, 2898, 22486, 171460, 1509534, 14446457, 147241144, 1650934446, 19494460567, 248182635904, 3340565727176, 47659710452780, 718389090777485, 11381176852445592, 189580213656445309, 3305258537062221020, 60273557241570401742
Offset: 0
a(2) = 1: 12.
a(3) = 1: 123.
a(4) = 5: 1324, 1423, 2314, 2413, 3412.
a(5) = 19: 12345, 12435, 12534, 13245, 13425, 13524, 14235, 14523, 15234, 23145, 23415, 23514, 24135, 24513, 25134, 34125, 34512, 35124, 45123.
-
g:= n-> `if`(n=0 or isprime(n), 1, 0):
b:= proc(u, o, t) option remember; `if`(u+o=0, g(t),
`if`(g(t)=1, add(b(u-j, o+j-1, 1), j=1..u), 0)+
add(b(u+j-1, o-j, t+1), j=1..o))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..27);
-
g[n_] := If[n == 0 || PrimeQ[n], 1, 0];
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, g[t],
If[g[t] == 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}], 0] +
Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 27] (* Jean-François Alcover, Mar 29 2021, after Alois P. Heinz *)
-
from functools import lru_cache
from sympy import isprime
def g(n): return int(n == 0 or isprime(n))
@lru_cache(maxsize=None)
def b(u, o, t):
if u + o == 0: return g(t)
return (sum(b(u-j, o+j-1, 1) for j in range(1, u+1)) if g(t) else 0) +\
sum(b(u+j-1, o-j, t+1) for j in range(1, o+1))
def a(n): return b(n, 0, 0)
print([a(n) for n in range(28)]) # Michael S. Branicky, Mar 29 2021 after Alois P. Heinz
A317132
Number of permutations of [n] whose lengths of increasing runs are factorials.
Original entry on oeis.org
1, 1, 2, 5, 17, 70, 350, 2029, 13495, 100813, 837647, 7652306, 76282541, 823684964, 9578815164, 119346454671, 1586149739684, 22397700381817, 334879465463998, 5285103821004717, 87800206978975107, 1531533620821692217, 27987305231654121046, 534688325008397289484
Offset: 0
-
g:= proc(n) local i; 1; for i from 2 do
if n=% then 1; break elif n<% then 0; break fi;
%*i od; g(n):=%
end:
b:= proc(u, o, t) option remember; `if`(u+o=0, g(t),
`if`(g(t)=1, add(b(u-j, o+j-1, 1), j=1..u), 0)+
add(b(u+j-1, o-j, t+1), j=1..o))
end:
a:= n-> `if`(n=0, 1, add(b(j-1, n-j, 1), j=1..n)):
seq(a(n), n=0..27);
-
g[n_] := g[n] = Module[{i, k = 1}, For[i = 2, True, i++,
If[n == k, k = 1; Break[]]; If[n < k, k = 0; Break[]];
k = k*i]; k];
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, g[t],
If[g[t] == 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}], 0] +
Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];
a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, 1], {j, 1, n}]];
a /@ Range[0, 27] (* Jean-François Alcover, Mar 29 2021~, after Alois P. Heinz *)
A317446
Number of permutations of [n] whose lengths of increasing runs are distinct triangular numbers.
Original entry on oeis.org
1, 1, 0, 1, 6, 0, 1, 12, 0, 166, 3687, 20, 0, 570, 18514, 1, 16044, 689458, 1630, 46150176, 2799527248, 108527, 6182180, 0, 653209572, 50529806020, 457774882, 592018, 64091958837, 5934158290988, 7151183666, 15132424235658, 1574449800015044, 0, 342747690810188908
Offset: 0
-
g:= (n, s)-> `if`(n in s or not issqr(8*n+1), 0, 1):
b:= proc(u, o, t, s) option remember; `if`(u+o=0, g(t, s),
`if`(g(t, s)=1, add(b(u-j, o+j-1, 1, s union {t})
, j=1..u), 0)+ add(b(u+j-1, o-j, t+1, s), j=1..o))
end:
a:= n-> b(n, 0$2, {}):
seq(a(n), n=0..40);
-
g[n_, s_] := If[MemberQ[s, n] || !IntegerQ@Sqrt[8*n + 1], 0, 1];
b[u_, o_, t_, s_] := b[u, o, t, s] = If[u + o == 0, g[t, s],
If[g[t, s] == 1, Sum[b[u - j, o + j - 1, 1, s ~Union~ {t}],
{j, 1, u}], 0] + Sum[b[u + j - 1, o - j, t + 1, s], {j, 1, o}]];
a[n_] := b[n, 0, 0, {}];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jul 14 2021, after Alois P. Heinz *)
A317165
Number of permutations of [n*(n+1)/2] with distinct lengths of increasing runs.
Original entry on oeis.org
1, 1, 5, 241, 188743, 2734858573, 892173483721887, 7469920269852025033699, 1841449549508718383891930251607, 14973026148724796464136435753195418043885, 4467880642339303169146446437381463615730321314015457, 53810913396105573079543194840166969124601447333276658546225661505
Offset: 0
-
g:= (n, s)-> `if`(n in s, 0, 1):
b:= proc(u, o, t, s) option remember; `if`(u+o=0, g(t, s),
`if`(g(t, s)=1, add(b(u-j, o+j-1, 1, s union {t})
, j=1..u), 0)+ add(b(u+j-1, o-j, t+1, s), j=1..o))
end:
a:= n-> b(n*(n+1)/2, 0$2, {}):
seq(a(n), n=0..8);
-
g[n_, s_] := If[MemberQ[s, n], 0, 1];
b[u_, o_, t_, s_] := b[u, o, t, s] = If[u + o == 0, g[t, s],
If[g[t, s] == 1, Sum[b[u - j, o + j - 1, 1, s ~Union~ {t}],
{j, u}], 0] + Sum[b[u + j - 1, o - j, t + 1, s], {j, o}]];
a[n_] := b[n(n+1)/2, 0, 0, {}];
Table[a[n], {n, 0, 8}] (* Jean-François Alcover, Sep 01 2021, after Alois P. Heinz *)
Showing 1-7 of 7 results.
Comments