since sum of 4 to 5 is 45 then 4 and 5 are the end points, assume 4 is first so we have 45
now for the 3 to 4 sum we can not use 5 obviously so the numbers strictly between 3 and 4 sum to 3434=27 and the numbers to the right of 3 and before 5 sum to 45345=6
now the numbers left to sum to 6 are 1,2,6,7,8,9 so the only way to get 6 is with 6 itself, that means we have
4365
now the 2 to 3 sum is 23 and by similar reasoning we get
472365
and similar reason with 1 to 2 gives us
47218365
and only one place left for 9
472918365
and by starting with 4 on the other side we get the reverse of
563819274
and since they are the only 2 solutions these are the max and min

Posted by Daniel
on 20101022 02:35:35 