[math-fun] Efficient way to find solutions?