The film tells the story of the Hungarian mathematician Paul Erdős (played by Johnny Depp), who was a prolific mathematician and problem solver. The movie focuses on his relationship with the British mathematician Srinivasa Ramanujan (played by Dev Patel), who was a self-taught mathematician from India.