Send Close Add comments: (status displays here)
Got it!  This site "creationpie.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Triangular number 12
by RS  admin@creationpie.com : 1024 x 640


1. Triangular number 12
Twelve days of Christmas Twelve days of Christmas

The Christmas song "The twelve days of Christmas", in the final verse, has 12 lines, or parts, and 78 gifts. The number 78 is an example of a "triangular number". The song is sung over and over.
 
How many total gifts?

2. Total number of gifts
Twelve days of ChristmasThe verses keep adding another line, so the song can be quite long when sung in entirety. How many gifts total?
1*12 + 2*11 + 3*10 + 4*9 + 5*8 + 6*7 + 7*6 + 8*5 + 9*4 + 10*3 + 11*2 12*1


3. Mathematical equation
If one adds all the triangular numbers from 1 to 12, when singing all twelve verses, the total number of gifts is 364. In mathematical terms, the number of gifts g is given by the following formula.

Gift total for the twelve days of Christmas
According to some Christian traditions, the last gift, to make a gift for each day of the year (ignoring leap years), is the gift on Christmas of the birth of the baby Jesus.

4. Computer program
Of course, computer scientists or software engineers may prefer to use a program to count the gifts, such is in the following Lua program.

Here is the Lua code [#1]
Here is the output of the Lua code.

5. Lua
The Portuguese word "lua""moon". Lua was developed in Brazil and has a syntax based on the Pascal (and Modula-2) programming languages.

6. Computer program
Here is a list of "gift" numbers for verses from 1 to 30 in the sense of the total gifts in the "12 days of Christmas". Here is a Lua program to compute these value.

Here is the Lua code [#2]
Here is the output of the Lua code.
The Portuguese word "lua""moon". Lua was developed in Brazil and has a syntax based on the Pascal (and Modula-2) programming languages.

7. End of page

by RS  admin@creationpie.com : 1024 x 640