#P9407. Finding the Prime Sum Range
Finding the Prime Sum Range
Finding the Prime Sum Range
Given an integer \(n\), find two integers \(l\) and \(r\) (with \(l \le r\)) such that the sum of all prime numbers in the interval \([l, r]\) equals \(n\). Formally, let \[ S(l, r) = \sum_{\substack{p\;\text{is prime}\\ l \le p \le r}} p, \] find \(l\) and \(r\) satisfying \(S(l, r) = n\).
If there are multiple solutions, any one is acceptable; if no solution exists, output NIE
.
inputFormat
The input consists of a single integer \(n\) (\(1 \le n \le 10^9\)).
outputFormat
If a valid interval is found, output two integers \(l\) and \(r\) separated by a space. Otherwise, output NIE
.
sample
41
2 13