## Challenge 296 : Up, Down, Difference, Sum

Take the integers from 1 to 2n inclusive and split them into two groups containing n numbers each.

For example, if n = 6, I could choose 12, 5, 7, 10, 9 and 2 as my first group, leaving 11, 8, 6, 4, 3, 1 as my second group.

Pick one group and arrange the numbers in ascending order, then put the second group into descending order.

In my example I’d get 2, 5, 7, 9, 10, 12 and 11, 8, 6, 4, 3, 1.

Now pair the numbers in order: my example gives 2 & 11, 5 & 8, 7 & 6, 9 & 4, 10 & 3, 12 & 1.

Finally, find the sum of the differences for each pair.

My example gives

(11 - 2) + (8 - 5) + (7 - 6) +(9 - 4) + (10 - 3) + (12 - 1) =

9 + 3 + 1 + 5 + 7 + 11 = 36.

Try this out on your own division of the integers from 1 to 12 into two equal sized groups.

What happens? Try again!

Can you generalise for the case with integers 1 to 2n?

Prove your generalisation!