Maths Olympiad Prep

Library / /533 of 860

Number theory Difficulty 5.2 AIME, harder Find the answer

Define ϕ!(n)\phi^{!}(n) as the product of all positive integers less than or equal to nn and relatively prime to nn. Compute the number of integers 2n502 \leq n \leq 50 such that nn divides ϕ!(n)+1\phi^{!}(n)+1.

A number or a short expression. Spacing and $ signs are ignored.

Solution

Note that, if kk is relatively prime to nn, there exists a unique 0<k1<n0<k^{-1}<n such that kk11(modn)k k^{-1} \equiv 1(\bmod n). Hence, if k2≢1(modn)k^{2} \not \equiv 1(\bmod n), we can pair kk with its inverse to get a product of 1. If k21(modn)k^{2} \equiv 1(\bmod n), then (nk)21(modn)(n-k)^{2} \equiv 1(\bmod n) as well, and k(nk)k21(modn)k(n-k) \equiv-k^{2} \equiv-1(\bmod n). Hence these kk can be paired up as well, giving products of -1. When n2n \neq 2, there is no kk such that k21k^{2} \equiv 1 (modn)(\bmod n) and knk(modn)k \equiv n-k(\bmod n), so the total product (modn)(\bmod n) is (1)m2(-1)^{\frac{m}{2}}, where mm is the number of kk such that k21(modn)k^{2} \equiv 1(\bmod n). For prime pp and positive integer ii, the number of solutions to k21(modpi)k^{2} \equiv 1\left(\bmod p^{i}\right) is 2 if pp is odd, 4 if p=2p=2 and i3i \geq 3, and 2 if p=i=2p=i=2. So, by Chinese remainder theorem, if we want the product to be -1, we need n=pk,2pkn=p^{k}, 2 p^{k}, or 4. We can also manually check the n=2n=2 case to work. Counting the number of integers in the allowed range that are of one of these forms (or, easier, doing complementary counting), we get an answer of 30. (Note that this complicated argument basically reduces to wanting a primitive root.)

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.