The teacher studied an equation while composed a rare gem on the beach.