Decimal numbers are written in base 10:
For an arbitrary base
The notation
A number is divisible by 3 if the sum of its digits is divisible by 3.
A number is divisible by 4 if the last 2 digits are divisible by 4.
A number is divisible by 5 if the last digit is divisible by 5.
A number is divisible by 8 if the last 3 digits are divisible by 8.
A number is divisible by 9 if the sum of the digits is divisible by 9.
A number is divisible by 11 if the sum of digits with alternating signs is divisible by 11.
To test a large number
Then, choose an
Set up iteration
The division algorithm (or Euclid's division lemma) states that for any pair of integers
Where
From the division algorithm, a number
Two numbers
For
Note that generally division does not work. But, if
A linear congruence is an equation of the form
The conditions for solutions are:
To find a solution
The fundamental theorem of arithmetic states that every integer greater than 1 is either prime or a unique product of primes.
A pair of integers are coprime if they have no common factors other than 1.
Euclid's lemma states that:
An integer combination of integers
Because
If
These two results give us:
Two integers
The highest common factor of
Footnote on solving linear congruences
Once you have one solution
Footnote on finding highest common factor using
No proof provided, but its kinda obvious?