A positive integer is divisible by $3$ iff 3 divides the sum of its digits I am having trouble proving the two following questions: 


*

*If $p|N$, $q|N$ and gcd(p,q)=1, then prove that $pq|N$

*If $x$ is non zero positive integer number, then prove that $3|x$ if and only if 3 divides the sum of all digits of $x$.
For both questions I tried to use theorems of discrete mathematics, but I could not find the way to solve them.

Here is an explanation of number 2. We will use a corollary from a theorem (both taken from Rosen's Discrete Mathematics text.

Theorem: Let $m$ be a positive integer. If $a\equiv b \text{ mod } m$ and $c\equiv d \text{ mod } m,$ then
  $$
a+c \equiv b+d \text{ mod } m \qquad\text{and}\qquad ac \equiv bd \text{ mod } m.
$$

From this theorem we get this corollary

Corollary: Let $m$ be a positive integer and let $a$ and $b$ be integers. Then
  $$
(a+b) \text{ mod } m = ((a \text{ mod } m) + (b \text{ mod } m)) \text{ mod } m
$$
  and
  $$
ab \text{ mod } m = ((a \text{ mod } m)(b \text{ mod } m)) \text{ mod } m.
$$

Note that "$\equiv$" is used to indicate congruence, while "=" is used to indicate equality. 
The problem says: If $x$ is a non zero positive integer number, then prove that $3|x$ if and only if $3$ divides the sum of all digits of $x$.
We can represent $x$ as sum like so
$$
\begin{aligned}
x &= a_n\cdot 10^n + a_{n-1}\cdot 10^{n-1} + \cdots + a_1\cdot 10^{1} + a_0\cdot 10^0\\
&= \sum_{k=0}^n a_k10^k,
\end{aligned}
$$
where $a_0$ is in the ones place in $x$, $a_1$ is in the tens place in $x$, $a_2$ is in the hundreds place in $x$, etc $\dots$ Note that $3|x$ implies that $0 = x\text{ mod } 3.$ Then,
$$
\begin{aligned}
0 &= x\text{ mod } 3\\
&=\left(\sum_{k=0}^na_k10^k\right)\text{ mod } 3 &&\text{substitute}\\
&=\left(\sum_{k=0}^n(a_k10^k\text{ mod } 3)\right)\text{ mod } 3 &&\text{ by corollary}\\
&=\left(\sum_{k=0}^n([(a_k\text{ mod } 3)(10^k\text{ mod } 3)]\text{ mod } 3)\right)\text{ mod } 3 &&\text{ by corollary}\\
&=\left(\sum_{k=0}^n([(a_k\text{ mod } 3)(1\text{ mod } 3)]\text{ mod } 3)\right)\text{ mod } 3 &&1 \equiv 10^k\text{ mod }3\\
&=\left(\sum_{k=0}^n(a_k\text{ mod } 3)\right)\text{ mod } 3 &&(a_k)(1)=a_k\text{ and  corollary}\\
&=\left(\sum_{k=0}^na_k\right)\text{ mod } 3 &&\text{by corollary.}\\
\end{aligned}
$$
The last equality states
$$
0 = \left(\sum_{k=0}^n a_k\right)\text{ mod }3,
$$
which proves that $3$ divides the sum of all digits of $x$. To prove the other direction (if $3$ divides the sum of all digits of $x$, then $3|x$) just use the same equalities, but start at the bottom and work your way to the top.
