Baltic Way 2025 · Problem 20
Number Theory
Determine all positive integers such that there exists a permutation of , where the numbers are all pairwise distinct modulo .
When you’re ready
Review material becomes available with the next Daily.
Review
Topics
Modular arithmetic
Solutions
Solution
The answer is and .
First note that
for all integers and positive . Since is a permutation of and is a complete set of residues modulo , the three sequences
and
are permutations of one another.
Also,
Because the corresponding sequences have the same sum, equality must hold termwise:
for every .
For each divisor of , let
The maps and are bijections, and the equality above shows that they map each bijectively to itself.
Suppose first that for some prime . Then
The first equality implies . Hence , and because we get , a contradiction. Thus is squarefree.
Now suppose an odd prime divides , and put . Since is squarefree,
Let
Because permutes ,
Because also permutes ,
Reducing modulo and using the preceding identity gives
Since , also , so we may divide by modulo :
By Wilson's theorem and Fermat's little theorem,
so , contradicting that is odd. Therefore the only prime that may divide is .
Since is squarefree, this leaves only and . The case is trivial. For , take ; then and , so the required residues are distinct.
Contest context
Results from Baltic Way 2025
11 teams
- Mean score
- 3.9 / 5
- Scores of 4 or 5
- 8 / 11
- Estonia
- 5 / 5
Score distribution
All team scores
| Team | Score |
|---|---|
| Germany | 5 / 5 |
| Estonia | 5 / 5 |
| Poland | 5 / 5 |
| Lithuania | 5 / 5 |
| Norway | 5 / 5 |
| Latvia | 1 / 5 |
| Finland | 4 / 5 |
| Denmark | 5 / 5 |
| Sweden | 5 / 5 |
| Ukraine | 2 / 5 |
| Iceland | 1 / 5 |