Solution to problem 43.

Probably a little slow due to the repeated long->int[]->long conversions