First we need the number of proper reduced fractions for a denominator `d`. This is the amount of numbers `d limit`. Because every other factor will only increase `x`. - The value of phi is always calculated from the last phi value. So we don't need to totally recalculate it in every step. After looking a little bit around this is not ***the** fastest solution to this problem. But it's the one I found and I think it's reasonable fast.