@StefanPochmann Yes, the second solution is certainly a stretch of the rules, but still a fun exercise. I do think that it can be argued that I don't use a BigInteger library: I use the standard int (which surely is allowed, right?). I agree with you that I use it in a way which does violate the intention of the rules (but I think not the rules themselves ;).
I've changed the title to remove the "legal" part to avoid confusion and I won't argue further on its "legality", since as originally mentioned the one-liner is just for fun. The "normal" answer is the first one.