Anna to the Infinite Power by Mildred Ames (1981) — see its film and TV adaptations.
A 12-year-old math whiz accidentally learns the startling facts about her true identity and her role in an important secret experiment.