Watching the series, I wonder if I picked up the game from the foundation books. I honestly can't recall now. She goes up to 80 something million in the TV series!
I don't recall the prime number counting from the books. I think they just included it in the show to convey that Dornick is a math genius, as reciting large primes like she does is incredibly hard.