Run if (or similar) statement once

So actually, with massively fast inputs, this code would actually work? But only if the denominator is less than 30.

Yes, but you will lose a lot of precision. Using integer maths:
30/1 = 30
30/2 = 15
30/3 = 10
30/4 = 7
...
30/11 = 2 in fact everthing up to /15 = 2
30/16 thru 30 = 1

This is probably no good for you! Floats will work but are slower (as mentioned) and also reqire libraries that take valuable memory.