Additionally, that dude is a human super computer ("mentat" in the fiction). In the movie, they chose to portray him doing hard math by having his eyes roll back in his head.