@cached<EOL><INDENT>def chemical_formula(self):<DEDENT>
counts = {}<EOL>for number in self.numbers:<EOL><INDENT>counts[number] = counts.get(number, <NUM_LIT:0>)+<NUM_LIT:1><EOL><DEDENT>items = []<EOL>for number, count in sorted(counts.items(), reverse=True):<EOL><INDENT>if count == <NUM_LIT:1>:<EOL><INDENT>items.append(periodic[number].symbol)<EOL><DEDENT>else:<EOL><INDENT>items.append("<STR_LIT>" % (periodic[number].symbol, count))<EOL><DEDENT><DEDENT>return "<STR_LIT>".join(items)<EOL>
the chemical formula of the molecule