Notice that this commit is earlier than the publication on http://rosettacode.org/

Full-blown BigInt version, bugs fixed, overflow detection added,