Long Division Calculator
The long division calculator writes every step out the way it goes on the page: bring down, divide, multiply, subtract, repeat.
Quotient
- Remainder
- 9
- Written out
- 7829 / 23 = 340 remainder 9
- Check Quotient times divisor plus remainder returns the dividend. This is the definition of division with remainder and the only check worth doing.
- 340 x 23 + 9 = 7829
- As a mixed number
- 340 9/23
- As an exact fraction
- 7829/23
- As a decimal The digits in brackets repeat forever, because the remainders started repeating. A decimal cannot write this division exactly.
- 340.(3913043478260869565217)
- Why it repeats (or does not) A division terminates as a decimal exactly when the reduced denominator's only prime factors are 2 and 5. Everything else cycles, and the cycle can be at most (divisor - 1) digits long.
- 23 has a prime factor other than 2 or 5
| Step | Bring down | Working value | Quotient digit | Subtract 23 x digit | Remainder |
|---|---|---|---|---|---|
| 1 | 8 | 78 | 3 | 3 x 23 = 69 | 9 |
| 2 | 2 | 92 | 4 | 4 x 23 = 92 | 0 |
| 3 | 9 | 9 | 0 | 0 x 23 = 0 | 9 |
- Each row brings down the next digit of the dividend, finds how many times the divisor goes into the working value, multiplies back, and subtracts. The remainder carries into the next row.
- Leading zeros of the quotient are not written down in the algorithm, so a step is only shown once the quotient has started. That is what a textbook does.
How the Long Division Calculator works
Long division is an algorithm, and the reason it has survived calculators is that it is the only division method that shows its work. The quotient alone is what a phone gives you; the steps are what goes on the page.
The loop has four moves, repeated once per digit of the dividend: divide, multiply, subtract, bring down.
Take 7,829 / 23.
Start with the leftmost digits. 23 does not go into 7, so take 78. It goes in 3 times. Write 3 above the 8. Multiply: 3 x 23 = 69. Subtract: 78 - 69 = 9.
Bring down the next digit, the 2, making 92. 23 goes into 92 exactly 4 times. Write 4. Multiply: 4 x 23 = 92. Subtract: 0.
Bring down the 9, making 9. 23 does not go into 9, so write 0 and carry the 9 as the remainder.
The quotient is 340 with remainder 9. The check is always the same: 340 x 23 + 9 = 7,829. Quotient times divisor plus remainder equals the dividend, and if that does not hold, a step went wrong.
One detail that textbooks follow and implementations often get wrong: leading zeros of the quotient are not written. Dividing 35 by 7, the first working value is 3, into which 7 goes zero times, but you do not write that zero at the front of the answer. The algorithm starts recording once the quotient becomes non-zero. Internal zeros, like the one in 340, are written, because by then the quotient has started.
That remainder of 9 can be expressed three ways and each is right in a different context. As a remainder it is 340 r 9, which is what you want for "how many boxes of 23 and how many left over". As a mixed number it is 340 and 9/23, which is the exact answer. As a decimal it is 340.391304347826..., where the block 3913043478260869565217 repeats with a 22-digit cycle.
Which brings up the part worth understanding. Continuing the division past the decimal point means bringing down zeros instead of digits, and the remainders you get are all less than the divisor. There are only finitely many possible remainders, so eventually one repeats. Once a remainder repeats, every subsequent digit repeats with it. That is why every fraction is either a terminating or a repeating decimal, with no third option.
The cycle terminates only if you reach a remainder of zero, which happens exactly when the divisor's prime factors are all 2s and 5s. 1/8 terminates because 8 = 2^3. 1/23 cannot, because 23 is prime and is not 2 or 5, so its cycle runs the maximum 22 digits. The cycle length is always at most divisor - 1, and when it hits that maximum the divisor is called a full reptend prime. The smallest is 7, giving 1/7 = 0.142857 repeating with a six-digit cycle.
Negative numbers follow the sign rule on the quotient (a negative divided by a positive is negative), and the remainder conventionally takes the sign of the dividend, which is what most programming languages do and what this calculator does.
Long Division Calculator FAQ
How do you do long division step by step?
Four moves repeated per digit: see how many times the divisor goes into the current working value, write that digit in the quotient, multiply it back by the divisor, and subtract. Then bring down the next digit of the dividend and repeat. Stop when there are no digits left; whatever remains is the remainder.
How do I check a long division answer?
Multiply the quotient by the divisor and add the remainder; you should get the dividend back. For 7,829 / 23 = 340 r 9: 340 x 23 = 7,820, plus 9 is 7,829. If it does not match, one of the subtraction steps is wrong.
What do I do with the remainder?
It depends on the question. Leave it as a remainder for counting problems ('how many full boxes and how many left over'). Write it over the divisor for an exact answer: 340 and 9/23. Or continue the division by bringing down zeros for a decimal: 340.3913...
Why do some divisions give repeating decimals?
Because the remainders have to repeat. Every remainder is smaller than the divisor, so there are only finitely many, and once one recurs the digits cycle forever. A division terminates only when a remainder of zero is reached, which happens exactly when the divisor's prime factors are all 2s and 5s.