Divisibility Test Calculator

Instantly check divisibility, find all factors (divisors), test primality, and visualize factor pairs with an interactive rainbow diagram.

Divisibility Check
Find All Factors
Prime Check
Enter two positive integers. The calculator will test whether d divides n evenly.
Enter a positive integer to find all its divisors (factors).
Enter a positive integer ≥ 2 to check if it is prime.
? 144 (highly composite)
? 100 (square)
? 997 (prime)
⚡ 1024 (power of 2)
? 360 (refactorable)
✧ 49 (perfect square)
Privacy first: All calculations run locally in your browser. No data is sent to any server.

What Is Divisibility & Why Does It Matter?

In number theory, divisibility is a fundamental relation between integers. We say that an integer d divides n (written d | n) if there exists an integer k such that n = d · k. In other words, dividing n by d leaves no remainder. This simple idea underpins much of arithmetic, from elementary school math to advanced cryptography.

The divisibility test is the process of determining whether one integer divides another without performing long division. Over centuries, mathematicians have developed a rich set of divisibility rules—quick mental checks that let you decide divisibility by small numbers in seconds. For example, a number is divisible by 3 if the sum of its digits is divisible by 3; by 5 if it ends in 0 or 5; by 11 if the alternating sum of its digits is divisible by 11.

d | n  ⟺  n = d · k  for some integer  k

The fundamental definition of divisibility.

Complete Divisibility Rules Reference

Master the most useful divisibility rules for quick mental arithmetic and problem‑solving:

  • 2 : Last digit is even (0, 2, 4, 6, 8).
  • 3 : Sum of digits is divisible by 3.
  • 4 : Last two digits form a number divisible by 4.
  • 5 : Last digit is 0 or 5.
  • 6 : Divisible by both 2 and 3.
  • 7 : Double the last digit, subtract from the rest, repeat; if result is 0 or multiple of 7, divisible.
  • 8 : Last three digits form a number divisible by 8.
  • 9 : Sum of digits is divisible by 9.
  • 10 : Last digit is 0.
  • 11 : Alternating sum of digits (units minus tens plus hundreds …) is divisible by 11.
  • 12 : Divisible by both 3 and 4.
  • 13 : Four times the last digit, add to the rest, repeat; if result is multiple of 13, divisible.
  • 17 : Five times the last digit, subtract from the rest, repeat; if result is multiple of 17, divisible.
  • 19 : Double the last digit, add to the rest, repeat; if result is multiple of 19, divisible.

Why Use an Interactive Divisibility Tool?

  • Educational Aid : Visualize factor pairs through the rainbow diagram—perfect for students learning multiplication, division, and prime factorization.
  • Homework Verification : Quickly check your answers or explore factor relationships for any integer up to 1015 (browser limits apply).
  • Primality Testing : Determine whether a number is prime in milliseconds, with a clear explanation of the test used (trial division up to √n).
  • Programming & Algorithms : Use the tool to test edge cases, understand divisor enumeration, or verify mathematical conjectures.

How the Calculations Work

Divisibility Check : The calculator performs a simple modulo operation: n % d === 0. If the remainder is zero, d divides n; otherwise, it does not. The quotient and remainder are displayed for clarity.

Factor Finding : To enumerate all divisors of n, the tool iterates from 1 to √n. For each i that divides n, both i and n/i are recorded. This efficient method runs in O(√n) time, making it practical for numbers up to 1012.

Prime Checking : A number n > 1 is prime if it has no positive divisors other than 1 and itself. The tool tests divisibility by all integers from 2 to √n. If none divide evenly, n is declared prime. This is the classic trial‑division algorithm, accurate and easy to understand.

Factor Rainbow : The interactive canvas visualizes factor pairs as arcs. Factors are arranged along a horizontal axis; each pair (a, b) with a · b = n is connected by a semicircular arc. Perfect squares have a single middle point. This intuitive display helps students grasp the symmetry of multiplication.

Step‑by‑Step Usage Guide

  1. Choose a mode: Divisibility Check, Find All Factors, or Prime Check.
  2. Enter the required integer(s). All inputs must be positive integers (≥ 1).
  3. Click Calculate & Visualize or press Enter.
  4. The results panel displays the quotient, remainder, divisor list, or primality status.
  5. The Factor Rainbow canvas automatically updates to show factor pairs as colorful arcs.
  6. Use the preset examples to explore interesting numbers: highly composite numbers, primes, squares, and powers of two.

Verified Examples & Reference Table

The following results have been verified against independent mathematical sources and are fully reproducible with this tool.

Number (n) Divisors (factors) Prime? Divisibility Highlights
12 1, 2, 3, 4, 6, 12 No Divisible by 2, 3, 4, 6
100 1, 2, 4, 5, 10, 20, 25, 50, 100 No Perfect square, divisible by 4, 25
144 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 36, 48, 72, 144 No Highly composite, 15 divisors
997 1, 997 Yes Largest prime under 1000
1024 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 No Power of 2 (210)
360 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, 360 No Refactorable, 24 divisors
49 1, 7, 49 No Perfect square (72)
17 1, 17 Yes Prime, Fermat prime
Case Study: Primality in Cryptography

Modern public‑key cryptography (e.g., RSA) relies on the difficulty of factoring large composite numbers. The security of RSA depends on the fact that multiplying two large primes is easy, but factoring their product is computationally infeasible. Tools like this divisibility calculator help students and researchers explore the properties of primes and composites, building intuition for the number‑theoretic foundations of cybersecurity. For instance, the prime 997 is small enough to test manually, but the same principles apply to 2048‑bit primes used in real‑world encryption.

The Fundamental Theorem of Arithmetic

Every integer greater than 1 is either a prime number or can be expressed uniquely as a product of prime numbers (up to order). This is the Fundamental Theorem of Arithmetic, first proved by Euclid around 300 BCE. The theorem guarantees that prime factorization is unique, making primes the “atoms” of the integer universe. Our factor‑finding tool is a practical demonstration of this theorem: it lists all divisors, which are exactly the products of subsets of the prime factorization.

For example, 144 = 24 · 32. Its divisors are all numbers of the form 2a · 3b where 0 ≤ a ≤ 4 and 0 ≤ b ≤ 2 — exactly the 15 divisors listed in the table above.

Common Misconceptions About Divisibility

  • “0 is divisible by everything” : While 0 is a multiple of every integer, divisibility is typically defined for positive divisors. The calculator requires positive inputs.
  • “1 is prime” : By definition, a prime has exactly two distinct positive divisors. 1 has only one divisor (itself), so it is not prime. It is a unit.
  • “Large numbers are always composite” : There are infinitely many primes, and they can be arbitrarily large. The largest known prime (as of 2025) has over 24 million digits.
  • “If a number is divisible by 2 and 4, it is divisible by 8” : Not necessarily. For example, 12 is divisible by 2 and 4 but not by 8. Divisibility by 2 and 4 only implies divisibility by lcm(2,4) = 4.

Applications Across Disciplines

  • Computer Science : Hashing, checksums, and modular arithmetic rely on divisibility and remainders.
  • Coding Theory : Error‑correcting codes use divisibility properties to detect and correct transmission errors.
  • Music Theory : Frequency ratios and tuning systems (e.g., just intonation) are based on integer divisibility and small‑number ratios.
  • Finance : Divisibility rules help with mental arithmetic for percentages, taxes, and currency conversions.

Rooted in Classical Number Theory – This tool is built on principles established by Euclid, Eratosthenes, and later formalized by Gauss and Euler. The implementation follows standard algorithms verified against authoritative references (Hardy & Wright, “An Introduction to the Theory of Numbers”; Weisstein, “Divisibility” from MathWorld). The factor rainbow visualization is inspired by educational techniques used in Montessori and Singapore math curricula. Reviewed by the GetZenQuery tech team, last updated July 2026.

Frequently Asked Questions

In integer arithmetic, “divisor” and “factor” are synonyms. Both refer to an integer that divides another integer without leaving a remainder. The tool uses both terms interchangeably.

JavaScript numbers are IEEE 754 double‑precision, so the safe integer range is up to 253 − 1 ≈ 9 × 1015. For larger numbers, precision may be lost. The tool warns you if the input exceeds the safe range.

A factor rainbow is a visual representation of all factor pairs of a number. Factors are arranged in increasing order on a horizontal line, and arcs connect each factor to its complementary factor. The rainbow shape helps students see the symmetry of multiplication and quickly identify all divisors.

By definition, a prime number has exactly two distinct positive divisors: 1 and itself. The number 1 has only one divisor (itself), so it does not meet the definition. Additionally, including 1 as prime would break the Fundamental Theorem of Arithmetic, which requires unique prime factorization.

The tool is designed for positive integers. For negative numbers, divisibility is defined similarly, but the concept of “factors” is typically restricted to positive divisors. Enter a positive integer for best results.

Start with classic texts like An Introduction to the Theory of Numbers by Hardy & Wright, or explore online resources such as MathWorld and Khan Academy.
References: MathWorld Divisibility; Hardy, G.H. & Wright, E.M. “An Introduction to the Theory of Numbers” (6th ed.); Wikipedia: Divisibility Rule.