The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A324376 Number of permutations p of [n] whose absolute displacements |p(i)-i| are factorial numbers. 4
1, 0, 1, 2, 4, 6, 13, 48, 149, 286, 832, 2304, 6560, 13630, 35937, 95816, 242496, 586480, 1492057, 3928292, 10019073, 24819960, 63656169, 163618614, 416809221, 1731461192, 6214212533 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
Wikipedia, Permutation
EXAMPLE
a(2) = 1: 21.
a(3) = 2: 231, 312.
a(4) = 4: 2143, 2413, 3142, 3412.
a(5) = 6: 21453, 21534, 23154, 24153, 31254, 31524.
a(6) = 13: 214365, 214635, 215364, 215634, 231564, 231645, 241365, 241635, 312564, 312645, 314265, 315264, 341265.
MAPLE
g:= proc(n) local i; 1; for i from 2 do
if n=% then true; break elif n<% then false; break fi;
%*i od; g(n):=%
end:
b:= proc(s) option remember; (n-> `if`(n=0, 1, add(`if`(
g(abs(n-j)), b(s minus {j}), 0), j=s)))(nops(s))
end:
a:= n-> b({$1..n}):
seq(a(n), n=0..20);
MATHEMATICA
factorialQ[n_] := factorialQ[n] = Module[{i, k = 1}, For[i = 2, True, i++, If[n == k, Return[True]]; If[n < k, Return[False]]; k = k*i]];
b[s_] := b[s] = With[{n = Length[s]}, If[n == 0, 1, Sum[If[factorialQ[Abs[n - j]], b[s ~Complement~ {j}], 0], {j, s}]]];
a[n_] := b[Range[n]];
a /@ Range[0, 20] (* Jean-François Alcover, Mar 25 2021, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A295618 A346407 A369390 * A027712 A282139 A138307
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Feb 25 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 9 01:31 EDT 2024. Contains 373227 sequences. (Running on oeis4.)