Question: Your friend is a bit eccentric and has a thing for triangles. Anytime she gets some number of coins, she arranges them into a triangle

 Your friend is a bit eccentric and has a thing for

Your friend is a bit eccentric and has a thing for triangles. Anytime she gets some number of coins, she arranges them into a triangle (see images below) and throws away any extra coins which don't fit. For instance, if you were to give her 8 pennies, she would throw away 2 so that her triangle of coins would not have an incomplete row. Write a function called triangle_coins which takes one parameter (the number of coins), and returns the number of coins which must be discarded in order to make a complete triangle of coins. > > > triangle_coins (6) 0 > > > triangle_coins (8) 2 > > > triangle_coins (14) 4 > > > triangle_coins (15) 0 > > > triangle_coins (104) 13 > > > triangle_coins (4370) 92

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!