Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Divisibility Decision Tree


Hover any highlighted node for detailed explanation

NEven or Odd?EVEN÷2 ✓÷4?÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?digit sum÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 0/5÷7?÷11?alt sumDERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
?
Enter a number to see its divisibility analysis
The tree is waiting: every node stays gray until a number gives it a path to light. Enter anything from 1 to 9999. Learn more about using the tree · Tree structure





How to Use the Decision Tree

Enter any whole number from 1 to 9999 in the input field at the top. The tree immediately highlights the path your number follows through each divisibility test. Blue nodes indicate active tests, while gray nodes show inactive branches.

Hover your cursor over any highlighted node to reveal a tooltip explaining the specific calculation. The tooltip shows exactly why each test passes or fails for your number, including the intermediate values used in the calculation.

The summary panel on the right displays all divisors from 1 to 12 that divide your number evenly. Green badges indicate successful division, while red badges show failed tests. Click Reset to clear your input and start fresh with a new number.
NEven or Odd?EVEN÷2 ✓÷4?÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?digit sum÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 0/5÷7?÷11?alt sumDERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
No input, frozen

Every node waits in gray. The shape is already the algorithm: parity first, the digit-sum pair next, then the loners 5, 7, and 11, and the derived row last.

Before any number is entered, the tree rests entirely in gray—and that resting view is worth a look of its own. The shape of the flowchart is the algorithm: parity decided first, the digit-sum pair next, then the independent tests for 5, 7, and 11, and the derived row last. Reading the gray tree top to bottom is reading the order in which a careful human would test divisibility by hand.

The gray state also shows what each node will need: the sublabels hold placeholders like "digit sum" and "ends 0/5" that fill with your number's actual values the moment you type. The tree structure section walks each region in detail.

Understanding the Tree Structure

The tree begins with an even/odd check at the top. This fundamental split determines which branch your number follows. Even numbers proceed left through tests for 2, 4, and 8. Odd numbers branch right and immediately eliminate all even divisors (2, 4, 6, 8, 10, 12).

Both branches merge before testing divisibility by 3. The digit sum calculation appears in the node's sublabel. From the ÷3 result, the tree splits again to test ÷9, since divisibility by 9 requires first passing ÷3.

After merging again, the tree tests ÷5 (checking the last digit), ÷7 (direct division), and ÷11 (alternating digit sum). Finally, the Derived section at the bottom shows combined results for 6, 10, and 12 based on earlier tests. When every test from 2 to 12 fails, the summary flags the number as only divisible by 1; before any input at all, the whole tree waits in gray, as described in how to use the decision tree.

Reading the Tooltips

Each tooltip provides three pieces of information: the test name, the specific values from your number, and whether the test passes or fails.

For digit-based rules, tooltips show the actual calculation. When testing 126 for ÷3, you'll see: "Digit sum: 1+2+6 = 9. Since 9 ÷ 3 = 3, it's divisible." For position-based rules like ÷4, the tooltip displays: "Last two digits 26 ÷ 4 = 6.5 (not whole)."

Failed tests explain exactly what went wrong. If testing an odd number for ÷8, the tooltip states: "Can't be divisible by 8 without first being divisible by 4." This cascading logic helps you understand why certain paths close off.

The Even/Odd Split

Every integer is either even or odd, and this property determines divisibility by all even numbers. The tree checks the last digit: if it's 0, 2, 4, 6, or 8, the number is even; otherwise it's odd.

Even numbers automatically pass ÷2 and proceed to test ÷4 and ÷8. These tests use the last two and three digits respectively. If 4 divides the last two digits evenly, the number passes ÷4. If 8 divides the last three digits evenly, it passes ÷8.

Odd numbers take a shorter path. Since no odd number can be divisible by any even number, the tree immediately marks ÷2, ÷4, ÷6, ÷8, ÷10, and ÷12 as failed. This efficient elimination demonstrates why checking parity first saves computational effort.
26Even or Odd?EVENEVEN÷2 ✓÷4?26÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=8÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 6÷7?÷11?alt=-4DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
26 entered, frozen

The even branch lights: ÷2 comes free, but 26 fails ÷4, so the ÷8 box stays shut — blocked without a test, not merely failed.

The frozen 26 above shows the even path's most common shape: ÷2 comes free with the last digit, but 26 is not a multiple of 4, so the left ÷8 box never activates—the tree marks ÷8 blocked rather than tested. Failing and being blocked are different verdicts with the same badge: one ran a calculation, the other refused to.

When ÷4 does pass, the story continues down the powers of two chain. And the right side of the split takes the drastic elimination described under the odd shortcut—six divisors gone before any arithmetic.

The Odd Shortcut

When the even/odd check comes back odd, the tree does something dramatic: a single node declares ÷2, ÷4, ÷6, ÷8, ÷10, and ÷12 all failed at once, and the entire left branch stays gray.

The logic is airtight. Every multiple of an even number is itself even—a multiple of 4 is 4k=2(2k)4k = 2(2k), a multiple of 6 is 6k=2(3k)6k = 2(3k), and so on. An odd number therefore cannot be a multiple of any of them, and no calculation is needed to know it.

Try 45: it ends in 5, so it is odd, and six divisors vanish immediately. The tests that remain—3, 5, 7, 9, 11—are exactly the odd divisors, and 45 still collects three of them (3, 5, and 9).
45Even or Odd?ODDEVEN÷2 ✓÷4?÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=9÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 5÷7?÷11?alt=-1DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
45 entered, frozen

The single odd node eliminates six divisors at once; the action moves below the merge, where 45 collects ÷3, ÷9, and ÷5.

The shortcut is a lesson in contrapositive reasoning: instead of proving "45 is not divisible by 8" by dividing, the tree proves "everything divisible by 8 is even; 45 is not even; done." Mathematics often trades a computation for a property, and this node is that trade drawn as a picture.

It is also an efficiency argument: one parity glance eliminates half the divisor list, which is why the tree tests it first. Note what the shortcut does not say—odd numbers can still be richly divisible. The remaining odd tests proceed exactly as for any number, starting with the digit sum.

The Powers of Two Chain

The even branch is not three independent tests but a chain: ÷2 reads the last digit, ÷4 reads the last two digits, and ÷8 reads the last three—and each test is attempted only if the previous one passed.

The gating mirrors the mathematics. Since 8=2×48 = 2 × 4, any multiple of 8 is automatically a multiple of 4; so if ÷4 fails, the tree marks ÷8 failed without dividing anything. The tooltip says it plainly: "Can't be divisible by 8 without first being divisible by 4."

Try 104: even, so ÷2 passes; last two digits 04 give 4÷4=14 ÷ 4 = 1, so ÷4 passes and unlocks the ÷8 box; last three digits give 104÷8=13104 ÷ 8 = 13, and all three badges turn green.
104Even or Odd?EVENEVEN÷2 ✓÷4?4÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=5÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 4÷7?÷11?alt=5DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
104 entered, frozen

The full chain: 04 passes ÷4 and unlocks ÷8, where 104 ÷ 8 = 13 lands it — three green badges down the powers of two.

Each link of the chain halves the candidates: half of all numbers pass ÷2, a quarter pass ÷4, an eighth pass ÷8. The frozen 104 above is in the narrowest class, one number in every eight.

Why do more digits come into play at each step? Because 1010 is divisible by 2, 100100 by 4, and 10001000 by 8—each power of two needs one more decimal digit before the higher places become invisible to it. The chain would continue: ÷16 would need the last four digits, though this tree stops at 12. The same nested logic reappears on the other side of the tree with 3 and 9, where one digit sum feeds two tests.

Digit Sum Rules for 3 and 9

The digit sum is the sum of all individual digits in a number. For 5,274 the digit sum is 5+2+7+4=185 + 2 + 7 + 4 = 18. This simple calculation reveals divisibility by 3 and 9.

If the digit sum is divisible by 3, so is the original number. If the digit sum is divisible by 9, the original is divisible by 9. Since every multiple of 9 is also a multiple of 3, passing ÷9 guarantees passing ÷3, but not vice versa.

The tree displays the digit sum in the ÷3 node's sublabel (e.g., "sum=18"). Hovering reveals the full addition. When ÷3 passes, the tree proceeds to test whether that same digit sum also divides by 9. When ÷3 fails, ÷9 automatically fails without further calculation.
126Even or Odd?EVENEVEN÷2 ✓÷4?26÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=9÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 6÷7?÷11?alt=5DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
126 entered, frozen

Digit sum 1+2+6 = 9 lights ÷3 and flows into the ÷9 box, where the same 9 passes again — plus a direct-division hit at ÷7.

One computation serves two tests: the frozen 126 above shows sum 1+2+6 = 9 lighting the ÷3 node and then flowing unchanged into the ÷9 branch box, where the same 9 passes again. The tree never re-reads the number's digits—the digit sum is the number, as far as 3 and 9 are concerned.

That equivalence is the old bookkeeper's trick of casting out nines, and it rests on 101(mod9)10 \equiv 1 \pmod 9: every place value collapses to 1, so only the digits' sum survives. The why divisibility rules work section carries the full argument.

When the Digit Sum Fails

If the digit sum is not a multiple of 3, the tree takes its second shortcut: the right-hand branch box activates and ÷9 is refused without any arithmetic. Since 9=3×39 = 3 × 3, every multiple of 9 is a multiple of 3—so failing ÷3 settles ÷9 for free.

Try 50: digit sum 5+0=55 + 0 = 5, which is not a multiple of 3. The ÷3 node shows a red badge, the "÷3 ✗" branch box lights, and ÷9 inside it is marked failed-by-inheritance. Meanwhile the tests that do not depend on 3 continue normally—50 still passes ÷5 and ÷10.

The failure also propagates downward: the derived boxes for 6 and 12 both require ÷3, so both turn red the moment the digit sum misses.
50Even or Odd?EVENEVEN÷2 ✓÷4?50÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=5÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 0÷7?÷11?alt=5DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
50 entered, frozen

Digit sum 5 is no multiple of 3, so the right branch box takes over: ÷9 refused without arithmetic. The last digit 0 still delivers ÷5 and ÷10.

This is the same blocked-branch logic as the even side's ÷8 gate, applied to the odd prime: the tree encodes "9 needs 3" and "8 needs 4" as structure, not as calculations. A red badge can therefore mean two different things—a test that ran and failed, or a test that never needed to run—and the tooltips distinguish the two wordings.

There is a quiet completeness fact here too: the digit sum of any number is congruent to the number itself modulo 3, so no number can fail the digit-sum test yet secretly be divisible by 3. The shortcut never lies; the reasoning is spelled out under why divisibility rules work.

Last Digit Rules for 5 and 10

Divisibility by 5 depends entirely on the last digit. If a number ends in 0 or 5, it's divisible by 5. Any other ending digit means the number is not divisible by 5. The tree displays the last digit in the ÷5 node's sublabel.

Divisibility by 10 combines two rules: the number must be divisible by both 2 and 5. In practice, this means the number must end in 0. Ending in 5 passes ÷5 but fails ÷2, so ÷10 fails. Ending in an even digit other than 0 passes ÷2 but fails ÷5.

The derived section at the bottom shows ÷10 as "(2∧5)" indicating it requires both conditions. The tree computes this automatically from your earlier ÷2 and ÷5 results.

The Alternating Sum Rule for 11

Divisibility by 11 uses the alternating digit sum: subtract and add digits alternately from left to right. For 918,082: 91+80+82=229 - 1 + 8 - 0 + 8 - 2 = 22. Since 22 is divisible by 11, so is 918,082.

The tree computes this alternating sum and displays it in the ÷11 node's sublabel (e.g., "alt=22"). Hovering shows whether the result divides evenly by 11.

This rule works because of how place values relate to powers of 10 modulo 11. Each power of 10 alternates between +1 and -1 when reduced modulo 11, creating the alternating pattern. The result can be negative, zero, or positive—any multiple of 11 (including 0) indicates divisibility.

Derived Divisibility: 6, 10, and 12

Some divisibility tests combine simpler rules rather than using unique tests. The tree shows these as Derived results at the bottom.

Divisibility by 6 requires passing both ÷2 and ÷3. The number must be even (ends in 0,2,4,6,8) AND have a digit sum divisible by 3. Formula: (2∧3).

Divisibility by 10 requires passing both ÷2 and ÷5. Only numbers ending in 0 satisfy both conditions. Formula: (2∧5).

Divisibility by 12 requires passing both ÷3 and ÷4. The digit sum must be divisible by 3, AND the last two digits must form a number divisible by 4. Formula: (3∧4).

The derived boxes turn green or red based on combining the earlier test results, showing how composite divisibility rules build from prime and prime-power factors.

Only Divisible by 1: Prime Suspects

Enter 13 and watch every test from 2 to 12 fail: odd, digit sum 4, ends in 3, no direct hit at 7, alternating sum −2. The summary panel then shows a special yellow note: only divisible by 1—this might be a prime number, or divisible by something larger than 12.

The hedge in that wording is honest. The tree only tests divisors up to 12, so it can suspect primality but never prove it. 13 happens to be prime; 169 = 13 × 13 produces exactly the same all-red display and is not prime, because its smallest factor is beyond the tree's reach.

Numbers in this state are the tree's most instructive failures: the entire flowchart lights up with red badges, and the odd shortcut usually does most of the eliminating in one stroke.
13Even or Odd?ODDEVEN÷2 ✓÷4?÷8?÷8 ✗ODD÷2,4,6,8,10,12 ✗↓ merge÷3?sum=4÷3 ✓÷9?÷3 ✗÷9 ✗÷5?ends 3÷7?÷11?alt=-2DERIVED÷6(2∧3)÷10(2∧5)÷12(3∧4)
13 entered, frozen

Every badge from 2 to 12 is red; only 1 remains. The tree cannot tell a prime from a number with large factors — 13 happens to be prime.

To turn suspicion into proof, trial division only needs primes up to n\sqrt{n}: for a four-digit number that means checking primes up to 97, far past this tree's twelve divisors. The tree trades completeness for teachability—each of its twelve tests has a story, while a full primality check is just repetition.

A good exercise: hunt for the smallest impostor. A composite number always has a factor no larger than its square root, so any composite below 132=16913^2 = 169 must have a factor of 12 or less—and the tree will catch it. Numbers like 91 (= 7 × 13) never reach the yellow note because ÷7 exposes them. Below 169, therefore, every all-red number really is prime; 169 itself is the first composite to slip through. Prime factorization is the systematic version of this reasoning.

Why Divisibility Rules Work

Divisibility rules exploit patterns in our base-10 number system. Each rule connects to how powers of 10 behave when divided by specific numbers.

For ÷2 and ÷5, the last digit suffices because 10 is divisible by both. All higher place values contribute multiples of 10, leaving only the units digit to determine divisibility.

For ÷3 and ÷9, digit sums work because 101(mod3)10 \equiv 1 \pmod{3} and 101(mod9)10 \equiv 1 \pmod{9}. Each digit's contribution equals just the digit itself, regardless of its position.

For ÷4 and ÷8, the last two or three digits work because 1000(mod4)100 \equiv 0 \pmod{4} and 10000(mod8)1000 \equiv 0 \pmod{8}. Higher place values contribute nothing to the remainder.

The decision tree's structure reflects these mathematical relationships, grouping related tests and showing logical dependencies.