Congruence Relations

Jelly, 5 bytes

_ÆD⁵e

Making heavy use of Anything else that is not forbidden is allowed.

Try it online!

How it works

_ÆD⁵e  Main link. Left input: a. Right input: b. Additional input: n

_      Subtract b from a.
 ÆD    Compute all divisors of the difference.
   ⁵e  Test if n is among the divisors.

Python 2, 27 bytes

lambda a,b,n:(a-b)/n*n==a-b

Checks if a-b is a multiple of n by dividing by n, which automatically floors, and seeing if multiplying back by n gives the same result.


Julia, 24 bytes

f(a,b,n,t=a-b)=t÷n==t/n

This is a function that accepts three integers and returns a boolean.

We simply test whether a - b integer divded by n is equal to a - b float divided by n. This will be true when there is no remainder from division, i.e. a - b | n, which implies that a - b (mod n) = 0.