I want to build an algorithm which tells if a number has any odd divisor or not.
for example, 6 has an odd divisor 3 (greater than 1), 4 doesn't have any odd divisors, and so on.
I know that I can find all the pairs of divisors by only traversing till square root of the number.
for example, if n%i == 0 then i and n/i both are divisors.
for example, if the number given is 100 using this method I can find all the divisors and check if any divisor is odd or not i.e. 1, 100, 2, 50, 4, 25, 5, 20, 10.
Therefore this algorithms solves the problem in O(sqrt(n)) complexity. But I'm looking to optimize this.
Please comment if any more clarity is required from my side as I'm new to this forum.
Thanks !