Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Xs and Os solution in Clear category for Noble Gas Notation by Max0526
ATOMIC_NUMBERS = AN = {
'H': 1, 'He': 2, 'Li': 3, 'O': 8, 'Ne': 10, 'Na': 11, 'Al': 13, 'Cl': 17, 'Ar': 18,
'K': 19, 'V': 23, 'Br': 35, 'Kr': 36, 'Rb': 37, 'In': 49, 'I': 53, 'Xe': 54,
'Ir': 77, 'Tl': 81, 'Rn': 86, 'Fr': 87, 'Db': 105, 'Ds': 110, 'Ts': 117, 'Og': 118}
NOBLE_GASES = NG = ['He', 'Ne', 'Ar', 'Kr', 'Xe', 'Rn', 'Og']
def notation(e):
if e in ('H', 'He'): return f'1s{AN[e]}'
for g in reversed(NG):
if AN[e] > AN[g]: r = f'[{g}]'; base = AN[g]; n = NG.index(g) + 2; break # n = period
else:
r = ''; base = 0; n = 1
ec = AN[e] - base; orbitals = [] # ec = extra charge
for o in 'sfdp':
if o == 's' and ec > 0: x = min(2, ec); orbitals += [(3, n, o, x)]
elif o == 'f' and n in [6, 7] and ec > 14: x = 14; orbitals += [(1, n - 2, o, x)]
elif o == 'd' and n in [4, 5, 6, 7] and ec > 0: x = min(10, ec); orbitals += [(2, n - 1, o, x)]
elif o == 'p' and ec > 0: x = ec; orbitals += [(4, n, o, x)]
else: x = 0
ec -= x
s = ' '.join('{n}{o}{x}'.format_map({'n': n, 'o': o, 'x': x}) for _, n, o, x in sorted(orbitals))
return r + (' ' + s if s else '')
Oct. 27, 2025
Comments: