The totient is the arithmetic count that makes RSA exponents invert each other. For two primes, it is computed from the two one-less factors.

highlighted = computed this step

Why the totient matters

The private exponent is built modulo phi. For a product of two primes, phi comes directly from p minus one and q minus one.

ϕ=(pone)(qone)\phi=(p-\text{one})(q-\text{one})
Totient from the primesRSA key derivation recomputed from the toy primes and public exponent.Totient from the primes - n=55quantityvaluep5q11n=p*q55phi=(p-1)(q-1)40e3d=e^-1 mod phi27e*d mod phi1

Remove one from each prime

The factors are p minus one =4 and q minus one =10.

pone=4,qone=10p-\text{one}=4,\quad q-\text{one}=10
Totient from the primesRSA key derivation recomputed from the toy primes and public exponent.Totient from the primes - n=55quantityvaluep5q11n=p*q55phi=(p-1)(q-1)40e3d=e^-1 mod phi27e*d mod phi1

Compute phi

Multiplying those two factors gives phi=40, the modulus used for exponent inverses.

410=404\cdot10=40
Totient from the primesRSA key derivation recomputed from the toy primes and public exponent.Totient from the primes - n=55quantityvaluep5q11n=p*q55phi=(p-1)(q-1)40e3d=e^-1 mod phi27e*d mod phi1

Why this count is useful

As always, phi counts the residues with inverses modulo n. For this semiprime, that count is 4 times 10, which is 40.

ϕ=(pone)(qone)=40\phi=(p-\text{one})(q-\text{one})=40
Totient from the primesRSA key derivation recomputed from the toy primes and public exponent.Totient from the primes - n=55quantityvaluep5q11n=p*q55phi=(p-1)(q-1)40e3d=e^-1 mod phi27e*d mod phi1

Summary

The toy totient is phi=40. Exact arithmetic on deliberately tiny toy keys; real RSA uses 2048+ bit primes with padding, and timing/side-channels are not modeled here.

ϕ=40\phi=40
Totient from the primesRSA key derivation recomputed from the toy primes and public exponent.Totient from the primes - n=55quantityvaluep5q11n=p*q55phi=(p-1)(q-1)40e3d=e^-1 mod phi27e*d mod phi1