In the 1997 sci-fi thriller Cube, one of the prisoners, Kazan, appears to be mentally disabled but is revealed later in the film to be an autistic savant, who is able to calculate prime factors in his head.
In the 2006 film Stranger than Fiction, the main character, Harold Crick, is able to perform rapid arithmetic at the request of his co-workers.