Definition pfactor p e := p ^ e.Definition cons_pfactor (p e : nat) pd := ifnz e ((p, e) :: pd) pd.Notation "n `_ pi" := (partn n pi) : nat_scope.Definition primes n := unzip1 (prime_decomp n).Definition nat_pred := simpl_pred nat.Definition pi_unwrapped_arg := nat.Definition pi_wrapped_arg := wrapped nat.Coercion unwrap_pi_arg (wa : pi_wrapped_arg) : pi_unwrapped_arg := unwrap wa.Coercion pi_arg_of_nat (n : nat) := Wrap n : pi_wrapped_arg.Definition pdiv n := head 1 (primes n).Definition max_pdiv n := last 1 (primes n).Definition totient n := foldr add_totient_factor (n > 0) (prime_decomp n).

Lemma primes_uniq n : uniq (primes n).