Under construction

Still being built. Things may change

O Fortuna

Time limit1sMemory limit1024 MB

Summary
Given N, compute P as the product of the first N primes, then output Q minus P (Q is the next prime above P+1) and P minus Q (Q is the previous prime below P-1).
Level

Medium4 of 10

Topics
Number theory, Implementation
Solved
No attempts yet

Problem

Some numbers in mathematics are fortunate, and others are less fortunate. A fortunate number is Q−PQ - P, where PP is the product of the first NN prime numbers (N>1N > 1), and QQ is the smallest prime greater than P+1P + 1. For example, with N=2N = 2, P=2×3=6P = 2 \times 3 = 6. The smallest prime greater than 7 is 11, so the fortunate number is 11−6=511 - 6 = 5, which is also prime. Some mathematicians have conjectured that fortunate numbers are always prime.

A less fortunate number is P−QP - Q, using the same PP, except that QQ is the largest prime less than P−1P - 1. With N=2N = 2, P=6P = 6, so Q=3Q = 3 (the largest prime less than 5), and the less fortunate number is 6−3=36 - 3 = 3. A similar conjecture says that less fortunate numbers are always prime.

Input

A single integer NN with 1<N≤141 < N \leq 14.

Output

Print the input value NN, followed by the fortunate number and the less fortunate number as described above. Separate each output item with a single space.

Examples1

  1. Example 1

    Input
    2 3 4
    
    Expected output
    N = 2 FORTUNATE = 5 LESS = 3
    N = 3 FORTUNATE = 7 LESS = 7
    N = 4 FORTUNATE = 13 LESS = 11