suppose K is a fixed integer, P is a fixed prime number, can we always find an integer n to make $\frac{np+1}{k}$ an integer?
Asked
Active
Viewed 60 times
3 Answers
3
So you need $np+1$ to be divisible by $k$, which means $np\equiv-1 \mod(k)$.
Now, if you let $N = -n$, we have $Np \equiv 1 \mod(k)$.
By Euler's Theorem, there exists a solution $N$ to this equation when $p$ and $k$ are relatively prime.
This solution $N$ is called the multiplicative modular inverse of $p$ modulo $k$.
So, as long as $k$ is not $p$, you have a solution.

Saketh Malyala
- 13,637
-
@ Saketh Malyala When *k = 1*, why can't $\frac{np+1}{k}$ be an integer? – 19aksh May 03 '19 at 08:21
-
yeah, k can be 1 – Jonny May 03 '19 at 21:13
-
and k cannot be -p ? – Jonny May 03 '19 at 21:14
-
1it cannot be -p either. in addition, k cannot be a multiple of p either – Saketh Malyala May 03 '19 at 21:18
0
Note $\,\exists x\!:\ k\mid px+1\iff \exists x,y\!:\ ky - px = 1\iff \gcd(k,p)=1,\,$ by Bezout
If so then $\,x \equiv -p^{-1}\pmod{\!k},\,$ which is computable by the Extended Euclidean algorithm, or by Gauss's algorithm. if $\,p\,$ or $\,k\,$ is prime.

Bill Dubuque
- 272,048