Partition-theoretic formulas for arithmetic densities