#K54702. Largest Prime Less Than N

    ID: 29812 Type: Default 1000ms 256MiB

Largest Prime Less Than N

Largest Prime Less Than N

Given an integer N, find the largest prime number strictly less than N. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Formally, if we denote the input number by \(N\), you need to find the largest prime \(p\) such that \(p < N\). If no such prime exists (i.e. when \(N \leq 2\)), output None.

For example:

  • For \(N = 10\), the answer is 7.
  • For \(N = 30\), the answer is 29.
  • For \(N = 17\), the answer is 13.

Your program should read input from stdin and write the result to stdout.

inputFormat

The input consists of a single integer N provided via standard input.

outputFormat

Output the largest prime number strictly less than N to standard output. If no such prime exists, output None.

## sample
10
7