Submit | All submissions | Best solutions | Back to list |
PRSQRFR - Perfect Composites |
Rohil and Mahesh recently attended a class on Prime Numbers. They learnt about a term "Prime Score" which is defined for all N > 1. For a number N = p1a × p2b × p3b × ... × pkm where p1, p2 ... pk are prime factors of N, Prime Score of N = a + b + ... + m.
While Mahesh was interested only in primes, Rohil thought how about playing around with composite numbers. Both started discussing and found out something known as Perfect Composite Numbers. They defined a composite number N as Perfect Composite if it is divisible by all the divisors of its Prime Score.
Whoa!! That's a nice discovery both of them have made. Now, they are interested in finding the number of Perfect Composites between A and B (inclusive) having Prime Score K. They want you to write a program for the same.
Input
First line contains a single integer T ≤ 10000, the number of test cases. Each following line contains three integers A, B and K (2 ≤ A ≤ B ≤ 105 and K ≥ 0).
Output
For each test case, print a single integer - the number of Perfect Composite numbers between A and B (inclusive) having Prime Score = K.
Example
Input: 5 2 5 2 3 100 3 4 10 5 90 456 8 34 67 5 Output: 1 11 0 2 0
Added by: | Mahesh Chandra Sharma |
Date: | 2011-01-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own Problem |
hide comments