UVa 10394

From Algorithmist
Jump to navigation Jump to search

10394 - Twin Primes[edit]

Summary[edit]

This problem is a simple prime calculating problem. You have to find twin prim numbers. A pair of twin numbers e.g. is (3,5). Or in general (p, p+2)

Explanation[edit]

The time limit allows you to precalculate all primes between 2 and 20000000. Then you can look for all twin primes in that intervall. After that it is easy to find the n-th twin primes.

Input[edit]

1
2
3
4

Output[edit]

(3, 5)
(5, 7)
(11, 13)
(17, 19)