#GL0000261. Gửi bảng giá trị (Send a Table)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Gửi bảng giá trị (Send a Table)
Send a Table
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Jimmy precomputes a function of ordered positive integer pairs for . A known value determines for positive integers whose arguments remain in range. Swapping the arguments is not permitted. Find the minimum number of ordered pairs that must be precomputed.
Input
Read one integer .
Output
Print the minimum number of entries to precompute.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
2
Output
3
Explanation
The ordered coprime pairs are (1, 1), (1, 2), (2, 1). Their number is 3; none can be scaled down by a common factor.
Example 2
Input
5
Output
19
Explanation
The ordered coprime pairs are (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 1), (2, 3), (2, 5), (3, 1), (3, 2), (3, 4), (3, 5), (4, 1), (4, 3), (4, 5), (5, 1), (5, 2), (5, 3), (5, 4). Their number is 19; none can be scaled down by a common factor.