DPSSPC01 (Find Number From Factorial) - Official Editorial

PROBLEM
First, check if the number is 1. If it is, print 1.
Otherwise, maintain a variable i and set it to 0. While n is not 1, we need to increment i by 1. We need to change n to \dfrac{n}{i} (we divide n each time after we increase i). Then print the final i.
Implementation is simple.

for t in range(int(input())):
    i = 0
    n = int(input())
    if n is 1:
        print("1")
    else:
        while (n != 1):
            i += 1
            n /= i
        print(i)