File size: 1,009 Bytes
df6dd12 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
A number is called <strong>n</strong>-factorful if it has exactly <strong>n</strong> distinct prime factors. Given positive integers <strong>a</strong>, <strong>b</strong>, and <strong>n</strong>, your task is to find the number of integers between <strong>a</strong> and <strong>b</strong>, inclusive, that are <strong>n</strong>-factorful. We consider 1 to be 0-factorful.<br/><br/>
<h2>Input</h2>
Your input will consist of a single integer <strong>T</strong> followed by a newline and <strong>T</strong> test cases. Each test cases consists of a single line containing integers <strong>a</strong>, <strong>b</strong>, and <strong>n</strong> as described above.<br/><br/>
<h2>Output</h2>
Output for each test case one line containing the number of <strong>n</strong>-factorful integers in [<strong>a</strong>, <strong>b</strong>].<br/><br/>
<h2>Constraints</h2>
<strong>T</strong> = 20<br/>
1 ≤ <strong>a</strong> ≤ <strong>b</strong> ≤ 10<sup>7</sup><br/>
0 ≤ <strong>n</strong> ≤ 10
|