Solution to problem 57 (and some LargeInt tweaks)