In the first passes I used integers. They overflowed. I then switched to long but they had the same fate. I then switched to BigIntegers.

If you have comments or questions regarding this or any other post in this blog, please do not hesitate and send me a message. Will reply as soon as possible and will not use your name unless you explicitly allow me to do so.