Loading Now

oddDivisors

Ram likes coding very much. One day his Girlfriend Sita was kidnapped by a mobster named Raavana. Ram searched far and wide for Sita. During his journey he came across a sea which he had to cross in order to reach Sita. The Sea God, knowing that Ram is interested in Coding, asked him the following question.

Given two numbers a and b , find all numbers in the range [a,b] (inclusive) which have an odd number of divisors.

Ram doesn’t have time for this, since he has to save Sita. Help Ram to do this and answer the Sea God’s question.

Example

  • For a = 1 and b = 5, the output should be oddDivisors(a, b) = 2.
    These two numbers are 1 and 4.

Input/Output

  • [execution time limit] 0.5 seconds

  • [input] integer a

    1 ≤ a ≤ 108

  • [input] integer b

    a ≤ b ≤ 108

  • [output] integer

Post Comment

Contact