SquareFreeQ
✖
SquareFreeQ
Details and Options

- SquareFreeQ is typically used to test whether a number or a polynomial is square free.
- An integer n is square free if it is divisible by no perfect square other than 1.
- SquareFreeQ[expr] returns False unless expr is manifestly square free.
- With the setting GaussianIntegers->True, SquareFreeQ tests whether expr is Gaussian square free.
- For integers m and n, SquareFreeQ[m+I n] automatically works over Gaussian integers.
- The following options can be given:
-
GaussianIntegers Automatic whether to allow Gaussian integers Modulus 0 modulus for polynomial coefficients

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (5)Survey of the scope of standard use cases
SquareFreeQ works over integers:

https://wolfram.com/xid/0d6d8g8g1f-rme16t


https://wolfram.com/xid/0d6d8g8g1f-lfc27m


https://wolfram.com/xid/0d6d8g8g1f-1kr17a


https://wolfram.com/xid/0d6d8g8g1f-wu79y6


https://wolfram.com/xid/0d6d8g8g1f-kfw85e


https://wolfram.com/xid/0d6d8g8g1f-8xg5ug

Specify the variable in a polynomial:

https://wolfram.com/xid/0d6d8g8g1f-27s9gz


https://wolfram.com/xid/0d6d8g8g1f-dipf6m

Polynomials over a finite field:

https://wolfram.com/xid/0d6d8g8g1f-gdwau


https://wolfram.com/xid/0d6d8g8g1f-1cuxzp

Options (2)Common values & functionality for each option
GaussianIntegers (1)
Applications (8)Sample problems that can be solved with this function
Basic Applications (3)
Highlight square-free numbers:

https://wolfram.com/xid/0d6d8g8g1f-dpsqd1

Generate random square-free integers:

https://wolfram.com/xid/0d6d8g8g1f-s7dgp

https://wolfram.com/xid/0d6d8g8g1f-bqtx35


https://wolfram.com/xid/0d6d8g8g1f-vjnd2

Square-free Gaussian integers:

https://wolfram.com/xid/0d6d8g8g1f-y8p5c

Number Theory (5)
The central binomial coefficients Binomial[2n,n] are not square free for :

https://wolfram.com/xid/0d6d8g8g1f-dwydb7

Find the fraction of the first numbers that are square free:

https://wolfram.com/xid/0d6d8g8g1f-5atbur


https://wolfram.com/xid/0d6d8g8g1f-ge9z9w

The polynomial p[x]/PolynomialGCD[p[x],p'[x]] is always square free:

https://wolfram.com/xid/0d6d8g8g1f-dx1xo6

https://wolfram.com/xid/0d6d8g8g1f-bntzft


https://wolfram.com/xid/0d6d8g8g1f-1b1jqr

The distribution of square-free numbers over integers:

https://wolfram.com/xid/0d6d8g8g1f-hi0e4n

https://wolfram.com/xid/0d6d8g8g1f-iul1cx

https://wolfram.com/xid/0d6d8g8g1f-d4lpp

The distribution of square-free numbers over the Gaussian integers:

https://wolfram.com/xid/0d6d8g8g1f-9om2p7

https://wolfram.com/xid/0d6d8g8g1f-1ullvw

https://wolfram.com/xid/0d6d8g8g1f-jrlfrw

Properties & Relations (8)Properties of the function, and connections to other functions
A number that is divisible by a square is not square free:

https://wolfram.com/xid/0d6d8g8g1f-d29ykm


https://wolfram.com/xid/0d6d8g8g1f-1rmlvd

In the prime factorization of a square-free number, the exponents of primes are all 1:

https://wolfram.com/xid/0d6d8g8g1f-c5x9z


https://wolfram.com/xid/0d6d8g8g1f-m1yhtl

PrimeNu is equal to PrimeOmega for square-free numbers:

https://wolfram.com/xid/0d6d8g8g1f-dxtjw6


https://wolfram.com/xid/0d6d8g8g1f-cwp7f3

MoebiusMu is zero for non-square-free integers:

https://wolfram.com/xid/0d6d8g8g1f-ibqbqf


https://wolfram.com/xid/0d6d8g8g1f-ncxg8e

Numbers that are prime powers and square free are prime numbers:

https://wolfram.com/xid/0d6d8g8g1f-8pn4ph


https://wolfram.com/xid/0d6d8g8g1f-jr9o01

The discriminant of a quadratic non-square-free polynomial is 0:

https://wolfram.com/xid/0d6d8g8g1f-b2ce5w


https://wolfram.com/xid/0d6d8g8g1f-bm1bsn

Square factors can be found using FactorSquareFreeList:

https://wolfram.com/xid/0d6d8g8g1f-ef7qfk


https://wolfram.com/xid/0d6d8g8g1f-ipkc0i

Simplify symbolic expressions:

https://wolfram.com/xid/0d6d8g8g1f-ob9vuq

Neat Examples (3)Surprising or curious use cases
Plot the prime numbers that are the sum of three squares:

https://wolfram.com/xid/0d6d8g8g1f-h7zwj2

Square-free Gaussian integers:

https://wolfram.com/xid/0d6d8g8g1f-epjx15

Plot the Ulam spiral of square-free numbers:

https://wolfram.com/xid/0d6d8g8g1f-qu5xoh

https://wolfram.com/xid/0d6d8g8g1f-fph21d

Wolfram Research (2007), SquareFreeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SquareFreeQ.html.
Text
Wolfram Research (2007), SquareFreeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SquareFreeQ.html.
Wolfram Research (2007), SquareFreeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SquareFreeQ.html.
CMS
Wolfram Language. 2007. "SquareFreeQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SquareFreeQ.html.
Wolfram Language. 2007. "SquareFreeQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SquareFreeQ.html.
APA
Wolfram Language. (2007). SquareFreeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SquareFreeQ.html
Wolfram Language. (2007). SquareFreeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SquareFreeQ.html
BibTeX
@misc{reference.wolfram_2025_squarefreeq, author="Wolfram Research", title="{SquareFreeQ}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/SquareFreeQ.html}", note=[Accessed: 27-February-2025
]}
BibLaTeX
@online{reference.wolfram_2025_squarefreeq, organization={Wolfram Research}, title={SquareFreeQ}, year={2007}, url={https://reference.wolfram.com/language/ref/SquareFreeQ.html}, note=[Accessed: 27-February-2025
]}