I am trying to create a method (in java) to figure out the Electron Configuration for an element.
Ex.
He (2nd element: 2 electrons) Electron config: 1s2
O (8th element 8 electrons) Electron config: 1s2 2s2 2p4
Zr (40th element 40 electrons) Electron config: 1s2 2s2 2p6 3s2 3p6 4s2 3d10 4p6 5s2 4d2
How can I figure out the logic to calculate this? When to increment the s, p, d, and f shells, as well as figure out the superscript for each shell.
S max of 2 electrons (superscript max of 2)
P max of 6 electrons (superscript max of 6)
D max of 10 electrons (superscript max of 10)
F max of 14 electrons (superscript max of 14)
Recursion perhaps?