PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000104. Cặp số nguyên tố sinh đôi thứ S (Twin Primes)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cặp số nguyên tố sinh đôi thứ S (Twin Primes)
Twin Primes
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Primes and form a twin prime pair. Order all pairs by increasing first prime ; the first three are , , and . Given a 1-based pair index , find the pair at this position.
Input
One line contains the 1-based index .
Output
Print a single line exactly as (p, q), with one space after the comma and .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
3
Output
(11, 13)
Explanation
The first, second, and third pairs are , , and . Thus corresponds to (11, 13).