Comments

Yeah so you know that floor(i/ai) = x, i/ai <= floor(i/ai), i/ai <= x, ai <= i/x,

floor(i/ai) + 1 > i/ai, x +1 > i/ai, ai > i/(x+1)

and that's how you do it