# Combinatorics of Molecule given the Elements

I have search a lot on Internet and my own researches on a sheet of paper failed to found an analytical closed formula for the following problem:

Considering:

• Common ranges of temperature and pressure
• A FINITE number of given pure elements with their respective valence

Found a lower-bound of all possible complete/incomplete molecules formed involving ALL the given elements (ignoring valences that are indistinguishable).

Examples:

• Given one C, one H. We can form only one "incomplete" molecule: CH (lowerbound=1)
• Given two H. We can form only one "complete" molecule H_2 (lowerbound=1)
• Given one O and two H. We can form H_2 but also H_2O, but also incomplete HO (lowerbound=3)

Thx for feedback

• Not sure what temperature and pressure have to do with this problem. How would you expect T and P to restrict formulae? – Curt F. Jan 5 at 23:44
• Also, when you say "molecule" I assume you mean "empirical formulae". You're not expecting this algorithm to tell apart glucose (C6H12O6) and galactose (also C6H12O6), right? If what you really want is just empirical formulae, OK. There is no way an algorithm could enumerate all of the possible _structures_/molecules, though. – Curt F. Jan 5 at 23:46
• As a first answer, ignore valence requirements and just do the combinatorics. If O is in {0, 1} and H is in {0, 1, 2}, then there are six possible formulae, one of which is the nonsense H0O0. I guess that leaves five. – Curt F. Jan 5 at 23:57
• Check out the database at academic.oup.com/bioinformatics/article/29/2/290/201920 – Curt F. Jan 5 at 23:58