☀️
EN
Home / Blog / Number Theory Notation in LaTeX: Primes, Modulo, and More

Number Theory Notation in LaTeX: Primes, Modulo, and More

2026-08-10 MathEditor Team
number-theoryreferenceintermediate

Number theory has specialized notation. Here's how to write it in LaTeX.

Divisibility and Modulo

Divisibility: a \\mid b. Not dividing: a \\nmid b. Modulo: a \\equiv b \\pmod{n}. GCD/LCM: \\gcd(a,b), \\operatorname{lcm}(a,b).

Prime Numbers

Prime notation: p \\in \\mathbb{P}. Prime counting function: \\pi(x). Fermat's little theorem: a^{p} \\equiv a \\pmod{p}.

Number Sets

Natural numbers: \\mathbb{N}. Integers: \\mathbb{Z}. Rationals: \\mathbb{Q}. Reals: \\mathbb{R}. Complex: \\mathbb{C}.

✏️ Try it now — open the MathEditor and experiment with these formulas!