A218002
E.g.f.: exp( Sum_{n>=1} x^prime(n) / prime(n) ).
Original entry on oeis.org
1, 0, 1, 2, 3, 44, 55, 1434, 3913, 39752, 392481, 5109290, 34683451, 914698212, 5777487703, 91494090674, 1504751645265, 31764834185744, 379862450767873, 12634073744624082, 132945783064464691, 2753044719709341980, 64135578414076991031, 1822831113987975441482
Offset: 0
E.g.f.: A(x) = 1 + x^2/2! + 2*x^3/3! + 3*x^4/4! + 44*x^5/5! + 55*x^6/6! + 1434*x^7/7! + ...
where
log(A(x)) = x^2/2 + x^3/3 + x^5/5 + x^7/7 + x^11/11 + x^13/13 + x^17/17 + x^19/19 + x^23/23 + x^29/29 + ... + x^prime(n)/prime(n) + ...
a(5) = 44 because there are 5!/5 = 24 permutations that are 5-cycles and there are 5!/(2*3) = 20 permutations that are the disjoint product of a 2-cycle and a 3-cycle. - _Geoffrey Critzer_, Nov 08 2015
-
a:= proc(n) option remember; `if`(n=0, 1, add(`if`(isprime(j),
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
-
f[list_] :=Total[list]!/Apply[Times, list]/Apply[Times, Map[Length, Split[list]]!]; Table[Total[Map[f, Select[Partitions[n], Apply[And, PrimeQ[#]] &]]], {n, 0,23}] (* Geoffrey Critzer, Nov 08 2015 *)
-
{a(n)=n!*polcoeff(exp(sum(k=1,n,x^prime(k)/prime(k))+x*O(x^n)),n)}
for(n=0,31,print1(a(n),", "))
A317130
Number of permutations of [n] whose lengths of increasing runs are triangular numbers.
Original entry on oeis.org
1, 1, 1, 2, 7, 24, 93, 483, 2832, 17515, 123226, 978405, 8312802, 75966887, 756376739, 8070649675, 91320842018, 1099612368110, 14054043139523, 189320856378432, 2682416347625463, 39945105092501742, 623240458310527252, 10160826473676346731, 172871969109661492526
Offset: 0
a(2) = 1: 21.
a(3) = 2: 123, 321.
a(4) = 7: 1243, 1342, 2134, 2341, 3124, 4123, 4321.
a(5) = 24: 12543, 13542, 14532, 21354, 21453, 23541, 24531, 31254, 31452, 32145, 32451, 34521, 41253, 41352, 42135, 42351, 43125, 51243, 51342, 52134, 52341, 53124, 54123, 54321.
-
g:= n-> `if`(issqr(8*n+1), 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[8n+1], 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, Apr 29 2020, after Alois P. Heinz *)
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 *)
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 *)
A317447
Number of permutations of [n] whose lengths of increasing runs are distinct prime numbers.
Original entry on oeis.org
1, 0, 1, 1, 0, 19, 0, 41, 110, 70, 13696, 1, 44796, 155, 411064, 2122802, 251746, 1057634441, 4404368, 25043183, 44848672, 19725545894, 106293316, 307873058001, 50194102, 8305023165502, 65808841818130, 33715371370134, 115625740201672616, 78940089764191
Offset: 0
-
g:= (n, s)-> `if`(n in s or not (n=0 or isprime(n)), 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] || Not [n == 0 || PrimeQ[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, 1, u}], 0] + Sum[b[u + j - 1, o - j, t + 1, s], {j, 1, o}]];
a[n_] := b[n, 0, 0, {}];
a /@ Range[0, 40] (* Jean-François Alcover, Mar 29 2021, after Alois P. Heinz *)
-
from functools import lru_cache
from sympy import isprime
def g(n, s): return int((n == 0 or isprime(n)) and not n in s)
@lru_cache(maxsize=None)
def b(u, o, t, s):
if u + o == 0: return g(t, s)
c1 = sum(b(u-j, o+j-1, 1, tuple(sorted(s+(t,)))) for j in range(1, u+1)) if g(t, s) else 0
return c1 + sum(b(u+j-1, o-j, t+1, s) for j in range(1, o+1))
def a(n): return b(n, 0, 0, tuple())
print([a(n) for n in range(41)]) # Michael S. Branicky, Mar 29 2021 after Alois P. Heinz
Showing 1-6 of 6 results.
Comments