cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A320843 Number of permutations sigma of {1,2,...,n} such that sigma(i) divides i or i divides sigma(i) for 1 <= i <= n.

Original entry on oeis.org

1, 1, 2, 3, 8, 10, 36, 41, 132, 250, 700, 750, 4010, 4237, 10680, 24679, 87328, 90478, 435812, 449586, 1939684, 3853278, 8650900, 8840110, 60035322, 80605209, 177211024, 368759752, 1380348224, 1401414640, 8892787136, 9014369784, 33923638848, 59455553072, 126536289568, 207587882368
Offset: 0

Views

Author

Seiichi Manyama, Dec 18 2018

Keywords

Examples

			In case n = 4:
permutation
------------
[1, 2, 3, 4]
[1, 4, 3, 2]
[2, 1, 3, 4]
[2, 4, 3, 1]
[3, 2, 1, 4]
[3, 4, 1, 2]
[4, 1, 3, 2]
[4, 2, 3, 1]
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[n == 0, 1,Permanent[Table[If[Divisible[i, j] || Divisible[j, i], 1, 0], {i, n}, {j, n}]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 0, 22}] (* Jean-François Alcover, Jun 25 2022 *)
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, if (!(i%j) || !(j%i), 1, 0))); \\ Michel Marcus, Dec 30 2018

Formula

a(n) = Permanent((x_{ij})) with x_{ij} = 1 if i divides j or j divides i and x_{ij} = 0 otherwise for i,j = 1,...,n. - M. Farrokhi D. G., Dec 30 2018

Extensions

a(0), a(24)-a(30) from Alois P. Heinz, Dec 19 2018
a(31)-a(35) from M. Farrokhi D. G., Dec 30 2018

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

Views

Author

Seiichi Manyama, Apr 09 2020

Keywords

Examples

			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.
		

Crossrefs

Programs

  • Maple
    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
  • Mathematica
    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 *)
  • PARI
    {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)}

Formula

a(p) = 2*a(p-1) if p is prime.

Extensions

a(14)-a(25) from Alois P. Heinz, Apr 09 2020
Showing 1-2 of 2 results.