Quickest way of finding the largest integer n such that n! has length of m bits
import math
n = int(input())
while n != 0:
    n = (n - 1960) / 10 + 2



What does n represent now? n as a name for the value which is called y in the task description is already unnecessarily obscure, but aliasing it really confuses things.

In addition, note that in Python / does floating point division. If the output for 1969 should be the same as the output for 1960 (and I'm pretty sure the spec requires that) then there's a bug here.


    m = pow(2,n)



What does m represent? If you want people to review your code, use descriptive names!


    while m &gt; 0:
        m -= math.log(i,2)
        i += 1



How many times does this loop execute for the largest possible input? How can you avoid a linear loop? (Hint: a certain Stirling analysed \$\log n!\$ ...)

(Or, arguably cheating, there are only 21 decades in view, so you could hard-code a lookup.)