4 ms·
And it would be better to move the sqrt(n) calculation outside of the loop (I guess that any decent compiler would make this simple optimisation anyway)
by occamrazor 11y ago
And it would be better to move the sqrt(n) calculation outside of the loop (I guess that any decent compiler would make this simple optimisation anyway)
- briHass 11y agoYeah, that would only be evaluated once, since the value of n doesn't change inside the loop.