# solve_congruence function

Solve a congruence for a variable.

## How to write it

### solve_congruence(equation, x, m)

**equation**

The congruence to solve. Takes an equation.

**x**

The variable to solve for. Takes a variable.

**m**

The modulus. Takes a whole number.

## Examples

- $\displaystyle \operatorname{solve\_congruence}(3 x = 1, x, 7) \Rightarrow \left[ x = 5+7 C_{1} \right]$

  `solve_congruence(3 x = 1, x, 7)`

  In the solver, `solve_congruence(3 x = 1, x, 7)` gives `[x = 5 + 7C(1)]`.

  [Open in the solver](https://hilberon.com/?q=solve_congruence%283%20x%20%3D%201%2C%20x%2C%207%29)

## Related functions

- [squares_r](https://hilberon.com/library/squares_r)

  How many ways a whole number is a sum of a given count of squares, counting order and signs.
- [primitive_root](https://hilberon.com/library/primitive_root)

  A primitive root of a prime: a number whose powers cover all the nonzero residues.
- [stirling_s1](https://hilberon.com/library/stirling_s1)

  Stirling number of the first kind, with sign.
- [prime_pi](https://hilberon.com/library/prime_pi)

  How many primes are at most a number.
- [stirling_s2](https://hilberon.com/library/stirling_s2)

  Stirling number of the second kind: the ways to split n items into k groups.
- [prime_omega](https://hilberon.com/library/prime_omega)

  How many primes divide a whole number, counted with multiplicity.

---
Source: https://hilberon.com/library/solve_congruence
