You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Mitchell****Guest**

Hi,

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.

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,921

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.

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 6,919

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.

Bob

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

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

Pages: **1**