%I #59 Dec 12 2023 07:49:24
%S 1,2,6,12,34,104,406,1112,3980,15216,68034,312048,1625968,8771376,
%T 53270068,319218912,2135312542,14420106264,109051882344,815868128288,
%U 6772099860398,56501841264216,519359404861294
%N The number of squarefree permutations of 1,...,n.
%C A permutation is squarefree if it does not contain two consecutive factors of length two or more that are in the same relative order. For example, the permutation 243156 is squarefree, while the permutation 631425 contains the square 3142 (indeed, 31 is order-isomorphic to 42). Squarefree permutations exist of any length.
%H Sergey V. Avgustinovich, Sergey Kitaev, Artem V. Pyatkin and Alexandr Valyuzhenich, <a href="https://personal.cis.strath.ac.uk/sergey.kitaev/index_files/Papers/square-free-perms2.pdf">On Square-Free Permutations</a>, Languages and Combinatorics 16(1): 3-10 (2011).
%H Ian Gent, Sergey Kitaev, Alexander Konovalov, Steve Linton and Peter Nightingale, <a href="http://arxiv.org/abs/1402.3582">S-crucial and bicrucial permutations with respect to squares</a>, arXiv:1402.3582 [math.CO], 2014; and <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Kitaev/kitaev10.html">J. Int. Seq. 18 (2015) 15.6.5</a>.
%H Carla Groenland and Tom Johnston, <a href="https://arxiv.org/abs/2109.00502">The lengths for which bicrucial square-free permutations exist</a>, arXiv:2109.00502 [math.CO], 2021.
%F For n>2, a(n) = 4*A238937(n) - 2*A238942(n). - _Olexandr Konovalov_, Mar 07 2014
%e a(1)=1 [1]; a(2)=2 [12, 21]; a(3)=6 [123,132, 213, 231, 312, 321]; a(4)=12 [1243, 1342, 1432, 2341, 2431, 3421, 2134, 3124, 4123, 3214, 4213, 4312].
%t noq[w_] := Length[w] < 4 || Catch[ Do[If[ Ordering@ Ordering@ Take[w, k] == Ordering@ Ordering@ Take[w, {k+1, 2*k}], Throw@False], {k, 2, Length[w]/2}]; True]; r[p_, f_] := Block[{w}, If[f == {}, 1, Sum[ If[noq[w = Prepend[p, f[[i]]]], r[w, Delete[f, i]], 0], {i, Length@f}]]]; a[n_] := r[{}, Range[n]]; Array[a, 9] (* _Giovanni Resta_, May 12 2013 *)
%Y Cf. A221990, A238937, A238942.
%K nonn,nice,more
%O 1,2
%A _Olexandr Konovalov_, May 12 2013
%E a(16) from _Giovanni Resta_, May 13 2013
%E a(17)-a(18) from _Steve Linton_, May 18 2013
%E a(19)-a(23) from _Tom Johnston_, Sep 02 2021
|