If $a$ and $b$ are positive integers, we say that $a$ almost divides $b$ if $a$ divides at least one of $b - 1$ and $b + 1$. We call a positive integer $n$ almost prime if the following holds: for any positive integers $a, b$ such that $n$ almost divides $ab$, we have that $n$ almost divides at least one of $a$ and $b$. Determine all almost prime numbers.
HIDE: original link https://mathematical.olympiad.ch/fileadmin/user_upload/Archiv/Intranet/Olympiads/Mathematics/deploy/exams/2024/FinalRound/Exam/englishFinalRound2024.pdf!!Problem
Source: 2024 Swiss MO/1
Tags: number theory, prime numbers
InterLoop
16.12.2024 18:06
The problem tells us to find all numbers $n$ such that
$$ab \equiv \pm 1 \pmod{n} \implies a \equiv \pm 1 \pmod{n}$$We effectively remove the 'at least one of $a$ and $b$' condition since if $a \equiv \pm 1 \pmod{n}$ and $ab \equiv \pm 1 \pmod{n}$ then naturally if $b \not \equiv \pm 1 \pmod{n}$ then $ab \equiv \pm b \pmod{n} \not \equiv \pm 1 \pmod{n}$. The condition means that there are no integers $a$ with $a \not \equiv \pm 1 \pmod{n}$ such that $\gcd(a, n) = 1$ by simple properties of modular inverses and the problem is equivalent to finding all $n$ with $\phi(n) \le 2$. It is simple to show that this set is $\{1, 2, 3, 4, 6\}$.
grupyorum
16.12.2024 18:12
Let $p\mid n$ be a prime and suppose $n\mid ab\pm 1$. If $p>3$ then taking $a\equiv 2\pmod{p}$ and noticing $a\not\equiv -1\pmod{p}$ (as $p>3$), we get that $n$ does not almost divide $a,b$, a contradiction. So, if $p\mid n$ then $p\in\{2,3\}$. Next, if $v_3(n)\ge 2$ then taking $a\equiv 2\pmod{9}$ and $b\equiv 5\pmod{9}$ we again have a contradiction. Likewise, if $v_2(n)\ge 3$ then taking $a,b\equiv 5\pmod{8}$ we arrive at a contradiction. So, $n\mid 12$, from which a quick inspection yields $\{1,2,3,4,6\}$.
AshAuktober
16.12.2024 18:16
Yeah my solution is the same as InterLoop, not posting for that reason.