Math Bacon Problem