Euler's totient function
Content created by Egbert Rijke, Fredrik Bakke and Jonathan Prieto-Cubides
Created on 2022-03-09.
Last modified on 2023-04-08.
module elementary-number-theory.eulers-totient-function where
Imports
open import elementary-number-theory.natural-numbers open import elementary-number-theory.relatively-prime-natural-numbers open import elementary-number-theory.sums-of-natural-numbers open import foundation.coproduct-types open import foundation.decidable-types
Idea
Euler's totient function φ : ℕ → ℕ
is the function that maps a natural number
n
to the number of x < n
that are relatively prime with n
.
Definition
eulers-totient-function : ℕ → ℕ eulers-totient-function n = bounded-sum-ℕ n (λ x H → α x) where α' : (x : ℕ) → is-decidable (is-relatively-prime-ℕ x n) → ℕ α' x (inl H) = 1 α' x (inr H) = 0 α : ℕ → ℕ α x = α' x (is-decidable-is-relatively-prime-ℕ x n)
Recent changes
- 2023-04-08. Egbert Rijke. Refactoring elementary number theory files (#546).
- 2023-03-13. Jonathan Prieto-Cubides. More maintenance (#506).
- 2023-03-10. Fredrik Bakke. Additions to
fix-import
(#497). - 2023-03-07. Fredrik Bakke. Add blank lines between
<details>
tags and markdown syntax (#490). - 2023-03-07. Jonathan Prieto-Cubides. Show module declarations (#488).