If you need to find one $n$ that works for all the integers from $2$ to $40$ then Fermat/Euler says first that $x^{100} \equiv 1 \pmod{101}$. So $n$ is at most $100$. Then you just need to find one number for which no smaller number works, and as others have shown, $2^n \not\equiv 1 \pmod{101}$ for any $n$ between $1$ and $100$, so the answer is $n= 100.$
If you have to find a different $n$ for each integer, then your work is cut out for you. The problem asks for the "order" of each integer. The lemmas and corollaries around the Fermat/Euler theorems say that the order of an integer divides $\phi(101) = 100$. The divisors of $100$ are $1, 2, 4, 5, 10, 20, 25, 50,$ and $100$. So your $n$ has to be one of these.
For instance, for $x=10$, we have $10^2 = 100 \equiv -1 \pmod{101}$ and so $10^4 \equiv (-1)^2 \equiv 1 \pmod{101}$. Since $2$ doesn't work and $4$ does, $n=4$.
But for $x=16$, you'll have to compute $16^n$ for $n=2, 4, 5, 10, 20,$ and $25$ to discover that $n=25$ for this case.
You may need more than one calculator.