Find all positive integers $ n$ such that there exists a unique integer $ a$ such that $ 0\leq a < n!$ with the following property: \[ n!\mid a^n + 1 \] Proposed by Carlos Caicedo, Colombia
Problem
Source: IMO Shortlist 2005 N4, Iran preparation exam
Tags: factorial, modular arithmetic, number theory, Divisibility, exponential, IMO Shortlist, Chinese Remainder Theorem
25.04.2006 05:39
If $n$ is even,$a^n+1=x^2+1,(x=a^{\frac{n}{2}})$ So 3 doesn't divide $a^n+1$ and we see 3 doesn't divide $n!$ So $n=2$. But what if $n$ is odd,
25.04.2006 21:58
We can use well-known (actually I never proved it with $a+1$ but rather $a-1$ but in this case I bet result is still valid and proof doesn't change much [induction]) if $p^b || a+1$ then $p^c || n$ is equivalent to $p^{b+c}||a^n+1$. Using that $v_p (n!)= \sum_{i=1} ^{\infty} [\frac{n}{p^i} ]$ we can compare $v_p(a^n+1)$ and $v_p(n!)$ and quickly bring whole problem to checking manually some small $n$.
25.04.2006 22:05
No you cant since there are $\infty$ many $n$ with that property Or how would you do it¿
25.04.2006 22:11
I would fix $n$ and assume that there exist such an $a$, then use above (from which we get bound on $n$) - is there really infinite number of solutions ? (can you show some infinite family of solutions) Edit: I've seen my mistake - I thought $0 \leq a < n$
25.04.2006 22:18
Exactly the primes work But I will not post a proof that they work since this spoils half of the problem.
25.04.2006 23:00
Nima Ahmadi Pour wrote: Find all $n$ such that there exists a unique integer $a$ such that $0\leq a<n!$ with the following property: \[ n!|a^n+1 \] If $n!$ divides $a^n+1$ then $gcd(n,a) = 1$. But $a < n$. Hence $a = 0$ or $1$. Then $n!$ can be $1$ or $2$, so $n$ is $1$ or $2$.
25.04.2006 23:14
Surely not, just try $n=3,5,7,...$ I think you missinterpreted some places of $!$'s.
25.04.2006 23:17
Sorry it's $a<n!$ I 'll try to come up with a solution
27.04.2006 13:51
Check that for $n=2,3$ there is unique $a$ satisfying problem. Now assume $n \geq 4$. - If $n$ is even then $4|n!$. Hence $4|a^n+1$ and we get a contradiction. - If $n$ is odd composite then there are at least two such $a$'s: Obviously for $a=n!-1$ we have $n!|a^n+1$. Lets prove that if $a=(n-1)!-1$ then $n!|a^n+1$. Note that \[a^n+1=((n-1)!-1)^n+1=((n-1)!)^2A+(n-1)!n-1+1=((n-1)!)^2A+n!\] Because $n$ is composite $n!|((n-1)!)^2$ and so $n!|a^n+1$. Hence there are at least two such $a$'s. - If $n$ is prime then there is unique such $a$: Let $n!=p!=r_1^{a_1}r_2^{a_2}....r_k^{a_k}$ be the prime factorization of $n!$ and let $(r,b)=(r_i,a_i)$ for some $i$ so that $r^b|a^p+1$. Then $r^b|a^{2p}-1$ and from Euler's theorem we also have $r^b|a^{r^{b-1}(r-1)}-1$. So $r^b|a^d-1$ where $d=\gcd(2p,r^{b-1}(r-1))|2$ . If $d=1$ then $a^p+1\equiv 2 \mod r^b$ which is obviously a contradiction. So $d=2$ and $r^b|a^2-1=(a-1)(a+1)$. If $r$ is odd then then $a\equiv 1 \mod r^b$ or $a\equiv -1 \mod r^b$. As above we must have $a \equiv -1 \mod r^b$. If $r=2$ then taking $a=2k+1$ gives $2^{b-2}|k(k+1)$. If $k\equiv 0 \mod 2^{b-2}$ then $a^p+1=(2k+1)^p+1\equiv 2 \mod 2^{b-1}$. Since $b \geq 3$ this is a contradiction. So $k\equiv -1 \mod 2^{b-2}$ and $a\equiv -1 \mod 2^{b-1}$. If $a\equiv 2^{b-1}-1 \mod 2^b$ then \[a^p+1 \equiv (2^{b-1}-1)^p+1 \equiv 2^{b-1} \mod 2^b\] This gives $a\equiv -1 \mod 2^b$. Thus we proved that $a\equiv -1 \mod r_i^{a_i}$ for all $i$. From the Chinese remainder theorem this system of equations has unique solution in $[1, r_1^{a_1}r_2^{a_2}....r_k^{a_k})=[1, p!)$. Hence when $n$ is prime there is unique such $a$.
30.11.2008 20:24
I have the same as cefer for evens and primes, but my proof for odd composite is a little different.
26.06.2009 16:32
Note that $ n = 1, 2, 3$ are solutions. Suppose that $ n \geq 4$ is a solution, and let $ a$ be the unique integer. $ a$ and $ n!$ are relatively prime, since $ (a, n!) \leq (a^n, n!) \leq (a^n, a^n + 1) = 1$. I. The equation $ x^n \equiv_{n!} 1$ does not have a solution in $ 2 \leq x \leq n!$. Proof. Suppose the contrary, and let $ 2 \leq x \leq n!$ be a solution to that equation. Then $ (ax)^n \equiv a^n x^n \equiv - 1 \pmod {n!},$ hence $ ax \equiv_{n!} a$ hence $ x \equiv_{n!} 1,$ contradiction. II. $ n$ is prime. Proof. Suppose the contrary, and let $ q$ be the least prime divisor of $ n,$ so that $ 2q \leq n.$ Then $ q \,|\, \tfrac{n!}{q},$ and $ x = \tfrac{n!}{q} + 1$ satisfies $ x^n - 1 = \tfrac{n!}{p} (1 + x + \cdots + x^{n - 1})$ and also $ 1 + x + \cdots + x^{n - 1} \equiv_p 1 + 1 + \cdots + 1 \equiv_p 0,$ hence $ n!$ divides $ x^n - 1,$ contradiction. III. All primes are solutions. Proof Let $ p$ be a prime. Then $ a = p! - 1$ is a solution to $ p! \,|\, a^p + 1.$ Suppose that $ b$ is another solution, then (because both are relatively prime to $ p!,$) $ b^{ - 1}a \bmod p!$ is a solution to $ x^p \equiv_{p!} 1,$ then $ (x, p!) = 1$ so if $ \delta$ is the order of $ x$ modulo $ p!$ it must be $ \delta \, |\, p$ and $ \delta \,|\, \phi(p!),$ and since $ (p, \phi(p!)) = 1,$ $ \delta = 1,$ so $ x = 1.$ Hence $ b^{ - 1} a = 1$ so $ a = b$ and we have that $ a$ is indeed unique.
11.03.2010 04:26
10.10.2012 04:58
16.04.2014 19:43
ONE MUST NOT FORGET: Also note that if $n=1$, the only possible $a$ is $a=0$ since $0 \le 0 \textless 1$ and it works, so $n=1$ works. Zhero wrote: Note that $ n \neq 1$, since we cannot find an integer between 0 and 1!. That is wrong since $n=1$ is possible.
30.04.2014 15:49
Step 1. $n=1$ is a solution Step 2. For even $n$ we have that if $a$ satisfies then so does $n!-a$ so we must have $a=\frac {n!}{2}$ and for $n\ge 4$ we get that $n|1$ absurd. Step 3. $n=2$ is indeed a solution Step 4 For odd composite $n=pq$ where $p$ is prime and $q\ge 3$ we have $p^h||n!-1$ with $a\ge 2$ then easily find with LTE that we can choose more then one $a$ modulo $p^h$ such that $p^h|a^p+1|a^n+1$ giving using chineese remainder theorem to possibilities for $a$ mod $n!$. Step 5 For prime $n=p$ we prove that for each $q^h||n!$ and $q^h|a^p+1$ we have $q^h|a+1$ and again finish with chineese remainder theorem. Step 6 Acknowledge your awesomeness
27.05.2014 22:17
We shall check for primes and composites seperately. Composite Consider $n \ge 3$.Then for even $n$ we have $4 \mid n! \mid a^n+1$.But remainders of $a^n+1$ modulo $4$ are $1,2$.So there do not exist such $a$. Consider odd $n$.It is obvious that $n! \mid (n!-1)^n+1$ so one of the choices for $a$ is $n!-1$.Also note that if $p$ is a prime divisor of $n$ then $n!|(\frac{n!}{p}-1)^n+1$ since each term on the RHS is a multiple of $n!$.(Note that if $p|n$ then $p^2 \mid n!$.Thus there are atleast two choices for $a$. Prime Let $p \ge 3$ be a prime $\le n$ where $n$ is another prime.If $p \mid \frac{a^n+1}{a+1}$ then $p \mid -(a^n+1)=(-a)^n-1$ and $p \mid (-a)^{p-1}-1 \Rightarrow p \mid (-a)^{\text{gcd}(n,p-1)-1}=-(a+1)$.We then see that $\frac{a^n+1}{a+1} \equiv n\pmod{p}$ which shows that $p=n$.We now also see that $\text{gcd}(\frac{a^n+1}{a+1},(n-1)!)=1$.Thus $n! \mid a+1$ and so by the inequality bound we see that $a=n!-1$ is the only choice.
03.09.2015 18:09
Apologize for the bump, but I don't think I'm just restating anything here... We start by proving a lemma which is basically the cornerstone of orders and is quite an elegant result. Consider $(\mathbb{Z}/n\mathbb{Z}, \times)$, the multiplicative subgroup modulo $n$, or all numbers relatively prime to $n$ modulo $n$, I claim the following lemma: Lemma: If $f(x) = x^m$ takes $(\mathbb{Z}/n\mathbb{Z}, \times)$ to $(\mathbb{Z}/n\mathbb{Z}, \times)$, it is bijective iff $(m, \phi{(n)}) = 1$ Proof: Observe that the only if direction is trivial. Now we prove the if direction. I claim that if $x^m \equiv 1 \pmod{n}$, then $x \equiv 1 \pmod{n}$. Since ${x}^{\phi (n)}\equiv 1 \pmod {n}$, by the Euclidean Algorithm we can attain our result. Observe that the rest of the problem is now easy, as we now show that the function is injective. Assume otherwise. Then $a^m \equiv b^m \pmod{n}$, and letting $k = a/b \pmod{n}$, $k^m \equiv 1\pmod{n}$, so $k = 1$ and $a = b$. The function is injective, and since the domain and range have equal size, the function is bijective. $\blacksquare$ Assume that $n$ was prime. Then since $(a^n, n!) = 1$, $(a, n!)=1$ so $a$ is in $(\mathbb{Z}/n!\mathbb{Z}, \times)$. Hence, by the above lemma, as $(\phi{(p!)}, p) = 1$ (which can be easily verified), there is a unique value of $a$ such that $n! | a^n + 1$. Assume that $n$ was even and not $2$. Then observe that $4 | 4! | n!$, but $a^{2k}+1$ can never be a multiple of $4$, so we are done. Assume that $n$ was composite. Observe that in this situation, per the above ideas, take the smallest prime factor of $n$ and call it $p$. Observe that $p^2 | n!$. Hence, $p | \phi{(n!)}$ and $(n, \phi{n!}) \neq 1$, so the function is not injective. Hence, take $a^n = b^n \pmod{n!}$, for $a, b \in (\mathbb{Z}/n!\mathbb{Z}, \times)$, and $a \not \equiv b \pmod{n!}$. So $(a/b)^n \equiv 1 \pmod{n!}$ and $-(a/b)^n \equiv -1 \pmod{n!}$, but $a/b \not \equiv 1 \mod{n!}$, and $-1 \pmod{n!}$ is also a solution, so there are more solutions than just one in this case. Hence the answer is all $n$ prime and $1$.
01.06.2016 16:14
We claim that the following statement holds. Let $n$ be a positive integer and $0 \le a <n!$ be an integer such that $n! \mid a^n+1$. Let $f(n)$ be the number of such integers $a$. Then we have $f(n)=1$ if and only if $n=1$ or $n$ is a prime number. Note that even numbers don't work after $n=2$ since $3 \mid (a^{\frac{n}{2}})^2+1$ is simply not possible. Also note that $n=1$ does work. We now show that primes work and odd composite numbers don't. Primes Let $p$ be a prime number. Clearly $a=p!-1$ works. We prove that it is the only integer in this range. Indeed, let $p! \mid a^p+1$.Let $r$ be a prime factor of $p!$ and $v_r(p!)=t$. Let $d$ be the order of $a$ mod $r$. By the fact that $r \mid a^{2p}-1$ we have $d$ as one of $\{1,2,p,2p\}$ but we see that $1$ and $p$ are absurd values and if it is $2p$ then $2p \mid r-1$ which is false as $r \le p$. Thus, $d=2$. Therefore, $r \mid (a+1)$ and so by LTE we have $v_r(a^p+1)=v_r(a+1)+v_r(p) \ge v_r(p!)$ and since for $r \not= p$, $v_r(p)=0$ we get that $v_r(a+1) \ge v_r(p!)$ and for $r=p$ we automatically have $v_r(a+1) \ge v_r(p!)=1$. This proves that $p! \mid (a+1)$ establishing uniqueness of $a$. Odd Composites Let $n$ be an odd composite number. Let $r$ be a prime factor of $n$. We show that there is a number $a$ which works other than $n!-1$ which obviously does. Now, ofc we get by LTE; $v_r(a^n+1)=v_r(a+1)+v_r(n) \ge v_r(n!)$ and so we set $a \equiv -1 ( \bmod r^{v_r((n-1)!)})$ for all $r \mid n$. Otherwise, we set $a \equiv -1 (\bmod r^{v_r(n!)})$ for all $r$ prime divisors of $n!$ but not $n$. This clearly gives a working $a$ and infact by CRT, generates at least $n$ such $a$'s in the range $[0,n!)$ and we conclude that more than one such number exist. This proves that odd composites are failed by the proposition. The result follows, Q.E.D.
07.02.2017 01:39
30.09.2023 00:31
We claim that the answer is when $n$ is prime. The question is just asking for which $n$ is there a unique residue solution $a$ to $$a^n\equiv -1\pmod{n!}.$$By taking mod 4, this has no solutions when $n$ is even for $n\geq 4$ since $-1$ is not a quadratic residue mod 4, so note that $n=2$ works and assume $n$ odd from now on. When $n$ is prime, say $n=p$, consider any prime $q\leq p$. Let $k$ be the largest positive integer such that $q^k\mid p!.$ By Chinese Remainder Theorem, it suffices to show that $$a^p\equiv -1\pmod{q^k}$$has a unique solution for $a\pmod{q^k}$ for all primes $q\leq p.$ Let $r$ be a primitive root mod $q^k$, since all odd prime powers have a primitive root. Then, this becomes $$a^p\equiv r^{\frac{(q-1)q^{k-1}}{2}}\pmod{q^k}.$$Clearly, if $a$ is not relatively prime to $q$, there are no solutions in that case, so suppose that $a\equiv r^s\pmod{q^k}$. Then, this becomes $$r^{ps}\equiv r^{\frac{(q-1)q^{k-1}}{2}}\pmod{q^k}.$$Since $r$ is a primitive root, this is equivalent to $$ps\equiv \frac{(q-1)q^{k-1}}{2}\pmod{(q-1)q^{k-1}}.$$Since by definition $q\leq p$, $p$ is relatively prime to $(q-1)q^{k-1}$, hence there exists a unique residue $s$ that satisfies this, hence proven. Now, consider if $n$ is not prime. Write $n=pk$ for a prime $p$ and an integer $k\geq 2.$ Then, let $s$ be the largest positive integer such that $p^s$ divides $(pk)!$. In particular, note that $s\geq 2$ since the factor has at the very least a $p$ and a $2p$. Now, consider $$a^{pk}\equiv -1\pmod{p^s}.$$Again, letting $r$ be a primitive root mod $p^s$. this is $$a^{pk}\equiv r^{\frac{(p-1)p^{s-1}}{2}}\pmod{p^s}$$If $a=r^v$, this is $$r^{vpk}\equiv r^{\frac{(p-1)p^{s-1}}{2}}\pmod{p^s}$$so $$vpk\equiv \frac{(p-1)p^{s-1}}{2}\pmod{(p-1)p^{s-1}}.$$However, the left side, the right side, and the modulus are all divisible by $p$, which means that there cannot be a unique residue $v$ that works, contradiction, so we are done.
01.10.2023 09:58
The answers are $n=1,n=2$ and $n$ prime. First settle trivial case of $n$ even. If $n$ is even, -1 must be a quadratic residue mod all primes $<n$. So then if $n\geq 3$ 2 is a quadratic residue mod 3 which is wrong. Now we have $n$ is odd. If $n$ is not prime and not 1, then it can be split into $pr$ where $p$ is prime and $r\geq 2$. Hence we have $2p\le n$, so $v_p(n!)\geq 2$. Let $k=v_p(n!)$. Now since such a solution is unique, and there is at least one solution($a=p!-1$), then if there is more than 1 solution to $a^n\equiv -1$ mod $p^k$ in the range $[0,p^k-1]$ then there are more than 2 solutions(by CRT). Let us choose a primitive root $g$ of $p^k$. Then $g^{\frac{p^k-p^{k-1}}{2}}\equiv -1 \mod{p}$, and we only need to show that $xn \equiv \frac{p^k-p^{k-1}}{2} \mod{p^k-p^{k-1}}$ has more than 1 solution, which is obvious. Now if $n$ is prime, it works. Firstly if there is only one solution for each $p$ for $xn \equiv \frac{p^k-p^{k-1}}{2} \mod{p^k-p^{k-1}}$ if $k=v_p(n)$ we are done. This is because by CRT there will only be one solution mod $n!$. So, this is obvious for primes $<n$ since $n$ is coprime to $p^k-p^{k-1}$(coprime to $p$ and $p-1$). Clearly for $p=n$, $n$ is coprime with $n-1$ so we are done, since $v_n(n!)=1$.
13.11.2023 02:55
One can use Hensel to generate another solution.
07.12.2023 18:04
The answer is all primes and $1$ which is trivial. For evens $>2$ we have $n! \equiv 0 \pmod 4,$ so $a^n \equiv 3 \pmod 4$ but is a square, impossible. We check $n=2$ works. If $n$ is odd and is a prime $p$ then the order of $a \pmod p$ must divide $2p$ but not $p$ so it must be either $2$ or $2p.$ But it must also divide $\varphi(p!)$ so it is not $2p.$ Thus $a^2 \equiv 1 \pmod p$ so $a^p \equiv a \pmod p$ so $a \equiv -1 \pmod p$ and $a=p!-1$ is the only solution which works. If $n$ is odd and composite, we take $a=(n-1)!-1$ and since $n \mid (n-1)!$ we have $n! \mid (n-1)!^2$ so when we expand all terms of $a^n$ using the binomial formula all terms must be divisible by $n!$ except for the last two, but the second to last term is $(n-1)! \cdot n = n!$ so it is also divisible by $n!$ so $a^n \equiv -1 \pmod{n!}$ and $n! \mid a^n+1.$ However we can also just take $a=n!-1$ so these don't work and we are done.
03.02.2024 21:25
$\textcolor{blue}{\text{Claim } n \hspace{0.2cm}\text{even doesn´t work}}$ We would have for some $p\mid n!$ prime $p\mid a^n+1$ so by Fermat Christmas Theorem $p=2$ or $p\equiv 1\pmod 4$ $\textcolor{blue}{\text{Claim } n \hspace{0.2cm}\text{odd and composite doesn´t work}}$ As $n$ odd $n\mid (n!-1)^n-1$ so $a=n!-1$ works
$\textcolor{blue}{\text{Claim } p \hspace{0.2cm}\text{prime work}}$ Let $q\mid p! \hspace{0.1cm}$ prime, so $a^{2p}\equiv 1\pmod q$ and $a^{q-1}\equiv 1\pmod q$ so $\operatorname{Ord}_q(a)\mid 2\gcd\left(p,\frac{q-1}{2}\right)$ so $\operatorname{Ord}_q(a)=2$ thus $q\mid a+1$, then $$\nu_q\left(a^p+1\right)=\nu_q(a+1)+\nu_q(p)=\nu_q(a+1)$$So $p!\mid a+1$ then $a=p!-1$ is the unique solution here
12.02.2024 23:20
The answer are the $\boxed{\text{primes}}$. If $n$ is even and greater than $2$, we have \[a^n \equiv -1 \pmod{n!} \iff a^n \equiv -1 \pmod{4},\] which is impossible. Manually check that $n=2$ is valid, so assume $n$ is odd henceforth. If $n$ is prime, we have \[a^n \equiv -1 \pmod{n!}\]\[\implies a^{2n} \equiv 1 \pmod{n!}.\] Hence, the order of $a$ modulo $n!$ is divisible by $2n$ but not $n$. This means it is either $2$ or $2n$. Consider a prime $p \mid n!$. We have \[a^{p-1} \equiv 1 \pmod{p},\] so the order of $a$ modulo $n!$ is $\gcd(p-1, 2n) = 2$. This means that \[a^n \equiv a \equiv -1 \pmod{p!},\] fixing $a=p!-1$. If $n$ is odd and composite, $a=n!-1$ still is valid, but we claim $(n-1)!-1$ will also be valid, violating the uniqueness of $a$. Note that \[\nu_{p}(((n-1)!-1)^n+1) = \nu_{p}((n-1)!) + \nu_{p}(n) = \nu_p(n!). \] We are done.
03.03.2024 05:22
We claim the answer is $\boxed{\text{all primes}}$. For all primes $n=p$, we claim the desired unique integer is $p!-1$, which clearly works. To prove this, take an arbitrary prime $q<p$, and note we require \[a^p \equiv -1 \pmod q \implies \operatorname{ord}_qa \mid 2p, q-1 \implies \operatorname{ord}_qa = 2 \implies q \mid a+1.\]We conclude using LTE to get \[v_q(p!) \leq v_q(a^p+1) = v_q(a+1) \implies p! \mid a+1 \implies a=p!-1.\] For all evens other than 2, notice that if $m$ works, $n!-m$ also works (and clearly $\tfrac{n!}{2}$ always fails), giving us two distinct values. For all odds, we simply take $n!-1$ and $(n-1)!-1$. $\blacksquare$
11.06.2024 08:36
Nice training problem, the answer are all prime numbers. First note that if $n$ is even, for a solution $a$, $n!-a$ is also a solution, thus $a=\frac{n!}{2}$, which only works for $n=2$. For odd $n$ the only solution should be $n!-1$, for composite $n$, however take $\frac{n!}{p}-1$, for some prime $p$ dividing $n$, and see that for example by $LTE$, $v_p(a^n+1)=v_p(a+1)+v_p(n) \ge v_p(n!)-1+1=v_p(n!)$, or just factor out and see that the second paranthesis is also divisible by $p$. Now for prime $n$, any prime dividing $a^n+1$ divides $a^{2n}-1$, thus it's order divides $2n$, but as it also divides $p-1$, for primes $p\le n$ we get that it divides $2$, meaning together with $p \mid a^n+1$, that $p \mid a+1$ for any prime $p\le n$, and using $LTE$ or factorization again it is easy to see that $\frac{a^n+1}{a+1}$ does not contribute with any prime power, thus we get $n! \mid a+1$, which is the desired conclusion.
18.06.2024 05:18
We claim that the answer is all prime $n$, with $a=n!-1$ the unique value of $a$ in those cases. First, we prove that this works. For $n=2$, $a=1$ is the unique integer that works. For larger $n$, assume that $n!=p_1^{e_1}\cdot p_2^{e_2}\dots p_k^{e_k}\cdot n$, where $p_1$ through $p_k$ are the primes less than $n$. For any prime $p<n$, we will show that $p^k\mid a^n+1$ implies that $a\equiv -1 \pmod{p^k}$. The order of $a\pmod{{p_i}^{e_i}}$ must divide $\gcd((p-1)p^{k-1},2n)$, which equals $2$ since $n$ is a prime greater than $p$. The order can't be $1$, so it must be $2$, which then implies that $a\equiv -1 \pmod{{p_i}^{e_i}}$. Then for the prime $n$, since $a^n\equiv a\pmod{n}$ by FLT, for $n\mid a^n+1$ we require $a\equiv -1 \pmod{n}$. Then by CRT over all of the prime powers dividing $n!$, there is only one solution. Now we must prove that other numbers do not work. Even values of $n>2$ fail since $4\mid n!$ but $a^n+1$ can only be $1$ or $2\pmod{4}$. For odd composite $n$, consider a prime $p$ dividing $n$, and let $k$ be the maximum value such that $p^k\mid n!$. If we let $a\equiv -1\pmod{p^{k-1}}$, we can apply LTE to get that $\nu_p(a^n+1)=\nu_p(a+1)+\nu_p(n)\geq k-1 +\nu_p(n)$. Since $p\mid n$, $\nu_p(n)\geq 1$, so $\nu_p(a^n+1)\geq k$ and $p^k\mid a^n+1$. Thus there are $p$ different values $\pmod{p^k}$ that are $-1\pmod{p^{k-1}}$, each of which could be used when applying CRT over all of the prime powers. This tells us that the number of solutions will be a multiple of $p$, but this can clearly never be $1$. Thus prime $n$ are the only solutions, as desired.
17.08.2024 08:48
The solution set is $\boxed{n = 1 \text{ and } n \text{ prime.}}$ Lemma 1: $n \in \{1, 2\}$ work trivially. Lemma 2: If $n$ works and is even, $n = 2$. Proof: Assume otherwise, letting $n = 2k$. Then $3 \mid n! \mid (a^k)^2 + 1$, impossible by Fermat's Christmas Theorem. Lemma 3: All odd composite numbers don't work. Proof: Same as anantmudgal09, so copied from there: Let $n$ be an odd composite number. Let $r$ be a prime factor of $n$. We show that there is a number $a$ which works other than $n!-1$ which obviously does. Now, ofc we get by LTE; $v_r(a^n+1)=v_r(a+1)+v_r(n) \ge v_r(n!)$ and so we set $a \equiv -1 ( \bmod r^{v_r((n-1)!)})$ for all $r \mid n$. Otherwise, we set $a \equiv -1 (\bmod r^{v_r(n!)})$ for all $r$ prime divisors of $n!$ but not $n$. This clearly gives a working $a$ and infact by CRT, generates at least $n$ such $a$'s in the range $[0,n!)$ and we conclude that more than one such number exist. This proves that odd composites are failed by the proposition. Lemma 4: All odd primes work. Proof: Attached below. Due to the above, the solution set is confirmed. $\square$
Attachments:

12.09.2024 21:09
\begin{answer} Only primes and 1 work as the value of $n$ \end{answer} \begin{proof} \textbf{Prime $ n$ gives unique solution} let $p! = p_1^{\alpha_1} \dots p_k^{\alpha_k}$ so we need solution to $a^p \equiv -1 \pmod{p_i^{\alpha_i}}$ Clearly we have that $\gcd(p,p_i^{\alpha_i})=1$ then clearly $a^p$ is a bijection and we are done, as it gives out unique values for each $p_i^{\alpha_i}$ and then we apply CRT to finish. \textbf{Composite $n$ do not work} let $n! =p^{\nu_p(n!) }\cdot k$ where p is chosen such that $p \mid n \Rightarrow n=p\cdot t$ \begin{claim} if a solution to $a^n \equiv -1 \pmod{p^{\nu_p(n!)}}$ multiple solutions exist. \end{claim} \begin{proof} So we need $a^{pt} \equiv b^{pt} \equiv -1 \pmod{p^{\nu_p(n!) }}$ to have solutions in distinct $a,b$. clearly $a,b$ have to be co prime to $p_i$ and getting $a^p \equiv b^p \pmod{p^{\nu_p(n!) }}$ works as i can raise both to $t$ therefore we need \begin{center} $\left(\frac{a}{b} \right)^{p} \equiv 1 \pmod{p^{\nu_p(n!)}}$ \end{center} then clearly taking primitive roots we seen that this has multiple solutions. \end{proof} this clearly shows that composite $n$ do not work. \end{proof}
14.10.2024 01:01
The answer is all prime $n.$ (And $1$ as well. bruhhhhh) First, we verify that the only even $n$ that works is $n = 2.$ For $n = 2,$ only $a = 1$ works, while for even $n > 2,$ if $a$ works, then so does $n! - a,$ and since $\frac{n!}{2}$ clearly doesn't work, we get an even number of solutions. Henceforth assume that $n$ is odd. Verification that odd primes $p$ work: We want $a^p \equiv -1 \pmod{p!},$ or $(-a)^p \equiv 1 \pmod{p!}.$ We want to show that there is exactly one value of $a$ which satisfies this, namely $a = n!-1.$ This is equivalent to showing that the order of any number modulo $p!$ cannot be $p.$ In fact, $p \nmid \phi(p!)$ because $$\phi(p!) = p! \cdot \prod_{q < p, q \text{ is prime}} \left(1 - \frac{1}{q}\right)$$has all of its prime factors less than $p.$ This means that if $(-a)^p \equiv 1 \pmod{p!},$ then $-a \equiv 1 \pmod{p!},$ giving exactly one solution, as required. Proof that odd composites $n$ don't work: Once again we would like to solve $(-a)^n \equiv 1 \pmod{n!}.$ For simplicity let $b = n!-a,$ so that we want $b^n \equiv 1 \pmod{n!}.$ Obviously $b = 1$ satisfies this. The key claim is that $b = (n-1)! + 1$ also satisfies this, which immediately shows that $a$ is not unique. To see why. write $$b^n - 1 = (b-1)(b^{n-1} + b^{n-2} + \dots + b + 1) = ((n-1)! + 1 - 1)(b^{n-2} + \dots + b + 1).$$The left factor becomes $(n-1)!,$ and $(n-1)! \equiv 0 \pmod{n}$ since $n$ is composite, so the right factor is $1^{n-2} + \dots + 1 + 1 \equiv 0 \pmod{n}.$ So the entire product is divisible by $n!,$ implying that $a = (n-1)! + 1$ works, as claimed. Thus all composite $n$ don't work. Therefore, only prime $n$ work, as desired. Remark: A simpler proof that even $n > 2$ don't work is that $n! \equiv 0 \pmod{3}$ while $a^n + 1 \equiv 1,2 \pmod{3}.$
31.10.2024 10:19
It is easy to see that $\boxed{n=1}$ work. We consider the case for $n$ even, so $a^n+1\equiv 2\pmod{3}$ so $\boxed{n=2}$. If $n$ is odd we consider $2$ cases, for odd primes and odd composites, here $a=n!-1$ satisfies the conditions of the problem, now we check for $a=(n-1)!-1$, $((n-1)!-1)^n+1\equiv -1+1 \equiv 0\pmod{n!} $, here we used the fact that $((n-1)!)^r\equiv 0\pmod{n!}, r\geq 2$, but note that this contradicts the uniqueness of $a$. If $n$ is an odd prime $\text{ord}_{n!}(a)=2, 2n$, if $\text{ord}_{n!}(a)=2$ then $n!\mid a+1$ so a valid construction for $a$ can be $n!-1$. Hence $\boxed{\text{all odd primes n}}$ work. For $\text{ord}_{n!}(a)=2n$ we let $p$ be a prime such that $p\mid n!$, then $\text{ord}_{n}(a)\mid p-1$ which is simply not possible.
29.11.2024 18:26
04.02.2025 15:33
cool nt