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 x p2b x p3b ... x 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 factors 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.
First line contains a single integer T <= 10000, the number of testcases. Each following line contains three integers A, B and K (2 <= A <= B <= 105 and K >= 0).
For each test case, print a single integer - the number of Perfect Composite numbers between A and B (inclusive) having Prime Score = K.
2 5 2
3 100 3
4 10 5
90 456 8
34 67 5
How the hell did others get AC following statement like this? Perfect composite is divisible by its prime score, not just the "factors" of it. Eg. 100 is a PC with score 4 but 90 is not. AC'd with a desperate guess :/