My science class is pretty small. There are just 18 students in the class. My teacher, Mr. Burnett, has an unusual system for picking lab partners. He has given each student a number from 1 to 18, and on lab days, he pulls two numbers out of a bag to match people up. During our last lab I noticed that the sum of each pairing was a perfect square. How were the partners paired with each other?

Starting with the biggest,

18+7=25
17+8=25
16+9=25

Now all the numbers 7-10 and 15-18 are taken. That leaves 1,2,3,4,5,6,10,11,12,13,14,15
Taking the easy way out,

1+15=16
2+14=16
3+13=16
4+12=16
5+11=16
6+10=16

There may be other arrangements, but this one falls out the easiest.

This is a neat problem!

The hardest ones to match are those from 16 to 18, since we can only match to a total of 25. The rest can match to a total of 16 and the job is done.

To solve this problem, we need to find all the pairs of numbers whose sum is a perfect square.

First, let's list all the perfect squares between 1 and 18:

1, 4, 9, 16

Next, we need to find all the pairs of numbers from 1 to 18 whose sum is one of these perfect squares.

For 1:
There is no pair whose sum is 1 because the smallest possible sum is 1+2=3.

For 4:
Pairs whose sum is 4: (1, 3)

For 9:
Pairs whose sum is 9: (2, 7), (4, 5)

For 16:
Pairs whose sum is 16: (1, 15), (2, 14), (3, 13), (4, 12), (5, 11), (6, 10), (7, 9)

So, the lab partners were paired in the following way:
(1, 3), (2, 7), (4, 5), (1, 15), (2, 14), (3, 13), (4, 12), (5, 11), (6, 10), (7, 9)