Algosim documentation: IsSquareFree

IsSquareFree

Tests if an integer isn’t divisible by a prime square.

Syntax

Description

If n is an integer, then IsSquareFree(n) returns true iff n is a square-free integer. An integer is square-free if it isn’t divisible by any square of a prime number. Equivalently, it is square-free if it isn’t divisible by any perfect square other than 1.

Hence, the prime factorisation of a positive square-free integer contains only primes with multiplicity one, i.e. the integer is equal to its radical. Conversely, if a positive integer is equal to its radical, it is square-free.

Examples

filter(SequenceVector(30), IsSquareFree)
(1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30)
count(SequenceVector(1000), IsSquareFree)
608

See also