PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000175. Tổng các ước của các số từ 1 đến n (Sum of Divisors)
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 các ước của các số từ 1 đến n (Sum of Divisors)
Sum of Divisors
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , let be the sum of all positive divisors of , including and itself.
For example, the divisors of are , so .
Given a positive integer , compute
modulo .
Input
One line containing the integer .
Output
Print .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
5
Output
21
Explanation
The divisor sums for are . Therefore .