\documentclass{beamer} 



\useheadtemplate{% 
\vbox{% 
\vskip3pt% 
\colouredline{structure!75}{}%
{\color{structure!75}{}}% 
\insertvrule{0.4pt}{structure!50}% 
}} 

\usefoottemplate{% 
\vbox{% 
\colouredline{structure!75}% 
{\color{white}\textbf{ \insertshortinstitute}\hfill\textbf{\inserttitle}\hfill\insertpagenumber}% 
}} 

\usepackage{geometry}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{etex}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,snakes}
\usepackage[all]{xy}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[all]{xy}
\usepackage{geometry}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{multirow}




\beamerboxesdeclarecolorscheme{alert}{structure!75}{blue!15!averagebackgroundcolor}
\beamerboxesdeclarecolorscheme{alert2}{structure!75}{blue!5!averagebackgroundcolor}
\beamerboxesdeclarecolorscheme{alert3}{}{blue!15!averagebackgroundcolor}


\begin{document} 

\frame[plain]{
\begin{center}
{\color{blue}\Huge \bf Chinese Remainder Clock}\\


\def\triangle{6cm}
\def\square{8cm}
\def\pentagon{10cm}
\def\octagon{3cm}
\def\trianglehour{1cm}
\def\squarehour{3cm}
\begin{figure}[!hbtp]

\begin{center}
\begin{tikzpicture}[scale=0.3]
\draw[color=blue!50] (0,0) circle (\squarehour);
\foreach \x in {1,2,...,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (90*\x :\squarehour) {}; \shade[shading=radial, inner color=blue!15, outer color=blue!85] (-90 :\squarehour) circle (0.65);};

\draw[color=green!50] (0,0) circle (\trianglehour);
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (120*\x-30 :\trianglehour) {}; \shade[shading=radial, inner color=green!15, outer color=green!85] (-30 :\trianglehour) circle (0.65);};

\draw[color=red!50] (0,0) circle (\pentagon);
\foreach \x in {1,2,...,5} {\node[circle,draw=red!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at  (72*\x+18:\pentagon)  {}; \shade[shading=radial, inner color=red!15, outer color=red!85] (-54 :\pentagon) circle (0.65);};

\draw[color=blue!50] (0,0) circle (\square);  
\foreach \x in {1,2,3,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (90*\x :\square) {}; \shade[shading=radial, inner color=blue!15, outer color=blue!85] (180 :\square) circle (0.65);};

\draw[color=green!50] (0,0) circle (\triangle);
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (120*\x-30 :\triangle) {}; \shade[shading=radial, inner color=green!15, outer color=green!85] (90 :\triangle) circle (0.65);};
\end{tikzpicture}
\end{center}
\end{figure}


\end{center}
}


\frame{
%\frametitle{}
{\bf \Large \color{blue} Hour: $3$-remainder and $4$-remainder}

\begin{tabular}{|c|ccc ccc ccc ccc |}
\hline
Number & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9   & 10 & 11 \\
\hline 
\textcolor{blue}{$3$-remainder} & \textcolor{blue}{0} & \textcolor{blue}{1} & \textcolor{blue}{2} & \textcolor{blue}{0} & \textcolor{blue}{1} &  \textcolor{blue}{2} & \textcolor{blue}{0} & \textcolor{blue}{1} & \textcolor{blue}{2} &  \textcolor{blue}{0} & \textcolor{blue}{1} & \textcolor{blue}{2} \\
\hline
\textcolor{blue}{$4$-remainder} & \textcolor{blue}{0} & \textcolor{blue}{1} & \textcolor{blue}{2} & \textcolor{blue}{3} & \textcolor{blue}{0} &  \textcolor{blue}{1} & \textcolor{blue}{2} & \textcolor{blue}{3} & \textcolor{blue}{0} &  \textcolor{blue}{1} & \textcolor{blue}{2} & \textcolor{blue}{3} \\
\hline
\end{tabular}
\bigskip

{\color{blue} \bf A number from $0$ to $11$ is uniquely determined by its $3$-remainder and $4$-remainder.}
\bigskip

For example:

$${\text{$3$-remainder}} =2\leadsto 2,5,{\color{black}\mathbf 8},11$$
$${\text{$4$-remainder}}=0\leadsto 0,4,{\color{black}\mathbf 8}$$
}


\frame{
{\bf \Large \color{blue} Chinese Remainder Clock: Hour}

Visualization of the $3$-remainder and the $4$-remainder:
\bigskip

\def\triangle{2.5cm}
\def\square{4cm}
\def\trianglehour{1cm}
\def\squarehour{3cm}


\begin{figure}[!hbtp]
\begin{tikzpicture}[scale=0.6]
\draw[color=green!50] (0,0) circle (\trianglehour);
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (120*\x-30 :\trianglehour) {}; \shade[shading=radial, inner color=green!15, outer color=green!85] (-30 :\trianglehour) circle (0.4);};
\draw[color=blue!50] (0,0) circle (\squarehour); \foreach \x in {1,2,3,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=12pt, fill=yellow!0] (1) at (90*\x :\squarehour) {}; \shade[shading=radial, inner color=blue!15, outer color=blue!85] (-90 :\squarehour) circle (0.4);};
\end{tikzpicture}
\qquad\quad
%
\begin{tikzpicture}[scale=0.6]
\draw[color=green!50] (0,0) circle (\trianglehour);
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=18pt, fill=yellow!0] (1) at (120*\x-30 :\trianglehour) {};};
\foreach \x in {0,1,2} {  \node[scale=0.5, scale=2] at (-120*\x+90 :\trianglehour) {\Large \x};};
    
\draw[color=blue!50] (0,0) circle (\squarehour); \foreach \x in {1,2,3,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=18pt, fill=yellow!0] (1) at (90*\x :\squarehour) {};};
\foreach \x in {0,1,2,3} {  \node[scale=0.5, scale=2] at (-90*\x+90 :\squarehour) {\Large \x};}
\end{tikzpicture}
\end{figure}

}


\frame{
{\bf \Large \color{blue} Hour: one first algorithm}

{We are looking for a number $X$ between $0$ und $11$.\\ Let $R_3$ and $R_4$ be the $3$-remainder and the $4$-remainder of $X$.}
\bigskip

\begin{itemize}
\item {\color{black}
$X$ is one of the following numbers:} $${\color{blue} R_4\qquad R_4+4 \qquad R_4+8}$$
\item {\color{black}
Divide these numbers by $3$ and choose the one whose $3$-remainder equals $R_3$.}
\end{itemize}
}


\frame{
{\bf \Large \color{blue} Hour: an alternative algorithm}

{We are looking for a number $X$ between $0$ und $11$.\\ Let $R_3$ and $R_4$ be the $3$-remainder and the $4$-remainder of $X$.}
\medskip



\begin{itemize}

\item {\color{blue}  $X$ is the $12$-remainder of the number }
$${\color{blue} 4 \cdot R_3 + 9 \cdot R_4}$$
\item This number has the correct remainders:
$${\color{black} 4 \cdot R_3 + 9 \cdot R_4= 3\cdot (R_3+ 3 \cdot R_4)+R_3}$$
$${\color{black} 4 \cdot R_3 + 9 \cdot R_4= 4\cdot (R_3+ 2 \cdot R_4)+R_4}$$

\item A number and its $12$-remainder have the same $3$-remainder and the same $4$-remainder.

\item The $12$-remainder is a number between $0$ and $11$. 

\end{itemize}
}



\frame{
{\bf \Large \color{blue} Chinese Remainder Clock: Minute (Second)}

Visualization of the $3$-remainder, $4$-remainder, and $5$-remainder:


\def\triangle{6cm}
\def\square{8cm}
\def\pentagon{10cm}
\def\octagon{3cm}
\def\trianglehour{1cm}
\def\squarehour{3cm}

\def\triangle{2cm}
\def\square{3cm}
\def\pentagon{4cm}

\begin{figure}[!hbtp]
\begin{tikzpicture}[scale=0.45]
\draw[color=red!50] (0,0) circle (\pentagon);  \foreach \x in {1,2,...,5} {\node[circle,draw=red!80, line width=0.5mm, inner sep=0pt,minimum size=10pt, fill=yellow!0] (1) at  (72*\x+18:\pentagon)  {}; \shade[shading=radial, inner color=red!15, outer color=red!85] (-54 :\pentagon) circle (0.4);};
  
\draw[color=blue!50] (0,0) circle (\square); \foreach \x in {1,2,3,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=10pt, fill=yellow!0] (1) at (90*\x :\square) {}; \shade[shading=radial, inner color=blue!15, outer color=blue!85] (180 :\square) circle (0.4);};

\draw[color=green!50] (0,0) circle (\triangle); 
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=10pt, fill=yellow!0] (1) at (120*\x-30 :\triangle) {}; \shade[shading=radial, inner color=green!15, outer color=green!85] (90 :\triangle) circle (0.4);};
\end{tikzpicture}
\qquad
\begin{tikzpicture}[scale=0.7]
\draw[color=red!50] (0,0) circle (\pentagon);  \foreach \x in {1,2,...,5} {\node[circle,draw=red!80, line width=0.5mm, inner sep=0pt,minimum size=18pt, fill=yellow!0] (1) at  (72*\x+18:\pentagon)  {};};
\foreach \x in {0,1,2,3,4} {  \node[scale=0.5, scale=2] at (-72*\x+90 :\pentagon) {\Large \x};}

  
\draw[color=blue!50] (0,0) circle (\square); \foreach \x in {1,2,3,4}{\node[circle,draw=blue!80, line width=0.5mm, inner sep=0pt,minimum size=18pt, fill=yellow!0] (1) at (90*\x :\square) {};};
\foreach \x in {0,1,2,3} {  \node[scale=0.5, scale=2] at (-90*\x+90 :\square) {\Large \x};}


\draw[color=green!50] (0,0) circle (\triangle); 
\foreach \x in {1,2,3} {\node[circle,draw=green!80, line width=0.5mm, inner sep=0pt,minimum size=18pt, fill=yellow!0] (1) at (120*\x-30 :\triangle) {};};
\foreach \x in {0,1,2} {  \node[scale=0.5, scale=2] at (-120*\x+90 :\triangle) {\Large \x};}
\end{tikzpicture}
\end{figure}

}

\frame{
{\bf \Large \color{blue} Minute (Second): one first algorithm}

\begin{itemize}
\item {\bf \color{blue} Even or odd:} \\
A number and its $4$-remainder have the same parity.
\medskip

\item {\bf \color{blue} Last digit:}\\
A number and its last digit have the same $5$-remainder.\smallskip

If we know the $5$-remainder of a number, and we know the parity of the number, then we know the last digit.
\medskip

\item {\bf \color{blue} Minute (Second):}\\ If we know the last digit, we have $6$ possibilities for the minute. We take the number in this list that has the correct $3$-remainder and $4$-remainder.
\end{itemize}

}



\frame{
{\bf \Large \color{blue} Minute (Second): an alternative algorithm}

{We are looking for a number $X$ between $0$ und $59$.\\
Let $R_3$, $R_4$ and $R_5$ be the $3$-remainder, $4$-remainder, and $5$-remainder of $X$.}


\medskip

\begin{itemize}
\item {\color{blue}
 $X$ is the $60$-remainder of the number}
$${\color{blue} 40 \cdot R_3 + 45 \cdot R_4 + 36 \cdot R_5}$$

Indeed, we can write this number as follows:

$$3\cdot(13 \cdot R_3 +15 \cdot R_4 +12 \cdot R_5)+ R_3$$
$$ 4\cdot(10 \cdot R_3 +11 \cdot R_4 +9 \cdot R_5)+ R_4$$
$$5\cdot(8 \cdot R_3 +9 \cdot R_4 +7 \cdot R_5)+ R_5$$


\end{itemize}
}



\frame{
{\bf \Large \color{blue} Chinese Remainder Theorem}


\begin{itemize}
\item Let {\color{blue} $M_1, M_2,\ldots, M_n$} be \emph{pairwise coprime} positive integers.\\
Call {\color{blue}$P$} their product.

\item If $M$ is any number in the above list, choose freely one $M$-remainder, i.e. a number between $0$ and $M-1$.

\item Among any {\color{black} $P$} consecutive integers, there is exactly one number that has the remainders that you have chosen.
\end{itemize}
\bigskip
\bigskip


We use this result as follows for the Chinese Remainder Clock:

\begin{center}
\begin{tabular} {ccc}
{\bf Hour} & $M_1=3$, $M_2=4$ & $P=12$\\
{\bf Minute (Second)} & $M_1=3$, $M_2=4$, $M_3=5$  & $P=60$\\
\end{tabular}
\end{center}

}


\frame{

\begin{center}
{\bf \Large \color{blue} Chinese Remainder Clock} by Antonella Perucca, 2014.\\
Free for personal use (and use in class for teachers/lecturers).\\

\bigskip
\bigskip

{\bf Reference:} \textit{The Chinese Remainder Clock}, The College Mathematics Journal, 2017, Vol. 48, No. 2, pp. 82-89.
\end{center}



}

\end{document}




