# Find 'n' in modulo equation

#### Albert

##### Well-known member
$n\in N$

$\text{and }(n^3 +2)\,\mod\,(2n+1)=0$

$\text{please find }n$

Last edited by a moderator:

#### topsquark

##### Well-known member
MHB Math Helper
$n\in N$

$and \,\, (n^3 +2) \,\, mod \,\, (2n+1)=0$

$please \,\, find \,\, n$
Well n = 1 by inspection.

-Dan

#### Bacterius

##### Well-known member
MHB Math Helper
Let $2n + 1 = p$. Then:

$$n^3 + 2 \equiv \left [ 2^{-1} (p - 1) \right ]^3 + 2 \equiv 2 - 2^{-3} \pmod{p}$$

Thus, to satisfy your condition, we require:

$$2^{-3} \equiv 2 \pmod{p} ~ ~ \implies ~ ~ 2^{-4} \equiv 1 \pmod{p} ~ ~ \implies 2^4 \equiv 16 \equiv 1 \pmod{p}$$

Therefore the only solutions for $p$ are $\{1, 3, 5, 15\}$, which translate to $n = \{0, 1, 2, 7\}$.

May be verified experimentally:

Code:
>>> for n in range(10000):
...     p = 2 * n + 1
...     r = (pow(n, 3, p) + 2) % p
...     if r == 0:
...             print(n)
...
0
1
2
7
>>>

#### Albert

##### Well-known member
Bacterius:
your answer : n=0,1,2,7
but here n is a positive integer number so n=0 should be deleted

Albert

#### MarkFL

##### Administrator
Staff member
I believe some definitions of $\mathbb{N}$ include zero, but most do not.

#### Albert

##### Well-known member
$\text{here is my solution: for }\,n^3+2\,\mod\,2n+1=0$
$\text{we have }\,8n^3+16\,\mod\,2n+1=0$
$\text{but }\,8n^3+16\,\mod\,2n+1=15$
$\therefore\,15\,\mod\,2n+1=0$
$\text{and }\,n=\begin{Bmatrix} 1,2,7 \end{Bmatrix}$

Last edited:

#### MarkFL

##### Administrator
Staff member
Albert,

Just a LaTeX tip...to include text within your code, so that it is not italicized like the variables are, use the \text{} command, e.g., \text{insert text here}. Leave everything else outside of the braces.

#### Bacterius

##### Well-known member
MHB Math Helper
Bacterius:
your answer : n=0,1,2,7
but here n is a positive integer number so n=0 should be deleted

Albert
Your definition of $\mathbb{N}$ was unclear, thus I conservatively included $n = 0$.