ETFD  Euler Totient Function Depth
Lucky is fond of Number theory,
one day he was solving a problem related to Euler Totient Function (phi) and
found an interesting property of phi :
phi(1) = 1, and for x > 1: phi(x) < x.
So if we define a sequence with a_{0} = x, and for n > 0: a_{n} = phi(a_{n1}), this sequence will be constant equal to 1 starting from some point. Lets define depth(x) as minimal n such that a_{n} = 1.
Now he is wondering how many numbers in a given range have depth equal to given number k.
As you are a good programmer help Lucky with his task.
Input
Your input will consist of a single integer T
followed by a newline and T test cases.
Each test cases consists of a single line containing integers
m, n, and k.
Output
Output for each test case one line containing the count of all numbers whose depth equals to k in given range [m, n].
Constraints
T < 10001 1 ≤ m ≤ n ≤ 10^6 0 ≤ k < 20
Example
Input: 5 1 3 1 1 10 2 1 10 3 1 100 3 1 1000000 17 Output: 1 3 5 8 287876
Explanation ::suppose number is 5 ; its depth will be 3. ( 5 > 4 > 2 > 1 )
Note ::Depth for 1 is 0.
hide comments
RIVU DAS:
20150127 16:42:48
@Lakshman  Hey, can you check why i am getting WA??


Mitch Schwartz:
20150115 15:05:59
Changing k <= 20 to k < 20 makes no sense. I checked that k = 20 doesn't appear in the input. But it should.


Francky:
20150115 13:57:43
Here are some proposed improvements for description, as I find it a bit unclear.


[Lakshman]:
20150115 13:57:43
@All I will update the description and IO file soon. Apologize for inconvenience.


Francky:
20150115 13:57:43
This problem is (for now) a riddle : how to guess what could be the exact definition of depth ?


abdou_93:
20150115 13:57:43
how depth(1) = depth(2) = 0


Francky:
20150115 13:57:43
+1 with Mitch for


Mitch Schwartz:
20150115 13:57:43
There is a strange "alignment" issue.


Mitch Schwartz:
20150115 13:57:43
1. The problem looks interesting. :)

Added by:  [Lakshman] 
Date:  20150114 
Time limit:  2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 JSMONKEY 
Resource:  ETF 