## A Multiplication Based Logic Puzzle

### 812 How Many Triangles in All?

Here’s a puzzle for you. How many total triangles are there in the figure below?

Okay, if you guessed 812 because this is my 812th post, you would be right. But what if you were asked that question in some real world situation where accessing the internet to get the answer isn’t permitted. How would you know the answer then?

True, you might have memorized the formula I mentioned in 658-How Many Triangles Point Up? How Many Triangles Point Down? How Many Triangles in All?:

• The total number of triangles = ⌊n(n+2)(2n+1)/8⌋ where the brackets mean round decimals DOWN to the closest integer.
• Here n = 14, so the number of triangles is 14×16×29/8 = 812. Rounding down wasn’t necessary since the product of two consecutive even numbers is always divisible by 8.

Still, you probably wouldn’t remember that formula unless you had seen it VERY recently or you have a photographic memory.

You could actually COUNT all the triangles. In the post about 658 total triangles, I noted that the 13 rows of small triangles formed a total of 169 of the smallest triangles, but I suggested that it would be easier to ignore that nice square number and instead count the number of triangles pointing UP separately from the number pointing DOWN. You will add up a lot of triangular numbers as you sum up the number of them pointing up and again as you sum up the number pointing down.

Making a chart of the number of triangles pointing UP would be easy. It’s just a list of triangular numbers in order. However, the chart for the ones pointing down might be confusing because you don’t use all of the triangular numbers, and the ones you use will be different for an even number of rows than for an odd number of rows. For example,

• the pointing DOWN portion of the chart for 14 rows of triangles below uses these seven triangular numbers: 1, 6, 15, 28, 45, 66, and 91,
• while the pointing DOWN chart for 13 rows of triangles uses six different triangular numbers: 3, 10, 21, 36, 55, and 78.

Here is a chart listing the number of triangles of any size that are contained in a triangular figure made with 14 rows of small triangles. Interesting note: Because 14 + 2 = 16, a multiple of 8, the total number of triangles in this case will be divisible by 14, the number of line segments on each side.

Making such a chart works. However, remembering  which triangular numbers to use and how many you should use, especially when counting the odd number of rows of triangles pointing DOWN, might be difficult.

Today I was thinking about triangular numbers and their relationship to square numbers:

• The sum of two consecutive triangular numbers always makes a square number. On the chart above, I’ve paired up certain consecutive triangular numbers by coloring them the same color. The sizes of the triangles being paired together by like colors are not the same size (with one exception), but their sums are nevertheless square numbers every time.
• Thus, we also can come up with a single list of numbers to add to arrive at the total number of triangles as illustrated below. This has made me changed my mind about using those square numbers to help count! Notice how every other number on each list below, including the last number to be added, is a square number.

Of the methods discussed in this post, this one that includes square numbers might be the easiest one to remember. Here are the steps I used to find the total number of triangles:

• Count the rows and determine if that number is even or odd.
• Write the triangular numbers in order until the amount of numbers written equals the number of rows.
• If the number of rows is even, replace the 2nd, 4th, 6th, etc. entries with corresponding square numbers: 4, 16, 36, etc.
• If the number of rows is odd, replace the 1st, 3rd, 5th, etc entries with corresponding square numbers: 1, 9, 25, etc.
• Add all the numbers remaining in the list. The sum will be the total number of triangles for that many rows of small triangles.

Okay, that puzzle was rather difficult and took a while to explain. You may find this Level 4 puzzle easier:

Print the puzzles or type the solution on this excel file: 10-factors 807-814

Here’s a little more about the number 812:

• 812 is a composite number.
• Prime factorization: 812 = 2 x 2 x 7 x 29, which can be written 812 = 2² x 7 x 29
• The exponents in the prime factorization are 2, 1, and 1. Adding one to each and multiplying we get (2 + 1)(1 + 1)(1 + 1) = 3 x 2 x 2 = 12. Therefore 812 has exactly 12 factors.
• Factors of 812: 1, 2, 4, 7, 14, 28, 29, 58, 116, 203, 406, 812
• Factor pairs: 812 = 1 x 812, 2 x 406, 4 x 203, 7 x 116, 14 x 58, or 28 x 29
• Taking the factor pair with the largest square number factor, we get √812 = (√4)(√203) = 2√203 ≈ 28.4956 (That was three multiples of 7)

812 = 28 × 29, which means it is the sum of the first 28 even numbers.

• Thus, 2 + 4 + 6 + 8 + . . .  + 52 + 54 + 56 = 812

It also means that we are halfway between 28² and 29², or halfway between 784 and 841. The average of those two numbers is 812.5.

AND it means that 28² + 29² – 1 = 2(812) = 2(28 × 29)

Since 29 is one of its factors, 812 is also the hypotenuse of a Pythagorean triple:

• 560-588-812 which is 28 times 20-21-29.

### 658 How Many Triangles Point Up? How Many Triangles Point Down? How Many Triangles in All?

When I first started counting the triangles in the figure, I started by counting the small triangles:

• In the top row there is 1 small triangle.
• In the top 2 rows there are 4 small triangles.
• In the top 3 rows there are 9 small triangles.
• In the top 4  rows there are 16 small triangles,
• and so forth so that in all 13 rows there are 169 small triangles.

As fascinating as that resulting squaring pattern is, it is NOT part of the most efficient way to count ALL the triangles of varying sizes.

The most efficient way to count ALL the triangles can be found on The University of Georgia’s website: Count the triangles that are pointing up separately from the triangles pointing down. Counting charts for triangles with 4, 5, 6, 7, and 8 rows of triangles are displayed on that website. I made a similar chart for these 13 rows of triangles:

Notice all the triangular numbers on the chart!

Because 13 divided by 2 is 6.5, we see that 6 is the largest base size that has any triangles pointing down. Because 6.5 is not a whole number, there are 3 triangles that point down with a base size of 6.

Triangles made from an odd number of rows use these triangular numbers to count the triangles pointing down: 3, 10, 21, 36, 55, 78, etc.

Triangles made from an even number of rows have no remainder when divided by 2 so the triangle with the largest base size is the number of rows divided by two. There will only be one triangle with that base size and the triangular numbers used for that base size and smaller are 1, 6, 15, 28, 45, 66, 91, etc.

The Mathematics Stack Exchange had a discussion on how to count all the triangles, and a formula was posted:

The total number of triangles = ⌊n(n+2)(2n+1)/8⌋ Note: the brackets mean round decimals DOWN to the closest integer.

I made a chart showing the results of using the formula for n = 1 to 13:

Thus we see that 658 is the total number of triangles that can be counted in a triangle made from 13 rows of triangles.

• 658 is a composite number.
• Prime factorization: 658 = 2 x 7 x 47
• The exponents in the prime factorization are 1, 1, and 1. Adding one to each and multiplying we get (1 + 1)(1 + 1)(1 + 1) = 2 x 2 x 2 = 8. Therefore 658 has exactly 8 factors.
• Factors of 658: 1, 2, 7, 14, 47, 94, 329, 658
• Factor pairs: 658 = 1 x 658, 2 x 329, 7 x 94, or 14 x 47
• 658 has no square factors that allow its square root to be simplified. √658 ≈ 25.65151.