Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2013-12-16 08:45:09


building an equation

I am looking for an equation that will sum the number of digits of a number i.e. for 4, 1 + 2 +3 + 4 = 10 for 5, 1 +2 +3 + 4 + 5 = 15. I want to replace 4 and 5 with a variable so that any number can be added up to give an answer.

#2 2013-12-16 08:52:39

Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,039

Re: building an equation

So, you want the sum 1+2+3+...+(n-1)+n?

“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.


#3 2013-12-16 09:37:14

bob bundy
Registered: 2010-06-20
Posts: 8,462

Re: building an equation

hi Mitchell

Welcome to the forum.

Known as the sum of counting numbers (or triangle numbers) formula,  what you want is:

The diagram below shows where it comes from.

If you stack up n then n-1, then n-2 ....... 3, 2, 1 squares it makes a sort of right angled triangle.

Then make the same again but turn this stack up-side-down and slot it into the triangle to make a rectangle.

The rectangle is 'n' high and n+1 wide so its area is n(n+1).

But we've made twice the sum you want, so divide by 2.

That's it.  smile


View Image: triangle numbers.gif

Last edited by bob bundy (2013-12-16 09:39:16)

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob Bundy smile


Board footer

Powered by FluxBB