How many functions $f: A\rightarrow A$ exist without (?) any $f(x)=x$ The definition:
$\mathcal A = \{1\cdots12\}$
$\mathcal f: A \rightarrow A$
for each $\mathcal x \in A$, $\mathcal f$ is defined $\mathcal f(f(x)) \neq x$ and $\mathcal f(f(f(x))) = x$
How many functions exist?
My thoughts:
=> (1) $\mathcal f$ is an bijective function
=> (2) $\mathcal f(x) \neq x$ (that's right?)
Then, I have thought using inclusion-exclusion principle, by taking all bijective functions of $f: A\rightarrow A$ ($12!$, right?) minus all "bad" function with $f(x)=x$.
However, I'm not sure about how doing it (there would be duplication etc).
The answer is $246,400$
 A: There are $11$ choices for $f(1)$, and for each such choice there are $10$ choices for $f(f(1))$, and then $f(f(f(1)))$ is determined, it must be $1$.  
Now let $a$ be the smallest of the  numbers $1$ to $12$ not mentioned so far. There are $8$ choices for $f(a)$ and then $7$ for $f(f(a))$, and now $f(f(f(a)))$ is determined. Let $b$ be the smallest number not mentioned so far. There are $\dots$. 
We get a total of $(11)(10)(8)(7)(5)(4)(2)(1)$. The idea generalizes. 
A: The function $f$ must be bijective, since it is invertible: $$f(f(f(x))) = x \implies f\circ f = f^{-1}.$$ This means that $f$ is a permutation of the elements $$\{1,2,3,...,12\}.$$
Each permutation can be broken up into cycles. Now since for each $x$ we have $f\circ f (x) \neq x$, but $f\circ f \circ f (x) = x$ this means that $x$ must be in a three cycle. (If $f^3(x) = x$, then either $3$ is the smallest power that will return us to $x$ or $f(x) =x$. However, if $f(x) =x$ then we would have $f^2(x) = x$ and that's a contradiction).
This holds for all $x \in \{1,...,12\}$, which means every element is in a three cycle. Thus $f$ can be written in cycle notation as: $$(abc)(def)(ghi)(jkl).$$ For instance $(1\ 2\ 3)(4\ 5\ 6)(7\ 8\ 9)(10\ 11\ 12)$ is a function of the form required.
Now the question comes down to determining how many functions fall into this form. That is, we wish to place the numbers $\{ 1,...,12\}$ into the spots held by the dots: $$(\cdot \cdot \cdot)(\cdot \cdot \cdot)(\cdot \cdot \cdot)(\cdot \cdot \cdot).$$
Remember that $(1 2 3) = (3 1 2) = (2 3 1)$ as a cycle. Thus there are $3!/3 = 2$ ways of placing three numbers in this cycle. For the first cycle we have ${ 12 \choose 3}$ ways of choosing elements to place in it. Thus for the first cycle we have $${ 12 \choose 3} \cdot 2$$ possibilities.
For the second cycle, we have $${ 9 \choose 3 } \cdot 2$$ possibilities, and so on.
Thus the total number of ways of assigning the numbers to the dots is given by: $${12 \choose 3 } \cdot { 9 \choose 3 } \cdot { 6 \choose 3 } \cdot { 3 \choose 3} \cdot 2^4= \frac{12!}{3^4}.$$
This last equation tells us we could have counted differently. When placing the numbers $1,...,12$ in the spaces held by the dots, there are $12!$ ways of doing this. Then divide by $3$ for each cycle, since for each cycle there is three ways of representing the cycle.
Finally, since the order of the cycles does not matter, we must divide by $4!$ to finish the counting problem.
A: Same: The question asks the elements of $S_{12}$ which has at least one $3$-cycle and the number of element in other cycles are $\leq3$.
