Variables, equations, and powers all describe how to combine numbers. This lesson goes one level deeper, into the numbers themselves — divisibility, factors, and prime numbers. It reads like grade-school material, and that’s exactly the trap: prime numbers are the actual reason factoring a large number back apart is nearly impossible, and that single fact is what modern cryptography is built on.
Divisibility and factors
A number is divisible by when dividing one by the other leaves no remainder:
The notation reads as ” divides ”; a slash through the bar, , reads as ” does not divide .” Whenever divides cleanly, is called a factor of — so has factors , since each of those divides it with nothing left over.
Prime numbers
A prime number is a whole number greater than with exactly two factors: and itself. Anything with more factors than that is composite.
is worth a second look — it’s the only even prime, since every other even number automatically has as a third factor. And isn’t prime or composite at all; it only has one factor, itself, which puts it in a category of its own. The primes keep going forever:
The fundamental theorem of arithmetic
Every whole number greater than breaks down into primes, and only one such breakdown exists — no matter which factor you pull out first, the pieces you end up with are always the same. Take :
This is why primes get called the building blocks of arithmetic — every other whole number is just a specific combination of them, and that combination is unique. It’s also exactly why gets excluded from the primes: if it counted, you could pad any factorization with as many extra s as you wanted, and “the one unique breakdown” would stop meaning anything.
Why this makes cryptography possible
Give someone and ask for its prime factors, and a quick search finds the answer: not divisible by , , or , but , and is prime. So — a few seconds of work.
Now stretch that same number out to hundreds of digits, and the multiplication stays just as easy, while recovering the original two primes becomes infeasible even for the most powerful computers that exist — not slow, but practically unreachable within any human timescale. This gap, called the integer factorization problem, is a one-way function: trivial in one direction, and effectively irreversible in the other. That asymmetry is the whole foundation cryptographic security rests on.
Where this shows up inside a real circuit
Circom’s default curve, BN254, is built around one enormous prime:
254 bits long, and prime. Used by Circom, snarkjs, and most Groth16 toolchains.
Every signal in a Circom circuit — every constraint, every intermediate value — is a number somewhere in , and every arithmetic operation happens inside that range. Using a prime for isn’t incidental: it’s exactly the property this lesson covered, carried into a circuit at full scale, and it’s what keeps that arithmetic well-behaved instead of leaking structure an attacker could exploit.
That range — arithmetic that lives inside and wraps instead of growing forever — is modular arithmetic, and it’s the very next topic in this track.