| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 86 | 53 | 45 | 65.217% |
In mathematics there are numbers that are fortunate, and some less fortunate. A fortunate number is defined as Q – P, where P is the product of the first N prime numbers (where N>1), and Q is the smallest prime greater than P+1. For example, if N = 2, P = 2*3 (the first two prime numbers), or 6. Q would be the smallest prime greater than 7, which is 11. Q – P is therefore 11 – 6, which is 5, another prime number. It has been conjectured by some mathematicians that this Fortunate number value will always be prime.
Likewise, a less fortunate number is defined as P – Q, using the same above scenario, except that Q is the largest prime less than P-1. Therefore, with N = 2, P again is 6, which makes Q = 3 (the largest prime less than 5), and so the LESS fortunate number in this case is 3. A similar conjecture for LESS fortunate numbers also asserts that they will always be prime.
A row of integer values N in the range 1 < N <= 14.
The original input value N, followed by the fortunate and less fortunate number, as described above, and shown below, with a single space separating each output item.
2 3 4
N = 2 FORTUNATE = 5 LESS = 3 N = 3 FORTUNATE = 7 LESS = 7 N = 4 FORTUNATE = 13 LESS = 11
School > PLU High School Programming Contest > PLU 2016 > Advanced 10번