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!)
A324375 Number of permutations p of [n] whose absolute displacements |p(i)-i| are square numbers. 4
1, 1, 2, 3, 5, 13, 29, 68, 165, 339, 1249, 3706, 11749, 39151, 105714, 321361, 938529, 4112583, 16778058, 64073812, 260625900, 917269164, 3451696842, 13068376545, 48655092849 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
Wikipedia, Permutation
EXAMPLE
a(3) = 3: 123, 132, 213.
a(4) = 5: 1234, 1243, 1324, 2134, 2143.
a(5) = 13: 12345, 12354, 12435, 13245, 13254, 21345, 21354, 21435, 23451, 51234, 52341, 52431, 53241.
MAPLE
b:= proc(s) option remember; (n-> `if`(n=0, 1, add(`if`(
issqr(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] = Function[n, If[n == 0, 1, Sum[If[IntegerQ@Sqrt[Abs[n-j]], b[s ~Complement~ {j}], 0], {j, s}]]][Length[s]];
a[n_] := b[Range[n]];
a /@ Range[0, 16] (* Jean-François Alcover, Apr 23 2021, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A072536 A087592 A248526 * A038879 A162390 A108515
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 23 11:42 EDT 2024. Contains 375396 sequences. (Running on oeis4.)