About 50 people were invited to a potluck. Each invitee was required to bring an equal number of homemade cookies to the potluck.

In the potluck, 1287 cookies brought by the guests were poured into the pot and shuffled. The cookies were then distributed equally among all the guests present. No cookies were broken.

Sam was one of those who completely forgot about bringing cookies to the potluck. About 20 people with cookies had arrived at the potluck before him. How many cookies did Sam get?

## Sai Shruti Shetty solved this puzzle:

The factors of 1287 are: 1, 3, 9, 11, 13, 33, 39, …

There are less than or equal to 50 people who turned up and there were at least 20 people. And a total of 1287 cookies. Assumption made by me: Those who brought cookies brought an equal number of them. Others didn't bring cookies at all.

So, there had to be either 33 people who got 39 cookies each, or 39 people who got 33 cookies each, excluding yourself (Sam) and others who didn't bring cookies.

Now the problem narrows down to finding a case of equal distribution of cookies for a number of guests between 33 and 50, or a number between 39 and 50. Since none of the cookies is broken, the solution must be: 33 people brought 39 cookies each, and a total of 39 people turned up. Sam got 33 cookies.

## Indhu Bharathi solved this puzzle:

Answer: 33.

So, 39 people turned up out of which 33 brought cookies. Each of the 33 brought 39 cookies totaling to 1287. 1287 was divided among 39 people - 33 cookies each. So, Sam got 33 cookies.

## Joshua Tobin solved this puzzle:

Well 1287 = 3 × 3 × 11 × 13. At least 20 guests made cookies, and at most 75 say (we were told around 50 were invited, any more than 75 probably shouldn't be considered as around 50). Each person brought the same number of cookies, so the number of people that made cookies must divide into 1287. From the prime factorisation of 1287 we see that the number of guests who made cookies must be 33 or 39. The total number of guests present must also divide into 1287, and this is also between 20 and 75.

So the total number of guests is also 33 or 39. But the total number of guests is larger than the number of guests that brought cookies (because Sam is a guest, but didn't bring cookies). So the total number of guests is 39. So each person got 1287/39 cookies, that is 33 cookies.