Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
SaFe DeeP, FeeD SouP 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']
### calculate in order sfdp (SaFe DeeP), present in order fdsp (FeeD SouP) ###
fdsp = lambda i: 'fdsp'.index(i[1])
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; lst = [] # ec = extra charge
for o in 'sfdp':
if ec > 0:
if o == 's' : x = min(ec, 2); lst += [(n, o, x)]
elif o == 'f' and str(n) in '67' : x = min(ec, 14); lst += [(n - 2, o, x)]
elif o == 'd' and str(n) in '4567': x = min(ec, 10); lst += [(n - 1, o, x)]
elif o == 'p' : x = min(ec, 6); lst += [(n, o, x)]
else : x = 0
ec -= x
return r + ' '.join(map(lambda t: f'{t[0]}{t[1]}{t[2]}', sorted(lst, key = fdsp)))
Oct. 29, 2025
Comments: