It's a science fiction book from the seventies or likely earlier. I might not remember it entirely correctly but the premise was that after someone dies their brain is harvested and wired into a computer to be used as a supercomputer. No one realizes that this actually brings the brains back into consciousness, the assumption was that being dead they are just being used as biocomputers. The huge pressure to solve mathematical problems drives the brains insane. The main character wakes up in this situation but is somehow able to push the pressure aside. Through telepathy he's able to find another brain in this situation and eventually somehow transfers his mind back into the body of a regular person and escape.
Any help in identifying this would be appreciated - I would love to read it again.