Secret Santa Perfect Loop problem 
*

*(n) people put their name in a hat.  

*Each person picks a name out of the hat to buy a gift for.  

*If a person picks out themselves they put the name back into the hat.

*If the last person can only pick themselves then the loop is invalid and either
. start again
. or step back until a valid loop can be reached.


What is the probability that if n is 33 that the chain creates a perfect loop?
An example of a perfect loop where n is 4:  


*

*A gives to B  

*B gives to C  

*C gives to D.  

*D gives to A.    


An example of a valid but not perfect loop where n is 4:


*

*A gives to B  

*B gives to A  

*C gives to D.  

*D gives to C.    


In order to count the number of perfect loops with $n$ people, we need to count the number of distinct labelings of a cycle on $n$ vertices, say $c(n)$. While I don't have a proof yet, I think the number is given by
$$
c(n)=\frac{1}{2n-3}\binom{3n-6}{n-2}.
$$
On the other hand, to count the number of valid loops we want to know the number of ways to partition $n$ that does not include 1, say $p'(n)$. That is given by the generating function
$$
\sum_{n=1}^\infty p'(n)x^n=\prod_{n=2}^\infty\frac{1}{1-x^n}.
$$
Then for each partition we would need to count the number of perfect loops admitted using our previous equation. 
For example the number of valid loops involving 5 people would be $$\binom{5}{3}c(3)\binom{2}{2}c(2).$$ And so the probability for picking a perfect loop on 5 people from the number of valid loops on 5 people would be 
$$
\frac{c(5)}{c(5)+\binom{5}{3}c(3)\binom{2}{2}c(2)}.
$$
Good luck extending this to $n=33$.
