"This implies that $n/\\phi(n)$ increases as the number of distinct prime factors of $n$ increases, so to maximize this quotient, we want $n$ to have as many distinct prime factors as possible.\n",
"\n",
"Furthermore, if $p < q$ for primes $p$ and $q$, then\n",
"$$\\frac{p}{p-1} > \\frac{q}{q-1}$$\n",
"Put simply, this means that smaller prime factors will lead to a larger $n/\\phi(n)$. These two facts suggest we should try numbers that are the product of the first several primes, which are called [primorials](https://en.wikipedia.org/wiki/Primorial). Our answer then is the largest primorial less than 1000000:\n",
"Alternatively, you can just ask SageMath - its implementation of $\\phi(n)$ is fast enough to brute force this problem. However, you might run into difficulties writing your own implementation that's this fast."
"This work is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International license](https://creativecommons.org/licenses/by-sa/4.0/) and the [BSD Zero Clause license](https://spdx.org/licenses/0BSD.html)."