Perhaps appropriately, “On a Beam of Light” has a daydreamy feel. The prose isn’t as wry as Heiligman’s, and the illustrations (beautifully done by Vladimir Radunsky) are more whimsical. It’s more emphatically a children’s book. But it has the same basic frog-into-prince premise. Einstein’s awkward childhood is followed by a prolific adulthood. His disdain for rules — Einstein hated wearing socks! He ate ice cream whenever he wanted! — enables him to retain his childlike imagination and perceive the universe’s secrets.

Together, the books constitute something of an It Gets Better Project for mathematically precocious children, offering the same sort of affirmation that is now being given to gay and lesbian adolescents. Left unsaid is how Erdos and Einstein might have grown up differently had they been children today. Would young Einstein be characterized as belonging somewhere on the autism spectrum? Would Erdos have been given a diagnosis of A.D.H.D.?

Berne applies the label most people associate with Einstein: “genius.” She seems to feel that genius relieves Einstein of the ordinary burdens of adulthood, as if he were Peter Pan with a pocket protector. “For the first time in his life,” Berne writes, “people started to say, ‘Albert is a genius!’ Now Albert could spend all his days doing what he loved — imagining, wondering, figuring and thinking.”

One slight problem is that the very exclusivity of the genius club might make it difficult for young readers of “On a Beam of Light” to empathize with Berne’s Einstein. If you’re a genius, you can eat as much ice cream (and do as much math) as you like. But you probably aren’t one — so then what?

It’s easier to feel a kinship with Heiligman’s Erdos. Although Heiligman conspicuously avoids assigning labels to Erdos, he’s basically a bit of a nerd. But that old cafeteria put-down is undergoing a transformation. More and more, it is applied to — and used by — people who take an intense interest in a particular subject, and who do so with pride. Few of us might be Erdos or Einstein, but we can all aspire to be nerds.