Consider a positive integer $a > 1$. If $a$ is not a perfect square then at the next move we add $3$ to it and if it is a perfect square we take the square root of it. Define the trajectory of a number $a$ as the set obtained by performing this operation on $a$. For example the cardinality of $3$ is $\{3, 6, 9\}$.
Find all $n$ such that the cardinality of $n$ is finite. 

The following part problems may attract partial credit.

$\textbf{(a)}$Show that the cardinality of the trajectory of a number cannot be $1$ or $2$.
$\textbf{(b)}$Show that $\{3, 6, 9\}$ is the only trajectory with cardinality $3$.
$\textbf{(c)}$ Show that there for all $k \geq 3$, there exists a number such that the cardinality
of its trajectory is $k$.
$\textbf{(d)}$ Give an example of a number with cardinality of trajectory as infinity.
Let's break down the problem into the given parts and solve each one step-by-step.

### Part (a)
**Show that the cardinality of the trajectory of a number cannot be 1 or 2.**

1. Suppose the cardinality of the trajectory of a number \( a \) is 1. This means that \( a \) must be a perfect square, and taking the square root of \( a \) must yield \( a \) itself. However, this is impossible because the only number whose square root is itself is 1, and \( a > 1 \). Therefore, the cardinality cannot be 1.

2. Suppose the cardinality of the trajectory of a number \( a \) is 2. This means that starting from \( a \), we must return to \( a \) after one operation. If \( a \) is not a perfect square, we add 3 to it, and if it is a perfect square, we take the square root. For the trajectory to have cardinality 2, \( a \) must be a perfect square, say \( a = b^2 \). Then the next number is \( b \), and the next number after \( b \) must be \( a \). This implies \( b = b^2 \), which is impossible for \( b > 1 \). Therefore, the cardinality cannot be 2.

### Part (b)
**Show that \(\{3, 6, 9\}\) is the only trajectory with cardinality 3.**

1. Suppose the trajectory of a number \( a \) has cardinality 3. This means there are three distinct numbers in the trajectory, say \( a, b, c \), such that the operations cycle through these numbers.

2. If \( a \) is not a perfect square, we add 3 to it. If \( a \) is a perfect square, we take the square root. For the trajectory to have cardinality 3, one of these numbers must be a perfect square.

3. Let's assume \( a = 3 \). Then the trajectory is:
   \[
   3 \rightarrow 6 \rightarrow 9 \rightarrow 3
   \]
   Here, 9 is a perfect square, and taking the square root of 9 gives 3, completing the cycle.

4. To show that this is the only trajectory with cardinality 3, assume there is another number \( x \) with a trajectory of cardinality 3. If \( x \) is not 3, then \( x \) must eventually lead to 3, 6, or 9 to form a cycle. However, any number other than 3, 6, or 9 will not form a cycle of length 3. Therefore, \(\{3, 6, 9\}\) is the only trajectory with cardinality 3.

### Part (c)
**Show that for all \( k \geq 3 \), there exists a number such that the cardinality of its trajectory is \( k \).**

1. Consider the number \( 6^{2^k} \). The trajectory of this number will include the numbers:
   \[
   6^{2^k}, 6^{2^{k-1}}, 6^{2^{k-2}}, \ldots, 6^2, 6, 9, 3, 6
   \]
   This sequence has \( k \) distinct numbers before it starts repeating.

2. Therefore, for any \( k \geq 3 \), the number \( 6^{2^k} \) has a trajectory with cardinality \( k \).

### Part (d)
**Give an example of a number with a trajectory of infinite cardinality.**

1. Consider the number 2. The trajectory of 2 is:
   \[
   2, 5, 8, 11, 14, \ldots
   \]
   Since 2 is not a perfect square, we keep adding 3 to it indefinitely. This sequence never repeats and continues to grow without bound.

2. Therefore, the number 2 has a trajectory with infinite cardinality.

The final answer is \( \boxed{0 \pmod{3}} \)