Maths Olympiad Prep

Library / HMMT February /626 of 1302

HMMT February

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 2≤n≤502 \leq n \leq 50 such that nn divides ϕ!(n)+1\phi^{!}(n)+1.

A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.

Solution

Note that, if kk is relatively prime to nn, there exists a unique 0<k−1<n0<k^{-1}<n such that kk−1≡1( mod n)k k^{-1} \equiv 1(\bmod n). Hence, if k2≢1( mod n)k^{2} \not \equiv 1(\bmod n), we can pair kk with its inverse to get a product of 1. If k2≡1( mod n)k^{2} \equiv 1(\bmod n), then (n−k)2≡1( mod n)(n-k)^{2} \equiv 1(\bmod n) as well, and k(n−k)≡−k2≡−1( mod n)k(n-k) \equiv-k^{2} \equiv-1(\bmod n). Hence these kk can be paired up as well, giving products of -1. When n≠2n \neq 2, there is no kk such that k2≡1k^{2} \equiv 1 ( mod n)(\bmod n) and k≡n−k( mod n)k \equiv n-k(\bmod n), so the total product ( mod n)(\bmod n) is (−1)m2(-1)^{\frac{m}{2}}, where mm is the number of kk such that k2≡1( mod n)k^{2} \equiv 1(\bmod n). For prime pp and positive integer ii, the number of solutions to k2≡1( mod pi)k^{2} \equiv 1\left(\bmod p^{i}\right) is 2 if pp is odd, 4 if p=2p=2 and i≥3i \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,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.