#P9118. [春季测试 2023] 幂次
[春季测试 2023] 幂次
Problem Description
In elementary math class, Little learned the concept of “powers”: , define as the product of copies of multiplied together.
She is curious about how many positive integers can be written in the form above. Since every positive integer can always be written as , she requires that in such a representation, we must have , where is a positive integer chosen in advance.
Therefore, she wants to know: among the integers from to , how many positive integers can be written as , where and are both positive integers and ?
Input Format
The first line contains two positive integers , with the meanings described above.
Output Format
Output one line containing one non-negative integer representing the corresponding answer.
99 1
99
99 3
7
99 2
12
Hint
[Explanation for Sample 2]
The following are all positive integers that satisfy the requirement, along with one valid representation for each.
$1 = 1^3, 8 = 2^3, 16 = 2^4, 27 = 3^3, 32 = 2^5, 64 = 4^3, 81 = 3^4$.
Note that some positive integers may have multiple valid representations. For example, can also be written as .
However, according to the statement, different valid representations of the same number are counted only once.
[Explanation for Sample 3]
The following are all positive integers that satisfy the requirement, along with one valid representation for each.
$1 = 1^2, 4 = 2^2, 8 = 2^3, 9 = 3^2, 16 = 4^2, 25 = 5^2, 27 = 3^3, 32 = 2^5, 36 = 6^2, 49 = 7^2, 64 = 8^2, 81 = 9^2$.
[Sample 4]
See power/power4.in and power/power4.ans in the contestant directory.
[Sample 5]
See power/power5.in and power/power5.ans in the contestant directory.
[Sample 6]
See power/power6.in and power/power6.ans in the contestant directory.
[Constraints]
For all testdata, it is guaranteed that and .
| Test Point ID | ||
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 |
Translated by ChatGPT 5