#P12364. Minimum Positive Integer with Given Remainders

    ID: 14465 Type: Default 1000ms 256MiB

Minimum Positive Integer with Given Remainders

Minimum Positive Integer with Given Remainders

We are given a positive integer (n) (with (n \le 10^{17})) that, when divided by each integer from (2) to (49), leaves a prescribed remainder as given in the table below. Your task is to find the minimum such (n).

The remainders satisfy the following congruences: [ \begin{array}{|c|c|c|c|} \hline a & n \bmod a & a & n \bmod a \ \hline 2 & 1 & 14 & 11 \ 3 & 2 & 15 & 14 \ 4 & 1 & 16 & 9 \ 5 & 4 & 17 & 0 \ 6 & 5 & 18 & 11 \ 7 & 4 & 19 & 18 \ 8 & 1 & 20 & 9 \ 9 & 2 & 21 & 11 \ 10 & 9 & 22 & 11 \ 11 & 0 & 23 & 15 \ 12 & 5 & 24 & 17 \ 13 & 10 & 25 & 9 \ \hline \end{array} \quad \begin{array}{|c|c|c|c|} \hline a & n \bmod a & a & n \bmod a \ \hline 26 & 23 & 38 & 37 \ 27 & 20 & 39 & 23 \ 28 & 25 & 40 & 9 \ 29 & 16 & 41 & 1 \ 30 & 29 & 42 & 11 \ 31 & 27 & 43 & 11 \ 32 & 25 & 44 & 33 \ 33 & 11 & 45 & 29 \ 34 & 17 & 46 & 15 \ 35 & 4 & 47 & 5 \ 36 & 29 & 48 & 41 \ 37 & 22 & 49 & 46 \ \hline \end{array} ] A solution is guaranteed to exist and is unique within (n\le 10^{17}).

It is recommended to solve the problem with a step‐by‐step application of the (generalized) Chinese remainder theorem (CRT) by iteratively merging the congruences.

inputFormat

There is no input for this problem. All the conditions are fixed in the problem statement.

outputFormat

Output the minimum positive integer (n) (with (n \le 10^{17})) that satisfies all the given remainder conditions. Print the number followed by a newline.

sample

17283940529