Let S be the set of all integers that can be written as a sum of 5's and 7's. What is the largest integer not in S?

Solution:

The idea is to get the first five consecutive numbers in S. Then, any number more then those five can be written as one of those five plus a multiple of 5. Clearly

24=5x2+7x2,

25=5x5,

26=5+7x3,

27=5x4+7,

28=7x4.

On the other hand 23 can not be written as a sum of multiples of 5 and 7, because neither of the following numbers:

23, 23-7=16, 23-7x2=9, 23-7x3=2 is divisible by 5.

Therefore, the solution is 23.