Função Totiente de Euler φ(n)

φ(n) = nº coprimos com n < n.
Created by
Renato Passos, Eng. de Software
Reviewed by
Renato Passos, Eng. de Software

Last updated: Apr 18, 2026

φ(n)
6

Formula

contagem de coprimos

About this calculator

The Euler's Totient Function φ(n) Calculator determines how many positive integers less than n are coprime to n, i.e., have greatest common divisor equal to 1. It is an essential tool in number theory, cryptography, and divisibility. The calculation iterates from 1 to n-1 checking the GCD between each number and n.

The function φ(n) is defined as φ(n) = n ∏_{p|n} (1 - 1/p), where p runs over the prime divisors of n. The calculator implements this factorization algorithm for efficiency. For example, φ(12) = 12 * (1-1/2) * (1-1/3) = 4, since the coprimes with 12 less than 12 are 1, 5, 7, and 11.

Use this calculator to check multiplicative properties of φ, solve congruence problems, or study RSA cryptography, where φ(n) is used to compute the private key. It is useful for math students, programmers, and digital security enthusiasts.

Caveats: φ(n) is multiplicative only for coprime numbers; do not confuse with Carmichael's totient function λ(n). Ensure n is a positive integer, and for n=1, φ(1)=1 by convention.

Frequently asked questions

What does it mean to be coprime?

Two numbers are coprime if their greatest common divisor is 1. For example, 8 and 15 are coprime because GCD(8,15)=1.

For prime n, what is φ(n)?

If n is prime, φ(n) = n-1, since all numbers from 1 to n-1 are coprime to n.

How is the totient function related to RSA?

In RSA, the private key is computed using φ(n), where n is the product of two primes. The decryption exponent is the modular inverse of the public exponent modulo φ(n).

Does the calculator work for large numbers?

Yes, as long as the number is a positive integer. For very large numbers, factorization may be slow, but the calculator uses efficient algorithms.

What if the result is 0?

φ(n) is never 0 for n≥1. If 0 appears, check that the input is valid and positive. For n=1, φ(1)=1.

Other Sequencias e Numeros calculators