The core of a function $f:[n]\to[n]$ is the set of all elements $i\in[n]$ "lying on a cycle". For example, $\mathrm{core}(f)=\{4,5,6\}$ in the picture below. This function has a core size of 3.
How do I find out the number of functions $f:[3]\to[3]$ with a core size of 1? I understand that with a core size of 1, $x=f(x)$. I thought it would be $3!$ but it's not.

The functions on $[n]$ with a core size of $1$ are in bijection with the rooted trees with $n$ labeled vertices. A rooted tree corresponds to the function that maps each element to its ancestor on the path to the root, and the root to itself. There are $n^{n-2}$ trees with $n$ labeled vertices (see Cayley’s formula), and for each of them there are $n$ different choices for the root, so there are $n^{n-1}$ rooted trees on $n$ labeled vertices. Thus, in your case, there are $3^{3-1}=9$ different functions on $[3]$ with a core of size $1$.