AFTD Auto-Formalizing Theoretical Domains

derangements_no_two_cycles_count

def

For a natural number n, derangements_no_two_cycles_count n is the number of permutations of Fin n that have no cycles of length 1 and no cycles of length 2.

Statement

def derangements_no_two_cycles_count (n : ℕ) : ℕ
Defined in
scout/2610-40342-a-p-adic-valuation-calculus-for-permutations-with-restricte.md:1608
Verified
07 Nov 2026
Axioms
none listed
Built on 1
  • restricted_cycle_perms_countFor a natural number n and a finite set S of natural numbers, the number of permutations σ of Fin n such that for every element x of Fin…
Used by 4

Read back from the Lean

The function derangements_no_two_cycles_count takes a natural number $n$ and returns the number of permutations $\sigma$ of $\mathrm{Fin}(n)$ such that for every element $x \in \mathrm{Fin}(n)$, the length of the cycle containing $x$ under $\sigma$ is neither $1$ nor $2$ (that is, permutations of an $n$-element set with no fixed points and no $2$-cycles).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Number of derangements of Fin n having no 2-cycles, i.e. permutations avoiding cycle lengths 1 and 2. -/
def derangements_no_two_cycles_count (n : ℕ) : ℕ := restricted_cycle_perms_count n {1, 2}
See it in the graphDiscuss this resultChallenge it