# Thread: Need help with 3 homework quesions

1. ## Need help with 3 homework quesions

Here are my 3 problems:

Prove or disprove that (n^2)-1 is composite whenever n is a positive integer greater than 1
Prove that (a mod m)(b mod m) mod m = ab mod m for all integers a and b whenever m is a positive integer.
Prove or disprove that a mod m + b mod m = (a + b) mod m for all integers a and b whenever m is a positive integer.

Help to Any of these would be appreciated..

thanks

2. Code:
n^2-1
Composite
Notice that, $\displaystyle n^2-1=(n-1)(n+1)$ can be factored, thus it is not prime i.e. composite.
Unless, the factors are trivial, meaning that $\displaystyle n-1=1$ thus, $\displaystyle n=2$ is the only prime. Thus, $\displaystyle 2^2-1=3$ is the only prime obtained by this function.

3. Prove that (a mod m)(b mod m) mod m = ab mod m for all integers a and b whenever m is a positive integer.
Let

$\displaystyle a=k_1\times m +c_1,\ c_1 \in \{0, \dots m-1\}$,

and:

$\displaystyle b=k_2\times m +c_2,\ c_2 \in \{0, \dots m-1\}$.

Then:

$\displaystyle (a\mod m)(b\mod m) \equiv c_1c_2 \mod m$

But

$\displaystyle ab \mod m=\{k_1k_2 m^2 + (k_1c_2+c1k_2)m+c_1c_2\}\mod m$$\displaystyle =c_1c_2 \mod m$.

Hence:

$\displaystyle (a \mod m)(b \mod m) \mod m = ab \mod m$

RonL