Balancing Number Checker Calculator
Number Theory
- A balancing number n acts as a fulcrum: for some balancer r, the sum 1 + 2 + ... + (n-1) equals the sum (n+1) + ... + (n+r). The test uses the discriminant 8n^2 + 1.
- 8n^2 + 1 = 9,801, whose square root is 99 exactly.
- With the exact root, the balancer is r = (sqrt(8n^2 + 1) - (2n + 1)) / 2 = 14, so 35 is a balancing number.
- Balancing numbers obey the recurrence B(n) = 6 x B(n-1) - B(n-2), giving 1, 6, 35, 204, 1,189, 6,930, ... - each is about 5.83 times the previous one.
Imagine the integers laid out on a beam and you must choose a fulcrum point n where the weights balance: the sum of everything below n equals the sum of a run of integers above n. The values of n where an exact balance exists are rare and beautiful - the balancing numbers, introduced by Behera and Panda in 1999. The first is 6: below it, 1 + 2 + 3 + 4 + 5 = 15; above it, 7 + 8 = 15.
This calculator tests any n up to ten million using the exact square test: n is a balancing number precisely when 8n^2 + 1 is a perfect square, and the balancer then falls out of the formula r = (sqrt(8n^2 + 1) - (2n + 1)) / 2. It also brackets non-balancing inputs between their nearest balancing neighbours.
After 6 comes 35 with balancer 14, then 204 with balancer 84 - and then the gaps yawn open, each term nearly six times the last.
Worked examples
35
(35)
| Balancing verdict | Yes - balancing |
| 8n^2 + 1 value | 9,801 |
| Balancer r | 14 |
| Nearest balancing at or below | 35 |
6
(6)
| Balancing verdict | Yes - balancing |
| 8n^2 + 1 value | 289 |
| Balancer r | 2 |
| Nearest balancing at or below | 6 |
100
(100)
| Balancing verdict | No - not balancing |
| 8n^2 + 1 value | 80,001 |
| Balancer r | - |
| Nearest balancing at or below | 35 |
The balancing picture
The definition deserves a slow read. The fulcrum n itself is counted on neither side: the left pan holds 1 through n-1, the right pan holds n+1 through n+r, and r - the balancer - is whatever makes the pans level. For 35, the left pan sums 1 to 34, which is 595, and the right pan sums 36 to 49 - fourteen numbers, hence balancer 14 - also 595.
Most numbers cannot balance at all: the left sum is fixed, and the right sum jumps in steps as r grows, usually hopping clean over the target. The balancing numbers are the rare fulcrums where a step lands exactly.
Where 8n^2 + 1 comes from
Set the two triangular sums equal and the algebra produces a Pell-type condition. The left sum is n(n-1)/2; the right is r(2n + r + 1)/2. Clearing the equation and completing the square in r shows the two sides can match only when 8n^2 + 1 is a perfect square - and when it is, the square root hands you the balancer directly.
That is why the test on this page is a single square check rather than a search: for n = 35, 8n^2 + 1 = 9,801 = 99 squared, and r = (99 - 71) / 2 = 14. For n = 100, 8n^2 + 1 = 80,001 lies between 282 and 283 squared, so 100 fails instantly.
The recurrence and the growth
Balancing numbers obey the lean recurrence B(next) = 6 x B(current) - B(previous): from 1 and 6 come 35, then 204, then 1,189, 6,930, 40,391 and onward. The multiplier 6 minus a correction makes each term about 5.83 times the previous one - precisely 3 + 2 sqrt(2), the fundamental unit of the underlying Pell equation.
Exponential thinning is the consequence. Below ten million there are just ten positive balancing numbers, and the calculator's bracketing output - nearest below, next above - is the honest answer for almost every input a user will ever type.
Cobalancing numbers
A companion concept relaxes the picture: a cobalancing number lets the right-hand run start immediately while the left sum runs to n itself, giving a parallel sequence beginning 2, 14, 84, 492. The two families interleave and share the same Pell machinery, and many papers treat them as two views of one object.
If balancing numbers are the fulcrums where the beam balances with the pivot excluded, cobalancing numbers are the pivots where it balances with the pivot's own weight counted on the left - a small definitional shift with a completely different sequence as its reward.
Testing exactly at scale
At n = 10,000,000, the discriminant 8n^2 + 1 has fifteen digits. Floating-point square roots at that magnitude cannot be trusted to distinguish a perfect square from its neighbours, so this calculator uses integer square root with exact verification - the square of the reported root is checked, not assumed.
The same discipline is applied to the balancer: it must come out a whole number of at least 1, or the verdict is no, however close the square test came.
Why mathematicians keep them
Balancing numbers are a gateway to Pell equations, continued fractions and recurrence sequences - deep machinery reached from a puzzle a child can verify with 1 + 2 + 3 + 4 + 5 = 7 + 8. They also connect to square triangular numbers: the balancing condition and the square-triangular condition are cousins through the same Pell equation.
The sequence is A001109 in the OEIS, and its literature - generalizations to balancing with gaps, balancing modulo m, higher-order versions - shows no sign of exhausting a definition that fits in one sentence.
Square triangular cousins
Ask instead for a triangular number that is also a perfect square and you get 1, 36, 1,225, 41,616 - the square triangular numbers, governed by the same Pell equation x^2 - 8y^2 = 1 that powers the balancing test. The kinship is not a coincidence: the balancing condition, rearranged, is precisely the demand that a certain triangular number be one step from a square.
Sequences that look unrelated at the surface - fulcrums, square triangulars, solutions of Pell equations - repeatedly turn out to be one object in several costumes, and balancing numbers are an unusually accessible door into that unity.
Balancing with a gap
Generalizations insert a gap at the fulcrum: skip g integers on the right before starting the run, and ask which fulcrums balance then. Each gap value produces its own sequence with its own Pell-type test, and the gap-zero case on this page is the classical one.
The family illustrates a standard mathematical move: take a definition with a hidden parameter set to its simplest value, vary the parameter, and map the whole landscape. Most of the landscape is still being charted in the literature.
A hand check for 6 and 35
Scepticism is cheap to satisfy here. For 6: below, 1 + 2 + 3 + 4 + 5 = 15; above, 7 + 8 = 15, and the run stops because 15 is reached exactly - balancer 2. For 35: below sums to 595; the run above reaches 36 + ... + 49 = 595 at fourteen terms, balancer 14, and no shorter or longer run works because each added term overshoots by a growing amount.
Try to balance 7 by hand and the futility is instructive: below sums to 21, while the runs above give 8, 17, 27 - hopping over 21 without landing. The square test encodes exactly that hop in algebra.
The Pell equation underneath
The square test 8n^2 + 1 hides the Pell equation x^2 - 8y^2 = 1 with x = 2r + 2n + 1... in its standard form, solutions of x^2 - 8n^2 = 1 generate everything: the fundamental solution x = 3, n = 1 gives the growth factor 3 + sqrt(8) = 3 + 2 sqrt(2) that the recurrence expresses as 'times 6 minus the previous'.
Pell equations are the deep end of elementary number theory - smallest solutions can be astronomically large for other coefficients - and 8 is mercifully tame. Balancing numbers are the friendliest possible first encounter with the machinery.
Balancing in higher dimensions
The fulcrum idea generalizes: balance triangular numbers against each other, or balance sums of squares, and new sequences with their own Pell-type tests emerge. The literature calls the originals 'balancing' and the generalizations by a thicket of names, but the method is constant - equate two quadratic sums, complete the square, read off a Pell condition.
That transferability is the real content of the concept. The specific sequence 6, 35, 204 is a souvenir; the technique is the takeaway.
FAQs
What is a balancing number?
A number n that acts as a fulcrum: the sum of the integers below n equals the sum of the r integers above n, for some balancer r. The first examples are 6, 35 and 204.
Is 35 a balancing number?
Yes. 8 x 35^2 + 1 = 9,801 = 99 squared, and the balancer is (99 - 71) / 2 = 14.
What is the balancer of 204?
84 - the sums 1 to 203 and 205 to 288 are both 20,706.
How do you test whether a number is balancing?
Compute 8n^2 + 1 and check whether it is a perfect square; if it is, the balancer is (sqrt(8n^2 + 1) - (2n + 1)) / 2.
What is the next balancing number after 35?
204, from the recurrence B(next) = 6 x B(current) - B(previous): 6 x 35 - 6 = 204.
Who introduced balancing numbers?
Behera and Panda, in 1999, from the equal-sums fulcrum puzzle.
Is 100 a balancing number?
No - 8 x 100^2 + 1 = 80,001 is not a perfect square. Its nearest balancing neighbours are 35 and 204.
Is 1 a balancing number?
Formally it sits in the sequence as the trivial seed - the empty sum below balances a zero-length run - but the first genuine fulcrum with a positive balancer is 6, which is why this calculator tests from 2 upward.
What is the balancer of 6?
2 - the integers below 6 sum to 15, and the two integers above it, 7 + 8, also sum to 15.