10

Not exactly a duplicate since this is answering a specific instance popular in social media.

You might have seen the viral posts about "save a penny a day for a year and make $667.95!" The mathematicians here already get the concept while some others may be going, "what"? Of course, what the challenge is referring to is adding a number of pennies to a jar for what day you're on. So:

Day 1 = + .01
Day 2 = + .02
Day 3 = + .03
Day 4 = + .04

So that in the end, you add it all up like so:

1 + 2 + 3 + 4 + 5 + 6 + ... = 66795

The real question is, what's a simple formula for getting a sum of consecutive integers, starting at whole number 1, without having to actually count it all out?!

SpYk3HH
  • 415
  • 22
    $\sum\limits_{k=1}^{n}k=\frac{n(n+1)}{2}$ – barak manos Jan 05 '16 at 14:49
  • 18
    All of the answers are very well written. Though I must point out that you'll end up with $$671.61$, since it's a leap year! – zz20s Jan 05 '16 at 15:13
  • 1
    @zz20s oh you! Stahp et! :-P – SpYk3HH Jan 05 '16 at 15:15
  • By the way, the way you have written the values suggests that you are saving $m$ pennies a day (not only 1 penny) where $m$ is the day number. If you only deposit a penny a day, after $n$ days, you get $n*0.01$ Dollars only. – NoChance Jan 05 '16 at 15:26
  • @zz20s And technically, the year is still off by 11 minutes and 14 seconds. should we account for that too? – SpYk3HH Jan 05 '16 at 15:29
  • 1
    https://xkcd.com/169/ – djechlin Jan 05 '16 at 15:51
  • @SpYk3HH you should also specify earth year and that we are using a currency with a hundred pennies to a "$" symbol. – djechlin Jan 05 '16 at 15:53
  • 1
    @djechlin lolz. Still waiting on that sarcasm font ... need to petition stackmeta for a sarcasm shorthand ... – SpYk3HH Jan 05 '16 at 15:56
  • 5
    I'm just grumpy because I don't like questions where the trick is to figure out which random misinterpretation the question is seeing if you come up with. (Your question is fine, btw). – djechlin Jan 05 '16 at 16:00
  • Grouchy fleablood sez: "Huh? Is it supposed to somehow be surprising? If you put 1 cent on the first day and 365 cents on the last day then the average is about 180 cents. $1.80 a day for 365 will be about $600 or $700. What the #@!* is surprisinng about that?" I hate it when stupid things go viral. That's why they call me "grouchy fleablood". – fleablood Jan 05 '16 at 17:12
  • 2
    Grouchy fleablood gets slightly abashed: I'm long aware of the guassian punishment (had a teacher inflict it on me in the 7th grade-- its why I became a math major) and I was always impressed by the apparent difficulty of getting a precise result of doing 365 sums in one blow. Yet somehow it never occurred to me until this very minute to think of it as simply taking averages. Which I always found to be mundane and obvious. So we have one thing clever and ingenious and brilliant and another mundane and obvious... AND THEY ARE BOTH THE SAME THING! Gotta love math! – fleablood Jan 05 '16 at 17:28
  • 5
    See also this post and other posts linked there. – Martin Sleziak Jan 05 '16 at 21:37
  • 1
    @djechlin - yes very annoying. I suppose that is why it went viral. "Save between a penny and 3.65 a day (but 1.83 on average) and have 667.95" isn't going to amaze anyone. – Martin Capodici Jan 05 '16 at 21:43
  • It's dishonest to say "save a penny a day" as you only saved a penny one day. – fleablood Jan 06 '16 at 00:41
  • 1
    Store up a penny at each moment where the time is rational and save a countably infinite amount of money! – Brian Tung Jan 06 '16 at 00:42
  • Now, if you really want to start saving money, try doubling the number of pennies each day. – Théophile Jan 06 '16 at 01:48

9 Answers9

27

The real question is, what's a simple formula for getting a sum of consecutive integers, starting at whole number 1, without having to actually count it all out

While others have answered the question, I could not resist to reflect some history associated with the question.

The question you asked relates back to a famous mathematician Gauss the story sometimes referred to as "Gauss Punishment", goes like:

In elementary school in the late 1700’s, Gauss was asked to find the sum of the numbers from 1 to 100. The question was assigned as “busy work” by the teacher, but Gauss found the answer rather quickly by discovering a pattern. His observation was as follows:

1 + 2 + 3 + 4 + … + 98 + 99 + 100

Gauss noticed that if he was to split the numbers into two groups (1 to 50 and 51 to 100), he could add them together vertically to get a sum of 101.

1 + 2 + 3 + 4 + 5 + … + 48 + 49 + 50

100 + 99 + 98 + 97 + 96 + … + 53 + 52 + 51

1 + 100 = 101 2 + 99 = 101 3 + 98 = 101 . . . 48 + 53 = 101 49 + 52 = 101 50 + 51 = 101

Gauss realized then that his final total would be 50(101) = 5050.

The source of the above is mostly from The sum of the first 100 whole numbers

Another version goes like, he wrote the numbers as follows:

001 + 002 + 003 +...+ 098 + 099 + 100 = S

100 + 099 + 098 +...+ 003 + 002 + 001 = S

(100+1)+(100+1)+(100+1)+...+ (100+1)+(100+1)+(100+1)= 2S

The value $(100+1)$ is repeated $100$ times.

so we get:

$$100 * (100+1) = 2S$$

but we only want the value of $S$

$$s=\frac{100*(100+1)}{2}$$

Needless to say, the number 100 can be any positive integer and the method would work the same. It is amazing what goes in the mind of a kid who is very young!

Narasimham
  • 40,495
NoChance
  • 6,427
19

Have had a lot of friends ask about this lately, as it is all over FaceBook. The formula is actually quite simple:

(N (N + 1) ) / 2 where N = Highest value

Or Simply $\frac {n(n+1)}{2}$

Thus

365 (365 + 1) ) / 2 = 66795

Divide that by 100 (because there's 100 pennies in a dollar) and viola! $667.95

Now, this is an OLD math (think about 6th century BC), wherein these results are referred to as triangle numbers. In part, because as you add them up, you can stack the results in the shape of a triangle!

1 = 1
     *
1 + 2 = 3 
     *
    * *
1 + 2 + 3 = 6
     *
    * *
   * * *
1 + 2 + 3 + 4 = 10
     *
    * *
   * * *
  * * * *

NoChance also has a fun story and answer to this question!


A little info on his lesson: -{for the super nerdy!}-

"...Carl Friedrich Gauss is said to have found this relationship in his early youth, by multiplying n/2 pairs of numbers in the sum by the values of each pair n+1. However, regardless of the truth of this story, Gauss was not the first to discover this formula, and some find it likely that its origin goes back to the Pythagoreans 5th century BC..." - wikipedia

"...The mathematical study of figurate numbers is said to have originated with Pythagoras, possibly based on Babylonian or Egyptian precursors. Generating whichever class of figurate numbers the Pythagoreans studied using gnomons is also attributed to Pythagoras. Unfortunately, there is no trustworthy source for these claims, because all surviving writings about the Pythagoreans are from centuries later. It seems to be certain that the fourth triangular number of ten objects, called tetractys in Greek, was a central part of the Pythagorean religion, along with several other figures also called tetractys. Figurate numbers were a concern of Pythagorean geometry. ...
- wikipedia

See? Fun stuff, numbers!

SpYk3HH
  • 415
  • 1
    Your question and your answer to your question report the very same time (even the same second!). On one hand I'm curious to know "how" did you do it, on the other hand I'm also curious to know "why" did you do it... – Giovanni De Gaetano Jan 05 '16 at 15:29
  • 1
    The triangle is called Pascal's Triangle. And maybe you need to change "Multiply that by 100" to "Divide that by 100 ". – NoChance Jan 05 '16 at 15:30
  • 2
    @GiovanniDeGaetano I did it to have this link to refer friends too who keep asking me about this. The extra answers are adding extra knowledge, always a plus. As to the how, anytime in a Stack site you ask a question, there is a checkbox at bottom (just above submit usually) that says something like "Answer your question". Checking that box will open an answer box where you can add an answer. It's for people who don't really need an answer, but want to help spread a little knowledge. I use it a lot on Stackoverflow when putting up questions people email me a lot. – SpYk3HH Jan 05 '16 at 15:32
  • @NoChance Thanks, couldn't remember the name, and I fixed it. Sometimes I get brain to hand dislexia ... or something like that. I know I meant divide but apparently typed multiply ... lel – SpYk3HH Jan 05 '16 at 15:34
  • @SpYk3HH Thanks for the answer! Actually my question was not "how did you answer your own question?" but rather "how did you post question AND answer in less than a second?". Whereas this is the right place to deposit such a link I'm not going into, but I take the freedom to ask you to format your answer according to the standard of the website (i.e. writing the formulas in mathmode). – Giovanni De Gaetano Jan 05 '16 at 15:43
  • 1
    @GiovanniDeGaetano As aforementioned, the checkbox allows one to write an answer with question, thus submitting the 2 at once. As to the formatting, I actually had to look up LaTeX to do that. lolz. – SpYk3HH Jan 05 '16 at 15:53
  • 4
    No, this is not Pascal's triangle ! Pascal's triangle showcases the binomial numbers, which do not appear here. –  Jan 05 '16 at 16:59
13

As the growth is linear, the average amount is also the average of the first-day and last-day amounts, hence

$$365\times\frac{0.01+3.65}2.$$

4

Generically speaking, you can add up any evenly spaced set of numbers with the formula:

$(1+\frac{n_{2}-n_{1}}{i})(\frac {n_{2}+n_{1}}{2})$

Given that $i$ is the interval between each number, $n_1$ is the lower number, and $n_2$ is the higher number.

For example, if you started at \$5, then counted up two dollars at a time for a week (to \$17), you would end up with \$77.

$(1+\frac{17-5}{2})(\frac {17+5}{2})$

$(1+\frac{12}{2})(\frac {22}{2})$

$(1+6)(11)$

$7(11)$

$77$

The penny challenge follows the same formula:

$(1+\frac{365-1}{1})(\frac {365+1}{2})$

$(1+364)(183)$

$(365)(183)$

$66795$ (in pennies)

While the other answers focus on a specialized subset of the this formula, I thought I would provide a more general form of the formula that is useful in a variety of situations.

phyrfox
  • 141
3

Let $S_1=1+2+3+....+(n-1)+n$,

and $S_2=n+(n-1)+(n-2)+...+2+1$, it should be clear that $S_1=S_2$

Add the two expression gives $S_1+S_2=(n+1)+(n+1)+...+(n+1)$ there are n terms, i.e. $2S_1=n(n+1)$ or $S_1=\frac{n(n+1)}{2}$

3

$1+2+3+...+(n-1)+n=\frac{1+2+3+...+(n-1)+n+1+2+3+...+(n-1)+n}{2}=\frac{(1+n)+(2+n-1)+(3+n-2)+...+(n+1)}{2}=\frac{(n+1)+(n+1)+(n+1)+...+(n+1) \left[ n \mathrm{-times}\right]}{2}=\frac{n(n+1)}{2}$

2

As others pointed out, the answer is $\frac {n(n+1)}{2}$. Here is an intuitive proof:

You can group first and last number whose sum is $n + 1$. The second and the second last have sum $n + 1$. If you continue like that, you will notice that all such pairs have sum $n + 1$ - that is, because the first one gets increased with $1$, the second in the pair - with $-1$. How many pairs are there? $\frac{n}{2}$. So total sum of pairs is $\frac {n(n+1)}{2}$

2

I'm surprised that no one has posted the solution by counting handshakes. If there are $N$ people in a room and everyone shakes hands with everyone else, how many handshakes are there?

Count this two ways. The room starts out with one person. Number $2$ arrives and shakes one hand. Number $3$ arrives and shakes two, and so on, so the total number is $1 + 2 + \cdots + (N-1)$.

Now count the handshakes another way. Each of the $N$ people shakes $N-1$ hands, but that counts each handshake twice, so the total is $N(N-1)/2$.

And do check out the second proof without words here: http://artofproblemsolving.com/wiki/index.php?title=Proofs_without_words#Summations

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199
  • This results in N(N-1)/2 as opposed to N(N+1)/2. And that would be because to use the handshake metaphor each person also needs to shake hands with himself, adding an extra N handshakes. – abligh Jan 06 '16 at 11:22
  • @abligh Or just imagine an additional person. – Ethan Bolker Jan 06 '16 at 11:42
2

The arithmetic progression is the sequence of numbers such that the difference $d$ between the consecutive terms is constant. If the first term is $a_1$, the number of terms is $n$ and the last term is $a_n$, the whole sum

$$ S = \frac{n \cdot (a_1 + a_n)}{2} $$

where

$$ a_n = a_1 + (n - 1) \cdot d $$

In your example $a_1 = 0.01$, $d = 0.01$, $n = 365$, so

$$ a_{365} = 0.01 + (365 - 1) \cdot 0.01 = 3.65 $$

and

$$ S = \frac{365 \cdot (0.01 + 3.65)}{2} = 667.95 $$

If you want to use only $a_1$, $d$ and $n$ then the only one formula from both one above

$$ S = \frac{n \cdot (2 \cdot a_1 + (n-1) \cdot d)}{2} $$

$$ S = \frac{365 \cdot (2 \cdot 0.01 + (356-1) \cdot 0.01)}{2} = 667.95 $$