A333710
Number of permutations sigma of [n] such that i! divides Product_{k=1..i} sigma(k) for 1 <= i <= n.
Original entry on oeis.org
1, 1, 2, 4, 14, 28, 212, 424, 3060, 13488, 131212, 262424, 6444376, 12888752, 145241952, 2146993212, 40313750564, 80627501128, 2265599072684, 4531198145368, 173216179971224, 3202520631881824, 42018513097187068, 84037026194374136, 7051753589203676704, 50056536119264986708
Offset: 0
a(4) = 14: 1234, 1432, 2134, 2314, 2341, 2431, 3214, 3241, 3412, 3421, 4132, 4231, 4312, 4321.
a(5) = 28: 12345, 14325, 21345, 23145, 23415, 23451, 23541, 24315, 24351, 25341, 32145, 32415, 32451, 32541, 34125, 34215, 34251, 34521, 41325, 42315, 42351, 43125, 43215, 43251, 43521, 45321, 52341, 54321.
-
b:= proc(s, p) option remember; (n-> `if`(n=0, 1, add(`if`(
irem(p*n, j, 'q')=0, b(s minus {j}, q), 0), j=s)))(nops(s))
end:
a:= n-> b({$1..n}, 1):
seq(a(n), n=0..17); # Alois P. Heinz, Apr 09 2020
-
b[s_, p_] := b[s, p] = Module[{n=Length[s], q, r}, If[n==0, 1, Sum[If[{q, r} = QuotientRemainder[p n, j]; r==0, b[s~Complement~{j}, q], 0], {j, s}]]];
a[n_] := a[n] = If[n>2 && PrimeQ[n], 2 a[n-1], b[Range[n], 1]];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 25}] (* Jean-François Alcover, Nov 16 2020, after Alois P. Heinz *)
-
{a(n) = if(n==0, 1, my(k=0); forperm([1..n], p, if(#Set(vector(n, i, prod(j=1, i, p[j])%i!))==1, k++)); k)}
A333892
Number of permutations sigma of [n] such that i divides Product_{k=1..i} sigma(k) for 1 <= i <= n.
Original entry on oeis.org
1, 1, 2, 4, 14, 36, 320, 1328, 7872, 51552, 756480, 5440752, 68999136, 584117952, 9632932800, 152699071104, 1881048314880, 21977611223040, 343998708042240, 4374197540536320, 77078374650869760, 1646804888482037760, 45052372505959096320, 727420047420178022400
Offset: 0
a(5) = 36: 12345, 14325, 14352, 21345, 23145, 23415, 23451, 23541, 24315, 24351, 25341, 32145, 32415, 32451, 32541, 34125, 34152, 34215, 34251, 34512, 34521, 41325, 41352, 42315, 42351, 43125, 43152, 43215, 43251, 43512, 43521, 45312, 45321, 52341, 54312, 54321.
-
b:= proc(s) option remember; (n-> `if`(n=0, 1, `if`(irem(
mul(i, i=s), n)=0, add(b(s minus {j}), j=s), 0)))(nops(s))
end:
a:= n-> b({$1..n}):
seq(a(n), n=0..17); # Alois P. Heinz, Apr 09 2020
-
b[s_] := b[s] = With[{n = Length[s]}, If[n==0, 1, If[Mod[Times@@s, n]==0, Sum[b[s ~Complement~ {j}], {j, s}], 0]]];
a[n_] := b[Range[n]];
a /@ Range[0, 20] (* Jean-François Alcover, Nov 16 2020, after Alois P. Heinz *)
-
{a(n) = if(n==0, 1, my(k=0); forperm([1..n], p, if(#Set(vector(n, i, prod(j=1, i, p[j])%i))==1, k++)); k)}
A354830
a(n) is the number of permutations p of [n] such that gcd(i, p(i)) > 1 for 2 <= i <= n.
Original entry on oeis.org
1, 1, 1, 1, 2, 2, 8, 8, 30, 72, 408, 408, 4104, 4104, 29640, 208704, 1437312, 1437312, 22653504, 22653504, 318695040, 2686493376, 27628410816, 27628410816, 575372874240, 1775480841216, 21115550048256, 132879856582656, 2321256928702464, 2321256928702464, 83095013944442880
Offset: 0
-
a(n) = { my (v=select(x -> (!isprime(x)) || (2*x<=n), [2..n])); matpermanent(matrix(#v, #v, i,j, gcd(v[i],v[j])>1)) } \\ Rémy Sigrist, Jun 07 2022
-
def search(a, num, n)
if num == n + 1
@cnt += 1
else
(1..n).each{|i|
if a[i] == 0
if i == 1 || i.gcd(num) > 1
a[i] = num
search(a, num + 1, n)
a[i] = 0
end
end
}
end
end
def A(n)
a = [0] * (n + 1)
@cnt = 0
search(a, 1, n)
@cnt
end
def A354830(n)
(0..n).map{|i| A(i)}
end
p A354830(15)
A357328
Number of permutations p of [n] such that p(i) divides p(j) if i divides j for 1 <= i <= j <= n.
Original entry on oeis.org
1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 6, 4, 2, 2, 6, 6, 24, 24, 24, 6, 24, 24, 24, 12, 12, 12, 48, 48, 240, 240, 120, 48, 48, 48, 240, 144, 96, 96, 480, 480, 2880, 1440, 1440, 720, 4320, 4320, 4320, 4320, 2880, 2880, 20160, 20160, 10080, 10080, 10080, 2880, 20160, 20160, 161280, 60480, 60480, 60480, 120960
Offset: 0
For n = 14, the 4 permutations are:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 12, 11, 14]
[1, 2, 3, 4, 7, 6, 5, 8, 9, 14, 11, 12, 13, 10]
[1, 2, 3, 4, 7, 6, 5, 8, 9, 14, 13, 12, 11, 10]
-
require 'prime'
def f(n)
return 1 if n < 2
(1..n).inject(:*)
end
def A(n)
h = {}
Prime.each(n).each{|i|
h[i] = n / i
}
h.group_by{|k, v| v}.inject(1){|s, i| s * f(i.last.size)}
end
def A357328(n)
(0..n).map{|i| A(i)}
end
p A357328(100)
A354756
a(n) is the number of permutations p of [n] such that lcm(i, p(i)) <= n for all i in [n].
Original entry on oeis.org
1, 1, 2, 3, 8, 10, 56, 64, 192, 332, 1184, 1264, 12192, 12872, 37568, 100836, 311760, 322320, 2338368, 2408848, 14433408, 32058912, 76931008, 78528704, 919469408, 1158792224, 2689828672, 4675217824, 21679173184, 21984820864, 381078324992, 386159441600
Offset: 0
-
b:= proc(s, m) option remember; `if`(s={}, 1, add(
`if`(ilcm(nops(s), i)>m, 0, b(s minus {i}, m)), i=s))
end:
a:= n-> b({$1..n}, n):
seq(a(n), n=0..20); # Alois P. Heinz, Jun 06 2022
-
b[s_, m_] := b[s, m] = If[s == {}, 1, Sum[
If[LCM[Length[s], i]>m, 0, b[s~Complement~{i}, m]], {i, s}]];
a[n_] := b[Range[n], n];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 28}] (* Jean-François Alcover, Jun 25 2022, after Alois P. Heinz *)
-
a(n) = {my(nb=0); for (i=1, n!, my(p=numtoperm(n, i), ok=1); for (k=1, #p, if (lcm(k, p[k]) > n, ok = 0; break);); if (ok, nb++);); nb;}
Showing 1-5 of 5 results.
Comments