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!)
A324372 Number of permutations p of [n] whose absolute displacements |p(i)-i| are prime numbers. 4
1, 0, 0, 0, 1, 2, 9, 28, 144, 640, 2348, 6740, 37161, 208186, 1410137, 8322892, 47973920, 231922220, 1747678465, 11712495736, 101585559496, 776251710048, 6154289307912, 41248110305520, 397850617247393 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
LINKS
Wikipedia, Permutation
EXAMPLE
a(4) = 1: 3412.
a(5) = 2: 34512, 45123.
a(6) = 9: 345621, 351624, 356124, 451623, 456123, 456231, 645123, 645231, 651234.
MAPLE
b:= proc(s) option remember; (n-> `if`(n=0, 1, add(`if`(
isprime(abs(n-j)), b(s minus {j}), 0), j=s)))(nops(s))
end:
a:= n-> b({$1..n}):
seq(a(n), n=0..16);
MATHEMATICA
b[s_] := b[s] = With[{n = Length[s]}, If[n==0, 1, Sum[If[
PrimeQ[Abs[n-j]], b[s ~Complement~ {j}], 0], {j, s}]]];
a[n_] := b[Range[n]];
a /@ Range[0, 16] (* Jean-François Alcover, Mar 25 2021, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A086511 A291632 A328281 * A138912 A374827 A002747
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 August 3 12:10 EDT 2024. Contains 374893 sequences. (Running on oeis4.)