The formula itself was also a guess (due to a high-school teacher named Balmer).
Nobody knew why any of it worked.