PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000080. Dãy tổng ước nguyên tố nhỏ nhất (Amazing Prime Sequence)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Dãy tổng ước nguyên tố nhỏ nhất (Amazing Prime Sequence)
Amazing Prime Sequence
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Define a sequence by . For each , let be the smallest prime divisor of and define . Given , compute . For example, because , not , is its smallest prime divisor.
Input
One line contains the integer .
Output
Print the integer .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
4
Output
7
Explanation
Start with . Since , ; then gives ; finally yields . Hence output 7.