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!)
A324374 Number of permutations p of [n] whose absolute displacements |p(i)-i| are triangular numbers. 4
1, 1, 2, 3, 9, 19, 49, 173, 542, 1811, 5061, 23744, 93973, 385493, 1394506, 5342437, 29798445, 138233786, 689926740, 3068163126, 14882203929, 67731732263, 412791651318, 2341487404144, 13639722130984 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
Wikipedia, Permutation
EXAMPLE
a(3) = 3: 123, 132, 213.
a(4) = 9: 1234, 1243, 1324, 2134, 2143, 2341, 4123, 4231, 4321.
a(5) = 19: 12345, 12354, 12435, 13245, 13254, 13452, 15234, 15342, 15432, 21345, 21354, 21435, 23415, 25314, 41235, 41352, 42315, 43215, 45312.
MAPLE
g:= proc(n) option remember; issqr(8*n+1) 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..16);
MATHEMATICA
g[n_] := g[n] = IntegerQ@Sqrt[8n+1];
b[s_] := b[s] = With[{n = Length[s]}, If[n == 0, 1, Sum[If[g[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: A094812 A307898 A079992 * A106519 A006866 A121908
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 May 21 09:41 EDT 2024. Contains 372733 sequences. (Running on oeis4.)