CoCalc Public FilesSelling buttons.ipynbOpen with one click!
Authors: Randy Cazales, Sharalee Jones , MIRALIA MOREAU, Tunazzina Mahdin, Mekeisha Naughton, Katherine Rosero
Views : 31
Description: This is about finding the largest number of buttons that can not be purchased in a company that sells buttons in packages of 7 and 11.
Compute Environment: Ubuntu 20.04 (Default)

this is about a company sells buttons in packages of 7 and 11. We need to determine the largest number of buttons that cannot be purchased with these packages. To find out about that I define a function button.

In [1]:
def button(n): if n<=0: return 0 elif n==7 or n==11: return 1 else: return max(button(n-7), button(n-11))
In [2]:
button(9)
0
In [6]:
for i in range(55,67): print(i,button(i))
55 1 56 1 57 1 58 1 59 0 60 1 61 1 62 1 63 1 64 1 65 1 66 1

I found out the largest number of buttons that cannot be purchased with these packages is 59 because after 59 the last seven row is one meaning people can purchase 60 and up.