Epicycle by P. J. Plauger. It was published in Analog, November 1973.
The first mention in the story is:
"No, seriously," I hurried on. "If you were to ask a mathematician to test it he might say: 'Let me see, now. One is prime, three is prime, five is prime, seven is prime. Nine? Nine's not prime. Clearly the theorem is false.'
"But a physicist is more pragmatic. She, I mean he," the slip was calculated, and had the usual effect on a male listener, "might say: 'Let me see, now. One is prime, three is prime, five is prime, seven is prime. Nine? That may be an experimental error—let's go on.' "
Jenkins smiled.
"Eleven is prime, thirteen is prime, fifteen is… Well, that's a lot of data points. The theorem is probably true.'"
He laughed outright.
"But if you ask an engineer to test the theorem, he might say: 'Let me see, now.
One is prime, three is prime, five is prime, seven is prime, nine is prime, eleven is…'"
Then the later mention is:
A little vindictively, I began, "You know, I just thought of another of those stories we used to tell back in school." Again, my entertainment-starved audience was all ears.
"This is about a hotel, where a mathematician, a physicist and an engineer are spending the night in separate rooms. Late at night a fire breaks out and spreads rapidly to each of the rooms. What do you suppose they do?
"Well, the engineer wakes up, smelling smoke. He sees the fire and quickly dashes out into the corridor, grabs a fire extinguisher off the wall, runs back to his room and drowns the flames. For safety, he then soaks the walls, ceiling, floor and mattress.
Tossing the empty extinguisher aside, he climbs into his soggy bed to get what sleep he can.
"Then the physicist wakes up, smelling smoke. He sees the fire and quickly dashes out into the corridor, grabs a fire extinguisher off the wall, runs back to his room and makes a brief test blast. After a quick calculation, he aims a four-second blast at the base of the fire and puts it out. Setting the extinguisher next to his bed, he lies down to rest and watch for another outbreak."
That was my favorite part.
"Then the mathematician wakes up, smelling smoke. He sees the fire and quickly grabs a pad of paper and a pencil. He makes a number of calculations, glances at the fire, makes a few more. After a while, he wanders into the bathroom, turns on the tap and dabbles his fingers in the water. Looking back at the fire, he smiles and says:
'Aha! A solution exists!' Then he goes back to bed."