ForHosting KIT · Math

Squarefree Number Checker

30 is squarefree because it factors as 2 × 3 × 5, each prime once, while 12 is not, since 2 squared divides it. Enter a positive whole number and get a clear yes or no with its reason. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

A squarefree number has no squared prime factor: every prime in its factorization occurs at most once. This checker gives a direct yes-or-no result for any positive integer within the published limit. When the number is not squarefree, it also reports a prime whose square divides the input, providing a compact, verifiable reason for the decision. The calculation is deterministic, runs without network access, and treats 1 as squarefree under the standard mathematical definition.

What squarefree means

A positive integer is squarefree when no prime number divides it more than once. Equivalently, there must be no prime p for which p squared divides the integer. For example, 30 is squarefree because its prime factorization is 2 × 3 × 5, with each prime appearing exactly once.

By contrast, 12 is not squarefree because its factorization is 2² × 3, so the square of 2 divides it. The number 1 is a useful edge case: its prime factorization is empty, so it contains no repeated prime and is therefore squarefree. This checker applies that definition directly.

An exact quotient proves why the input failed the test without requiring a complete prime factorization.

How the check is performed

The algorithm uses exact integer arithmetic and bounded trial division. It starts with the smallest prime factor candidate and examines possible factors in ascending order. Whenever a candidate divides the remaining value, the algorithm removes one copy and immediately checks whether the same candidate divides again.

A second division means that the candidate’s square divides the original input, so the number cannot be squarefree and the calculation can stop. If only one copy is present, the search continues against the reduced remainder. Candidates never need to be tested beyond the square root of that remainder: any composite remainder must have a factor at or below its square root, while a larger remainder left at the end is itself a single prime factor.

This method does not rely on probabilistic primality tests, cached tables, external services, or floating-point approximations. The published upper bound keeps the work predictable, and JavaScript safe-integer validation ensures every division and remainder operation represents the supplied integer exactly.

Using and interpreting the result

Provide n as a positive integer, not as a decimal, fraction, scientific-notation string, or formatted number containing separators. Values below 1 are rejected because this capability follows the usual positive-integer definition of squarefreeness. Values above the documented maximum are also rejected so execution remains bounded.

A true squarefree result says that the integer contains no squared prime factor; it does not say that the integer is prime. Numbers such as 6, 30, and 42 are composite yet squarefree because their distinct prime factors occur once each. The input may contain other repeated primes that are not listed, because one witness is enough to decide the property.

This makes the output suitable for validation rules, number-theory experiments, and preprocessing steps that only need the classification. No input is sent to a third-party service by the algorithm.

Validate a number-theory dataset

Classify stored positive integers and flag rows containing a squared prime factor before further analysis.

Check arithmetic exercises

Confirm whether a proposed answer is squarefree and use the repeated prime as a concise explanation when it is not.

Filter generated sequences

Keep only squarefree terms in a deterministic pipeline without computing or storing every complete factorization.

Is 1 squarefree?

Yes. The number 1 has no prime factors, so no prime appears squared in its factorization.

Does squarefree mean prime?

No. A composite number can be squarefree when each of its prime factors appears only once; 30 is an example.

What does the result show when a number is not squarefree?

It names a prime whose square divides your number. For 12 that prime is 2, because 4 goes into 12 exactly. That single prime is enough proof, so no full factorization is needed.

Can I check a decimal or a negative number?

No. The check accepts positive whole numbers only. Values below 1, decimals, fractions, scientific notation and numbers written with thousands separators are refused rather than guessed at.

How is a squarefree number checked?

Possible prime factors are tried from the smallest up. Each time one divides the number, one copy is removed and the same factor is tried again; a second division means its square divides the number.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/numth/squarefree-check

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/numth/squarefree-check \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":30}'
{
  "n": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.squarefree_check",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n1000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What squarefree means

The result includes the original value and a boolean named squarefree. If the result is false, repeated_prime supplies one prime that occurs at least twice. That witness makes the answer easy to confirm: square the reported prime and divide the original number by it.

How the check is performed

Repeating a request with the same input always produces the same JSON result.

Using and interpreting the result

A false result includes repeated_prime, but that field is a witness rather than a full factorization. Browser use performs the same pure calculation locally, while an API request costs $0.002.

What does repeated_prime show?

It shows one prime whose square divides n. The input may have additional repeated prime factors that are not listed.

Can I enter zero or a negative integer?

No. This capability accepts positive integers only and returns an invalid_input error when n is below 1.

What does an API check cost?

Each API request costs $0.002. The browser version runs the same deterministic calculation locally.

Read the full KIT documentation →