Is there any fast way in C (below 1 sec) to find the number of perfect squares between two numbers. For ex. for 1 <-> 10 we have 2 perfect squares 4 and 9. But what about between 1<->2^60 or some other bigger number.
This is slow
while(i*i<=n)
{
sum+=i==((long long)(sqrt(i*i)));
i++;
}
where n is lets say 2^60 and we start with i=2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With