n.squarefreePart
is the unique a₀ : ℕ
such that a₀
is squarefree and n = a₀ * b ^ 2
,
for some b : ℕ
. At 0
this property is not well defined because b
must be 0
and a₀
can be
any squarefree number; we give the junk value 1
at n = 0
following the convention that the
squarefree part of any square is 1
.
Equations
- n.squarefreePart = n.factorization.prod fun (p e : ℕ) => p ^ (e % 2)
Instances For
If n
is squarefree, then its squarefree part is itself.
The squarefree part of any square is 1
.
If $n = \prod_p p^{e_p}$ is the prime factorization of $n$, then $\prod_p p^{e_p \pmod{2}}$ is the prime factorization of the squarefree part of $n$.
The square part is the value of b ^ 2
in the squarefree decomposition of n = a₀ * b ^ 2
.
Equations
- n.squarePart = n / n.squarefreePart
Instances For
The squarefree decomposition of a natural number.