SPOJ MINCOUNT WA

Can somebody suggest me how to approach this sum. How is the answer coming as (n*(n+1))/6.What is the proof behind such a formula?

MINCOUNT

Thanks in advance.

when you make an equilateral triangle with n rows of coins, the number of coins is given by

T(n)=n(n+1)/2 link text

The number of moves to invert the triangle is T(n)/3 ignoring the remainder link text

I’ve verified upto n=6… then I ran out of coins

2 Likes