# Find intersection of several intervals mathematically

I have 3 intervals :

$I = \{1, 4, 7, 10, 13, 16, 19, ...\}$ defined by $1 + 3k$, $k \in \mathbb{N}$

$J = \{1, 5, 9, 13, 17, 21, 25, ...\}$ defined by $1 + 4k$, $k \in \mathbb{N}$

$K = \{1, 6, 11, 16, 21, 26, 31, ...\}$ defined by $1 + 5k$, $k \in \mathbb{N}$

And I have to find numbers common for the 3 intervals. So, I made an algorithm to find them, which is working fine. But I wonder if it is possible to find these numbers by mathematical way ?

I tried to draw these intervals as straight line and to find intersection points of these lines, but, of course, it's not working and I don't have any other idea.

• Just a short hint: Think about remainders and modular arithmetic. $3$, $4$ and $5$ are pairwise coprime, meaning that no two of them share a prime factor. Observe that $3 \cdot 4 = 12$, and $I \cap J = \{ 1, 13, 25, \ldots \}$.
– m_l
Jul 29, 2013 at 7:31
• You can actually find some numbers in the intersection easily and make a guess. Then, go check the Chinese Remainder Theorem at en.wikipedia.org/wiki/Chinese_remainder_theorem Jul 29, 2013 at 7:33
• The math behind this is the Chinese Remainder Theorem Jul 29, 2013 at 7:34
• Those aren't intervals. Jul 29, 2013 at 7:36
• Thanks for the Chinese remainder theorem. It helps me a lot. Jul 29, 2013 at 7:48

All the numbers $1 + 60k$, $k \in \mathbb{N}$
• It should be $1+60k$ ($k\in \mathbb{N}$). And $60 = 3\times 4 \times 5$. Jul 29, 2013 at 7:55