#K8541. Unique Prime Gaps

    ID: 36635 Type: Default 1000ms 256MiB

Unique Prime Gaps

Unique Prime Gaps

Given an integer N with \(2 \leq N \leq 200,000\), your task is to compute all unique prime gaps between consecutive prime numbers less than N. The prime gap between two successive primes, \(p_i\) and \(p_{i+1}\), is defined as:

\(p_{i+1} - p_i\)

You need to read the value of N from standard input and output all unique prime gaps in ascending order, each on a separate line. If there are no consecutive prime numbers (and hence no gaps), your program should output an empty string.

inputFormat

The input consists of a single integer N on one line.

outputFormat

The output is a sequence of unique prime gaps (i.e. the differences between consecutive prime numbers less than N) in ascending order, printed on separate lines. Output nothing if no such prime gaps are found.

## sample
20
1

2 4

</p>