PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000244. Tổng bình phương hàm phi Euler (Mathematically Hard)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tổng bình phương hàm phi Euler (Mathematically Hard)
Mathematically Hard
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
For an integer , let be the number of positive integers smaller than and coprime to . The score of is . Given integers , compute the exact sum of scores for all integers in , without a modulus.
Input
One line contains the two integers in this order.
Output
Print the nonnegative integer .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
6 6
Output
4
Explanation
For 6, phi(6)=2 and the square equals 4.
Example 2
Input
8 8
Output
16
Explanation
For 8, phi(8)=4, hence its square is 16.
Example 3
Input
2 20
Output
1237
Explanation
Sum phi(x)^2 for every x from 2 through 20.