UVa 10394

From Algorithmist

Jump to: navigation, search

Contents

[edit] 10394 - Twin Primes

[edit] Summary

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)

[edit] Explanation

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.

[edit] Input

1
2
3
4

[edit] Output

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