When Seymour Cray, designer of the world's fastest, smartest computers, reached a creative impasse, he'd hit the dirt: for several years he dug a tunnel eight feet high and four feet wide that ran from his rural home toward the shore of Lake Wissota, in western Wisconsin.

The manual labor cleared his mind, the 68-year-old Cray told John Rollwagen, former chairman of Cray Research. And while he was shoveling, Cray said, woodland elves slipped into his office and solved his problems.

Rollwagen shared the whimsical story with the press, apparently believing that this feat of clay would humanize the elusive genius. A company spokesman told me the inventor did some of his most inspired troubleshooting in the tunnel. (What better place to think deep thoughts than underground?)

After hearing about Cray, I started wondering what diversions other scientists choose when they encounter a mental roadblock.

We know that the nineteenth-century French mathematician Jules- Henri Poincaré traveled when he was stuck on a problem; a change of scene more than once led to what seemed the spontaneous untangling of a knotty problem. He described this form of divertissement and its satisfying results in a celebrated lecture before the Société de Psychologie. (He began with an apology I find especially charming: "I beg your pardon; I am about to use some technical expressions, but they need not frighten you, because you are not obliged to understand them.")

Poincaré (known to close friends by his childhood nickname ) was working on his famous theory of the Fuchsian functions (which need not frighten us, because we are not obliged to understand it). He'd solved most of the problem one night in a caffeine rush; then he hit a dead end.

"Disgusted with my failure, I went to spend a few days at the seaside and thought of something else. One morning, walking on the bluff, the idea came to me with . . . suddenness and immediate certainty, that the arithmetic transformations of indeterminate ternary quadratic forms were identical with those of non-Euclidean geometry."

Perhaps you were otherwise employed when you first realized that the arithmetic transformations of indeterminate ternary quadratic forms were identical with those of non-Euclidean geometry: playing the ocarina, maybe, or organizing your Three Stooges memorabilia, or digging a tunnel. The point is, some head-clearing pastime helped you solve your problem. What might have seemed to the untutored a frivolous and dilatory act was actually a vital component of creation.

In 1926 the political and social scientist Graham Wallas delineated the four stages of creative thought: preparation, or the accumulation of the background knowledge to solve a problem (Archimedes wasn't just any old guy sitting in the tub playing with his rubber duk and getting pruny--he'd prepared for that moment of relaxation-mediated inspiration with a life of rigorous work and study); incubation, the time when you step back and let the idea simmer; illumination, the moment when the solution dawns, seemingly from nowhere; and verification, the hard proof that follows the shriek of Eureka!

The simmering period interests me most--what physicists and mathematicians do when they kick back. According to George Tremberger Jr., director of Barnard College's History of Physics Lab, Isaac Newton engaged in few leisure activities except gardening, and he hired someone to do the dirtiest work. René Descartes liked to stay in the sack until late morning, cogitating. Niels Bohr did crossword puzzles; George Gamow was a western- movie freak. Einstein relaxed with the violin, of course; he also loved sailing, which he called "the sport that demands the least energy."

Caltech physicist and Nobel laureate Murray Gell-Mann says that ideas may come when he's cycling, walking, or cross-country skiing. "And while I'm shaving too," he adds. (Women in physics will want to know whether legs count.) "Talking to people about anything, even about the problem, is also useful.

"I once made a slip of the tongue during a lecture that led to an important discovery. It was in 1952, and I was trying to explain the properties of strange particles--strange because they were copiously produced but decayed slowly, in one ten-billionth of a second, which is slow for particle physics. I had had an idea for how to explain them, but it didn't work." During a visit to the Institute for Advanced Study at Princeton, some colleagues asked Gell-Mann to explain the failed idea. He was discussing the numbers that would solve the problem, which, according to conventional wisdom, would have to involve halves (we are not obliged to understand). He meant to say five halves but slipped and said one. "And I stopped and exclaimed, 'It would work!' Here was a solution I'd probably been chewing on for some time below the level of conscious thought."

Humor is a characteristic brain refreshment for the spiritual children of Pythagoras, says Temple University mathematician John Allen Paulos, author of Mathematics and Humor (soon to be a major motion picture with Steve Martin as Mathematics, Lily Tomlin as Humor, and Julia Roberts as And). "Pure mathematics and humor share tools and techniques," he says. "Because we take things literally in our work, we take words and phrases literally, which is often very funny." At Princeton in the 1930s, there was a fad among mathematicians for inventing jokes about mathematical methods for catching lions. For example:

The method of inversive geometry: We place a spherical cage in the desert, enter it, and lock it. We perform an inversion with respect to the cage. The lion is then in the interior of the cage, and we are outside.

Maybe you had to be there.

Adds Paulos, "Our work also predisposes us to appreciate various combinatorial manipulations like juxtaposition, recursion, and word reversal, or notions in logic, such as reductio ad absurdum or self- reference. For example, Q: 'Why do philosophers ask so many questions?' A: 'Why shouldn't philosophers ask so many questions?' Nonstandard models, which are useful in math, demonstrate that various conditions can be satisfied in more than one way. That leads to the 'What's black and white and re(a)d all over?' genre of joke--the unexpected answer ranging from a newspaper to a wounded nun." Paulos's favorite dumb math joke:

Mathematician: How do you spell Henry?

Unsuspecting Victim: H-E-N-R-Y.

Mathematician: No, H-E-N-3-R-Y. The three is silent.

Maybe you had 2-B there.

Some scientists, like physicist Melissa Franklin of Harvard and Fermilab, relax by doing more science. Franklin says that when a problem has fried her brain, she chills out by trying to solve other problems.

"At Fermilab, I'd come in on weekends and work on things for fun. For example, we were working on a proton-antiproton collider experiment, looking for the top quark. I build detectors, and I was getting interested in improving them using electronics. It was refreshing because nobody was pushing me to do it and there was no huge responsibility on my head."

Dr. Franklin! No horseshoes? No Yahtzee? "No, but some of us did a little experiment in the Harvard biology lab a couple of years ago that was enormously fun. It was wild and crazy, something you wouldn't want to put on your vita: a search for very massive protons." (Confidential to nonphysicists: Do you think that's anything like a snipe hunt?) "We were assuming that these protons, if they existed, came from the Big Bang and would be landing on the bottom of the ocean. So we tried to get water from the bottom of the ocean, from rocks and oil wells. We centrifuged and filtered the water; the idea was that heavy things would stay at the bottom. We built something that measures the density of a drop of water, and sat around dropping water into this density gradient. That was fun.

"Oh, and I had a lot of fun recently with the electric pickle."

As who of us has not! The electric pickle is an experiment that was a tremendous success in Franklin's freshman electronics class. You go to a deli, see, and get a big kosher dill pickle, seven or eight inches long. Then you cut the cord off an old electric appliance and strip the ends to expose two or three inches of split wire. (Unplug it first.) Get two two- or three-inch nails, wrap one strand of wire around each nail, and stick the nails into the pickle. Then plug in the cord. "After about 10 seconds," Franklin explains, "the pickle will light up, glowing and crackling. It's really quite bright." What happens is that the brine, which is a good electrical conductor, goes through chemical decomposition. It actually burns for about 45 seconds. "You can try it at home," says Franklin, "but don't touch the pickle."

At some point in my informal survey, I was struck by how many more mathematicians than I would have expected--literally bunches, with a standard deviation of heaps--juggle. Persi Diaconis is a Harvard mathematician, statistician, and magician. (I like the ring of "Harvard magician.") He has recently devoted several sessions of his seminar on algebraic combinatorics to the mathematics of juggling. He says that while he believes only 10 or so of the nation's 20,000 mathematicians are after- hours magicians, perhaps 1,000 are jugglers, a number he considers statistically insignificant but that I consider astonishing. (Adds Diaconis, "I also know a lot of mathematicians whose passion in life is cheap detective novels--the worst sleaze, with lurid covers. They trade them among themselves, though they'd never own up to it." He once served as book bagman between a famous Berkeley mathematician and a famous Stanford mathematician who, I suppose, couldn't wait to send each other Blonde on a Tangent or Dial N for Nightmare [Where N = Infinity]).

But we were talking about juggling. Follow the bouncing ball, and let's agree not to make any remarks about juggling figures; mathematical folks involved in the circus arts don't want to hear them any more than chef-accountants welcome comments about cooking the books.

Diaconis's friend Ron Graham is director of information-sciences research at Bell Laboratories, University Professor of Mathematics at Rutgers, and president of the American Mathematical Society. He is also past president of the International Jugglers Association.

"I like my leisure with unusual challenges that help me get a new perspective," he says. "Like trying to juggle three Ping-Pong balls using two Ping-Pong paddles instead of my hands. That helps me see things in a different perspective and gets my blood flowing."

Graham also likes to bounce ideas off a trampoline. He was once, in fact, a circus performer. "In some sense juggling and acrobatics are an extension of the mathematical work. When I'm working on a problem it's important for me to get up and walk around, and a one-armed handstand is my way of walking around.

"The eureka experience is common in the morning, after a night's sleep. It's well accepted by most mathematicians that an effective way of working on a problem is to think about it hard, put it away, and let the brain do whatever it does to sort ideas, throw out the bad ones, and make unconscious connections." And sometimes Graham's brain best does whatever it does upside down.

"I was working on a combinatorial problem having to do with Ramsey theory, which is based on the fact that it's impossible for something to be completely chaotic; there's some order in even the most disordered situation." (Per Poincaré, we are not obliged to understand, though doing so might better equip us for life in the twenty-first century.)

"I was trying to capture that idea in a quantitative way, and I made an interesting connection in the middle of a back somersault with a triple twist. That complex a performance has to be reflex: you think the name of the trick and the body does the rest, so your mind is free. You can't always leave reality as freely as you might like. My wife [mathematician Fan Chung] was thinking seriously about a problem one day and ran her Honda into the back of a truck."

At the seventy-fifth-anniversary meeting of the Mathematical Association of America four years ago, Graham and fellow mathematician- jugglers Joe Buhler of Reed College, who is also a rock pianist, Brad Jackson of the University of California at Santa Cruz, and Peter Frankl, now living and working in Japan, put on a mathematical circus. (Buhler and Graham have even developed a language like musical notation for writing down juggling patterns.) Then the foursome presented papers discussing the math behind magic, music, juggling, and bouncing. Graham expounded on the one-armed handstand. "The fact that you do it on movable pedestals makes it easier. If you balance a broom on your palm, it's easier if you can move your hand around; if your hand remains stationary, it's much harder to balance. From the point of view of physics, if you want to keep something in balance, the center of gravity and the support point must be lined up. If you're on parallel bars or the ground, the point of support is fixed, so that when the center of gravity drifts, you have to exert more force in order to balance." Doing a handstand on a cane or something wobbly looks harder, Graham says, but the physics of the thing is much easier--you're the broom in the moving palm.

"And there are a lot of philosophical linkages between math and computer science and juggling. One is the search for pattern and structure. Another involves human error: Jugglers say the trouble with juggling is that the balls go where you throw them. Computer scientists say the problem with computers is that they do what you tell them. In both cases, any problems are our fault."

Graham and Diaconis are writing a book about mathematics and magic tricks. "Every chapter will begin with a good trick; then, in order to understand the trick, you'll have to learn something about math," says Graham.

Diaconis specializes in probability theory. "I'm the guy who figured out it takes seven shuffles before cards are really mixed up," he says. His form of relaxation is to invent magic tricks and perform them, something he's been doing since he was 5. Diaconis ran away from home at 14 to become a magician's assistant and toured until he was 24, when he started college.

"Martin Gardner brought me to math. When I was a kid in New York, he and magicians like Vernon hung around at a cafeteria on Forty-second Street. I used to invent tricks, and Martin put one of my tricks into Scientific American. It was a problem of how to make an unfair coin-flip fair. Suppose you and a friend want to flip for who will pay a restaurant check. Your friend takes out a coin that's warped. Or let's say he wants to flip something oddly shaped, like a thumbtack. He says that when it lands with the point touching the floor, you'll call that heads; if it lands with the point not touching the floor, you'll call that tails. You don't know the odds, you don't know the bias of the coin or tack, and you want to find a way to flip fairly. The thing I thought of was to flip twice. If it comes up heads-heads or tails-tails, you do it again. If it comes up heads-tails, you call that a generalized head. If it comes up tails-heads, you call that a generalized tail. If the coin or tack is skewed or unfair, no matter what its propensities, the chances of its coming up heads-tails are the same as the chances of its coming up tails-heads. The double flip gives you a mechanism for taking an unfair coin with an unknown bias and making it fair. Much later, by the way, I found out that John von Neumann had figured out the same thing decades before."

Two years ago Diaconis taught a freshman seminar on mathematics and magic. "Seventy students wanted to take the class," he says, "but I took only 12. Half the kids had a math background and half had a science background. After the class, two went off to do street performing on their own."

For Diaconis, magic isn't really an escape from the rigors of mathematical thought. "Throughout my career, math and magic have interplayed," he says. "Math is all-consuming. It's not a job--it's what I do and who I am. When I need a break to shake my head out, I cook Greek food. You can't cook and solve equations at the same time--although I believe the old subconscious is working all the time, and I let it simmer along with my pastitsio. In fact, I trust my subconscious more and more. That back burner is an important part of creative thought."