Not totally sure if this question belongs here or what to tag it.
An online problem asked me to find the molecular formula of a certain substance given its mass composition. I found that it was $N_5P_5Cl_{10}$$\ce{N_5P_5Cl_{10}}$. It was incorrect and told me the ordering of my symbols was wrong. I switched it to $N_5Cl_{10}P_5$$\ce{N_5Cl_{10}P_5}$ because that's the order that they appear on the periodic table. It marked me wrong again and told me that the answer was $P_5N_5Cl_{10}$$\ce{P_5N_5Cl_{10}}$, but didn't tell me why it must be ordered this way. Is there a convention that must be followed here?