What you are looking for is the Stars and Bars method. This method is used to count things where order does not matter and repetition is allowed.
We are choosing $9$ digits from $\{1,2,3,4,5,6\}$
Let me explain how we can get to the answer.
For example, let's say we want to pick the combination $123456123$. This can be "arranged" as such:
$$••|••|••|•|•|•$$
We picked $2$ ones, $2$ twos, $2$ threes, and $1$ of the rest.
Let's look at another possibility: $111222456$
$$•••|•••| |•|•|•$$
We have three ones, three twos, and one $4$, $5$, and $6$.
Look at what these pictures are showing: we have $14$ symbols and we are choosing $5$ of them to be a bar. Or we could look at it as choosing $9$ of them to be a dot (star)
So the answer to our original question is $$\binom{14}{9} = \binom{14}{5} = 2002$$
In graph theory terms, you would like to partition a complete graph into matchings ($1$-regular graphs). There is a well-known algorithm for doing that. Your students would be the vertices of this graph, and a pair of students working together would be an edge of this graph.
First, label your $n$ students (where $n$ is even) as follows: $\infty,0,1,2,\dots,n-2$. Think of the finite (non-$\infty$) labels as remainders modulo $n-1$. Now, for each $i=0,1,2,\dots,n-2$, pair your students as follows: $(\infty,i)$ and $(i+k,i-k)$ for $k=1,2,\dots,\frac{n}{2}-1$. In other words, except for the special pair with $\infty$, the sum of the two labels in a pair should be $2i$ modulo $n-1$.
For example, let $n=8$, then $n-1=7$ (so all labels are remainders modulo $7$), and your vertex labels are $\infty,0,1,2,3,4,5,6$. The matchings you need are as follows:
$$
\begin{matrix}
i=0: & (\infty,0), (1,6), (2,5), (3,4)\\
i=1: & (\infty,1), (2,0), (3,6), (4,5)\\
i=2: & (\infty,2), (3,1), (4,0), (5,6)\\
i=3: & (\infty,3), (4,2), (5,1), (6,0)\\
i=4: & (\infty,4), (5,3), (6,2), (0,1)\\
i=5: & (\infty,5), (6,4), (0,3), (1,2)\\
i=6: & (\infty,6), (0,5), (1,4), (2,3)
\end{matrix}
$$
To see that this as a picture, imagine the labels $0,1,2,\dots,n-2$ as spaced evenly around a circle while $\infty$ is placed in the center. Then $(\infty,i)$ is a "minute hand" pointing at $i$, while the rest of the pairs are all edges perpendicular to it.
Best Answer
3 way to pick the first number, 3 ways to pick the second number and so on which equates to $$3^5 =243$$ After only 18 visits, the chances are more likely than not, that you will get a number you have had before.