Squarefree Divisor Count Calculator

Count the divisors of an integer that contain no squared prime, using two raised to the distinct prime count.

Math and PercentUpdated 2026-11-182 min read
Squarefree Divisor Count Calculator
A whole number from 1 to 1,000,000,000,000.
Squarefree divisors
...
Distinct prime factors...
Prime factorization...

What it does

A divisor is squarefree when no squared prime divides it. For 12 the divisors are 1, 2, 3, 4, 6 and 12, and only 1, 2, 3 and 6 qualify. The count is four, which happens to be two raised to the number of distinct primes, because the only primes involved are 2 and 3.

The rule is general. To build a squarefree divisor of n, look at each distinct prime in turn and decide whether to include it once or leave it out. Higher exponents on n are irrelevant, since a squarefree divisor can never use more than one copy of any prime.

This means the count depends only on small omega, the number of distinct prime factors. A number such as 8 has three copies of the prime 2 but only two squarefree divisors, namely 1 and 2. A number such as 30 has three distinct primes and therefore eight squarefree divisors.

The page factors the input, counts the distinct primes, raises two to that count and reports the result beside the factorization. The connection to unitary divisors is close: the number of unitary divisors and the number of squarefree divisors are always equal.

The input limit is one trillion. The result is a power of two and is printed as an exact integer.

How to use

  1. Enter a whole number n from 1 upward.
  2. Read the number of squarefree divisors in the main result box.
  3. Check the distinct prime count beside it.
  4. Use the factorization to confirm which primes are available.
  5. The default n = 12 reproduces the worked example.
  6. Try n = 30 to see eight squarefree divisors from three primes.

Formula

squarefree divisor count = 2^omega(n), where omega(n) is the number of distinct primes dividing n
n
The positive integer whose divisors are classified.
omega(n)
The number of distinct prime divisors of n.
2^omega(n)
The number of divisors with no repeated prime.

Each distinct prime contributes two options, include it once or omit it, so the total number of squarefree divisors follows the product rule. The case n = 1 has no primes and gives one divisor, namely 1 itself. The count ignores exponents greater than one.

Worked example

Example: divisors of 12

The page opens with n = 12.

  1. Factor 12 into 2^2 x 3.
  2. Count the distinct primes: 2 and 3, so omega(12) = 2.
  3. Raise two to that count: 2^2 = 4.
  4. List the squarefree divisors to check: 1, 2, 3 and 6.
  5. The tool reports 4 squarefree divisors, 2 distinct primes, and factorization 2^2 x 3.
  6. For 30 the distinct primes are 2, 3 and 5, giving 2^3 = 8 squarefree divisors.
  7. The two divisors of 12 left out are 4 and 12, since both contain a squared prime.

Reference table

Squarefree divisor counts
nFactorizationDistinct primesSquarefree divisors
1none01
82^312
122^2 x 324
302 x 3 x 538
362^2 x 3^224
2102 x 3 x 5 x 7416

Limits

  • Only positive divisors are considered.
  • Inputs above one trillion are rejected to keep factoring quick.
  • The tool gives a count and does not list the squarefree divisors.
  • Exponents greater than one are deliberately ignored by the formula.

Common mistakes

  • Using the total prime count with multiplicity instead of distinct primes.
  • Applying the formula to exponents as if they were choices.
  • Assuming every divisor of a squarefree number is not squarefree.
  • Counting 1 out because it has no prime factors.
  • Confusing this count with the number of unitary divisors when both happen to match.

Try it yourself

Quick checks. Answers sit tucked under each question.

How many squarefree divisors does 30 have?

30 has three distinct primes, so 2^3 = 8 squarefree divisors.

How many squarefree divisors does 8 have?

Only the prime 2 appears, so 2^1 = 2, namely 1 and 2.

How many squarefree divisors does 12 have?

Two distinct primes give 2^2 = 4 squarefree divisors.

Questions

What is a squarefree divisor?

A divisor with no squared prime factor, so each prime appears at most once.

Why does the answer use two as the base?

Each distinct prime offers two choices, include or omit, and the choices multiply.

Do repeated exponents change the count?

No. Only the number of distinct primes matters.

How does this compare with unitary divisors?

The two counts are equal for every integer, though the sets of divisors are defined differently.

What is the count for 1?

It is 1, because the only divisor is 1 and it is squarefree by convention.

What input limit applies?

Whole numbers through 1,000,000,000,000, with a clear error outside that range.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.