P104: Used modulo for last 9 and closed form for first 9

I really need to better understand that numerical approximation...