#GL0000267. Độ sâu của hàm phi Euler (Euler Totient Function Depth)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Độ sâu của hàm phi Euler (Euler Totient Function Depth)
Euler Totient Function Depth
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , define and . The depth of is the minimum number of iterations required to reach , so the depth of is . Given an interval and an integer , count integers with depth exactly .
Input
One line containing integers in that order.
Output
Print the number of integers in having depth .
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Example 1
Input
1 3 1
Output
1
Explanation
We inspect for depth . Exactly 1 integers qualify. In particular, has depth , while gives depth .
Example 2
Input
1 10 2
Output
3
Explanation
We inspect for depth . Exactly 3 integers qualify. In particular, has depth , while gives depth .
Example 3
Input
1 10 3
Output
5
Explanation
We inspect for depth . Exactly 5 integers qualify. In particular, has depth , while gives depth .
Example 4
Input
1 100 3
Output
8
Explanation
We inspect for depth . Exactly 8 integers qualify. In particular, has depth , while gives depth .