Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have:
\begin{align*} N &\equiv 1 &\pmod{2}\\ N &\equiv 2 &\pmod{3}\\ N &\equiv 3 &\pmod{4}\\ &\vdots\\ N &\equiv n - 1 &\pmod{n} \end{align*} How could I solve for $N$? Is there any property relates to this problem?

Base on Moron hint, we have:
\begin{align*} N + 1 &\equiv 0 &\pmod{2}\\ N + 1 &\equiv 0 &\pmod{3}\\ N + 1 &\equiv 0 &\pmod{4}\\ \vdots\\ N + 1 &\equiv 0 &\pmod{n} \end{align*} Hence, $$N + 1 \equiv 0 \pmod{\mathrm{lcm}(2\cdot 3\cdots n}$$

$$\therefore N + 1 = lcm(2.3.4...n) * k \text{ for some integers k } $$ $$\implies N = lcm(2.3.4...n) * k - 1$$

Does it look right?


share|cite|improve this question
$N = k \times \text{lcm}(1,2,\ldots,n)-1$ where $k \in \mathbb{Z}$ – user17762 Feb 28 '11 at 0:04
@Sivaram Ambikasaran: Thanks, but could you explain how it works? I know there is a property for $\pmod{lcm}$, but in this case the right hand side parts are different. It goes from 1 -> n - 1. – Chan Feb 28 '11 at 0:08
@Qiaochu Yuan: Thanks for the link – Chan Feb 28 '11 at 0:10
@Chan: As Qiaochu points out this is nothing but a special case of Chinese Remainder Theorem. your $N \equiv -1 \bmod m$, $\forall m \in \{1,2,\ldots,n\}$ – user17762 Feb 28 '11 at 0:11
up vote 4 down vote accepted

Hint: Consider the possible values for $N+1$.

share|cite|improve this answer
I got it ;) So simple. Many thanks. – Chan Feb 28 '11 at 0:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.