IBMOA #15
Count Power Products in Range
Estimated EasyJudge-ready
Topics (AI-labelled)Bits & Math
Count the integers in the closed interval [low,high] that can be written as 3^x×5^y, where x,y are both non-negative; 1 is valid, and each value is counted only once.
Input
One line containing low high. On this site −2^63≤low≤high≤2^63−1.
Output
Output one integer, the answer.
Example 1
Input:
1 20
Output:
5
Example 2
Input:
2 2
Output:
0
Example 3
Input:
-10 1
Output:
1
Example notes
The examples give 5 (1, 3, 5, 9, 15), 0 and 1 respectively.
Editorial
Loading solution…