LearnPy Hub
← Comprehensions problems
Hard

Twin Primes

Read n. Using comprehensions only (no explicit loops with append), build the list of primes up to n, then the list of twin-prime pairs (p, p + 2) where both are prime and p + 2 ≤ n. Print the number of pairs, then the pairs as tuples on one line.

Input

One integer 2 ≤ n ≤ 5000.

Output

Two lines.

Sample 1

Input
20
Output
4
(3, 5) (5, 7) (11, 13) (17, 19)

Sample 2

Input
4
Output
0
solution.py
Output appears here
Twin Primes · Python practice problem · LearnPy Hub