0
$\begingroup$

I'm trying to solve the following equation: $7x\equiv5 \pmod {256}$

My attempt:

$7x\equiv5 \pmod {256}$
$7x-5=256y$
$7x-256y=5$

Next, find the $gcd(7,256)$

$256=36*7+4$
$7=1*4+3$
$4=1*3+1$
$3=1*3 \Longrightarrow gcd(7,256)=1$

Then, find $x$ and $y$ in $7x-256y=5$

$1=4-3$
$1=256-36*7-(7-4)$
$1=256-36*7-7+(256-36*7)$
$1=256-37*7+256-36*7$
$1=7*(-73)+256*2$
$5=7*(-365)+256*10 \Longrightarrow x_0=-365, y_0=10$

Therefore, the solution to the Diophantine equation is $\begin{equation} \begin{cases} x=-365+n*\frac{-256}{1}=-256n-365\\ y=10-n*\frac{7}{1}=10-7n \end{cases} \end{equation}$

Which in turn means that the solution to $7x\equiv5 \pmod {256}$ is
$-256n-365, n\in \mathbb{Z}$. But my answer sheet and WolframAlpha give the solution $x=256n+147$. What am I missing?

  • 0
    Remember that all that matters is that the solution sets are the same. What happens if you let $m=-n-2$ in your formula?2017-01-01
  • 0
    Did you check your answer? $-365\equiv 147\pmod {256}$ so your answer is the same as the given one.2017-01-01
  • 0
    I think you have mistake here 1=7∗(−37)+256∗22017-01-01
  • 0
    @lulu Of course, I should've seen that. You can make that an answer.2017-01-01
  • 0
    @KanwaljitSingh Sorry, that was a typo. I've corrected it now2017-01-01

1 Answers 1

1

we have to solve $$7x\equiv 5 \mod 256$$ this is equivalent to $$x\equiv \frac{5}{7}\mod 256$$ and then we have $$x\equiv \frac{5+256+256+256+256}{7}=\frac{1029}{7}=147 \mod 256$$ thus we have $$x=147+256k$$ with $$\ k\in \mathbb{Z}$$