Cool Numbers
Time limit1sMemory limit128 MB
Count integers in [a, b] that are both a perfect square and a perfect cube, meaning perfect sixth powers.
- Level
Easy3 of 10
- Topics
- Math, Number theory, Brute force
- Solved
- No attempts yet
Problem
Eric likes interesting numbers such as 64. It turns out that 64 is both a perfect square and a perfect cube, since and . Eric calls such numbers cool.
Write a program that counts how many integers in a given range are cool.
Input
The first line contains an integer with .
The second line contains an integer with .
Output
Print the number of cool numbers in the inclusive range from to (both and are counted if they are cool).