Skip to content

SquarePartRoot ​

The root ss of the square part of n=±s2qn=\pm s^2 q: the largest ss with s2s^2 dividing nn.

SquarePartRoot(n)ss in ∣n∣=s2q|n|=s^2 q with qq square-free; the largest ss whose square divides nn.
SageMathisqrt(abs(n)//abs(n).squarefree_part())
Typed signatures
TypePackageApplies
(integer) -> integernumber-theoryalways

Domain: Number theory

Details
  • Every nonzero integer is ±s2q\pm s^2 q for a unique s≥1s\ge1 and square-free q≥1q\ge1; this is ss, and SquareFreePart is qq. nn is square-free exactly when s=1s=1.
  • The sign is a unit, as in PrimeOmega: SquarePartRoot(−12)=2\mathrm{SquarePartRoot}(-12)=2. Defined on nonzero integers; 0 stays unevaluated.
  • Halves every exponent in the factorization of ∣n∣|n|, rounding down.

Plot

Examples

Basic #

12=22⋅312 = 2^2\cdot3

live ↗
InSquarePartRoot(12)\mathrm{SquarePartRoot}(12)Out22

360=62⋅10360 = 6^2\cdot10

live ↗
InSquarePartRoot(360)\mathrm{SquarePartRoot}(360)Out66

A square-free number has no square part: the root is 1

live ↗
InSquarePartRoot(30)\mathrm{SquarePartRoot}(30)Out11
live ↗
InSquarePartRoot(1)\mathrm{SquarePartRoot}(1)Out11
Scope #

Negative nn: the sign is a unit

live ↗
InSquarePartRoot(−12)\mathrm{SquarePartRoot}(-12)Out22

Listable over a list

live ↗
InSquarePartRoot([8,9,10])\mathrm{SquarePartRoot}(\bigl\lbrack8, 9, 10\bigr\rbrack)Out[2,3,1]\bigl\lbrack2, 3, 1\bigr\rbrack

Large integers: 10!=7202⋅710! = 720^2\cdot7

live ↗
InSquarePartRoot(10!)\mathrm{SquarePartRoot}(10!)Out720720
Applications #

A perfect square's root is its square root, 144=12\sqrt{144}=12

live ↗
InSquarePartRoot(144)\mathrm{SquarePartRoot}(144)Out1212

Simplifying 1000=1010\sqrt{1000}=10\sqrt{10}: the coefficient pulled out is ss

live ↗
InSquarePartRoot(1 000)\mathrm{SquarePartRoot}(1\,000)Out1010
Properties #

n=s2qn=s^2 q. See SquareFreePart

live ↗
In360=SquarePartRoot(360)2SquareFreePart(360)360=\mathrm{SquarePartRoot}(360)^2\mathrm{SquareFreePart}(360)OutTrue\mathrm{True}

nn is square-free exactly when s=1s=1. See IsSquareFree

live ↗
InSquarePartRoot(70)=1\mathrm{SquarePartRoot}(70)=1OutTrue\mathrm{True}
Possible issues #

Zero is outside the domain, so it stays unevaluated

live ↗
InSquarePartRoot(0)\mathrm{SquarePartRoot}(0)OutSquarePartRoot(0)\mathrm{SquarePartRoot}(0)
About
Examples12
Checked againstWolfram Language 11 agree1 differSageMath 11 agree1 error
CrosswalkOEISSageMath

Implementation

mappedwolframpackages/oracle/src/mappings.ts

Wolfram has no head for it; this is its definition over FactorInteger, with the sign of n a unit.

mappedsagepackages/oracle/src/mappings.ts

Sage has no head for it; s=n/qs=\sqrt{n/q} from its squarefree_part, reading |n|.

See also: SquareFreePart, IsSquareFree, FactorInteger, IntegerExponent