#05AB1E, 17 bytes
05AB1E, 17 bytes
Uses the same algorithm as Bob's answer. Note that also for this, input greater than 7 will take a while to compute. If you aren't really patient, you can also change the 3
into a 2
in the code.
Code:
3WmGN<!nN%iN}})Z£
Explanation:
3Wm # 3 ^ input
G } # For N in range(1, 3 ^ input)
N<!n # Compute (N - 1)!²
N% # mod N
i } # If 1
N # Place N onto the stack
)Z£ # Keep the first Z (auto-assigned to input) elements
Uses CP-1252 encoding