in reply to Spiro Japh

I finally mentally parsed the Perl, but the math is still beyond me. I'm really impressed. Excellently done.