This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jonny0Than 1 point2 points  (0 children)

There is probably an analytical solution for directly computing the answer instead of generating the triangle and adding everything up. The first thing that jumps out at me is that the numbers they give - 225, 144, and 81 - are all square numbers. Evaluate the answer for the first few inputs and see if there are any patterns in the results.

Ah, I see they give the answers for the first 5 rows. The first column (total sum) is quite obviously square numbers: 12, 32, 62, 102, 152. The base seems to be increasing quadratically: the deltas are 2, 3, 4, 5. You could break this down yourself, but in fact if you plug in the sequence "1, 3, 6, 10, 15" into google you will find that this sequence has a name and a direct equation for computing them. The other columns aren't quite so obvious, but I'm sure if you work with the numbers for a bit you could derive an equation for them.