File size: 132,788 Bytes
eebb93b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
# Shortlisted Problems with Solutions 

$53^{\text {rd }}$ International Mathematical Olympiad

Mar del Plata, Argentina 2012

## The shortlisted problems should be kept strictly confidential until IMO 2013

## Contributing Countries

The Organizing Committee and the Problem Selection Committee of IMO 2012 thank the following 40 countries for contributing 136 problem proposals:

Australia, Austria, Belarus, Belgium, Bulgaria, Canada, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hong Kong, India, Iran, Ireland, Israel, Japan, Kazakhstan, Luxembourg, Malaysia, Montenegro, Netherlands, Norway, Pakistan, Romania, Russia, Serbia, Slovakia, Slovenia, South Africa, South Korea, Sweden, Thailand, Ukraine, United Kingdom, United States of America, Uzbekistan

## Problem Selection Committee

Martín Avendaño

Carlos di Fiore

Géza Kós

Svetoslav Savchev

## Algebra

A1. Find all the functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that

$$
f(a)^{2}+f(b)^{2}+f(c)^{2}=2 f(a) f(b)+2 f(b) f(c)+2 f(c) f(a)
$$

for all integers $a, b, c$ satisfying $a+b+c=0$.

A2. Let $\mathbb{Z}$ and $\mathbb{Q}$ be the sets of integers and rationals respectively.

a) Does there exist a partition of $\mathbb{Z}$ into three non-empty subsets $A, B, C$ such that the sets $A+B, B+C, C+A$ are disjoint?

b) Does there exist a partition of $\mathbb{Q}$ into three non-empty subsets $A, B, C$ such that the sets $A+B, B+C, C+A$ are disjoint?

Here $X+Y$ denotes the set $\{x+y \mid x \in X, y \in Y\}$, for $X, Y \subseteq \mathbb{Z}$ and $X, Y \subseteq \mathbb{Q}$.

A3. Let $a_{2}, \ldots, a_{n}$ be $n-1$ positive real numbers, where $n \geq 3$, such that $a_{2} a_{3} \cdots a_{n}=1$. Prove that

$$
\left(1+a_{2}\right)^{2}\left(1+a_{3}\right)^{3} \cdots\left(1+a_{n}\right)^{n}>n^{n} .
$$

A4. Let $f$ and $g$ be two nonzero polynomials with integer coefficients and $\operatorname{deg} f>\operatorname{deg} g$. Suppose that for infinitely many primes $p$ the polynomial $p f+g$ has a rational root. Prove that $f$ has a rational root.

A5. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy the conditions

$$
f(1+x y)-f(x+y)=f(x) f(y) \quad \text { for all } x, y \in \mathbb{R}
$$

and $f(-1) \neq 0$.

A6. Let $f: \mathbb{N} \rightarrow \mathbb{N}$ be a function, and let $f^{m}$ be $f$ applied $m$ times. Suppose that for every $n \in \mathbb{N}$ there exists a $k \in \mathbb{N}$ such that $f^{2 k}(n)=n+k$, and let $k_{n}$ be the smallest such $k$. Prove that the sequence $k_{1}, k_{2}, \ldots$ is unbounded.

A7. We say that a function $f: \mathbb{R}^{k} \rightarrow \mathbb{R}$ is a metapolynomial if, for some positive integers $m$ and $n$, it can be represented in the form

$$
f\left(x_{1}, \ldots, x_{k}\right)=\max _{i=1, \ldots, m} \min _{j=1, \ldots, n} P_{i, j}\left(x_{1}, \ldots, x_{k}\right)
$$

where $P_{i, j}$ are multivariate polynomials. Prove that the product of two metapolynomials is also a metapolynomial.

## Combinatorics

C1. Several positive integers are written in a row. Iteratively, Alice chooses two adjacent numbers $x$ and $y$ such that $x>y$ and $x$ is to the left of $y$, and replaces the pair $(x, y)$ by either $(y+1, x)$ or $(x-1, x)$. Prove that she can perform only finitely many such iterations.

C2. Let $n \geq 1$ be an integer. What is the maximum number of disjoint pairs of elements of the set $\{1,2, \ldots, n\}$ such that the sums of the different pairs are different integers not exceeding $n$ ?

C3. In a $999 \times 999$ square table some cells are white and the remaining ones are red. Let $T$ be the number of triples $\left(C_{1}, C_{2}, C_{3}\right)$ of cells, the first two in the same row and the last two in the same column, with $C_{1}$ and $C_{3}$ white and $C_{2}$ red. Find the maximum value $T$ can attain.

C4. Players $A$ and $B$ play a game with $N \geq 2012$ coins and 2012 boxes arranged around a circle. Initially $A$ distributes the coins among the boxes so that there is at least 1 coin in each box. Then the two of them make moves in the order $B, A, B, A, \ldots$ by the following rules:

- On every move of his $B$ passes 1 coin from every box to an adjacent box.
- On every move of hers $A$ chooses several coins that were not involved in $B$ 's previous move and are in different boxes. She passes every chosen coin to an adjacent box.

Player $A$ 's goal is to ensure at least 1 coin in each box after every move of hers, regardless of how $B$ plays and how many moves are made. Find the least $N$ that enables her to succeed.

C5. The columns and the rows of a $3 n \times 3 n$ square board are numbered $1,2, \ldots, 3 n$. Every square $(x, y)$ with $1 \leq x, y \leq 3 n$ is colored asparagus, byzantium or citrine according as the modulo 3 remainder of $x+y$ is 0,1 or 2 respectively. One token colored asparagus, byzantium or citrine is placed on each square, so that there are $3 n^{2}$ tokens of each color.

Suppose that one can permute the tokens so that each token is moved to a distance of at most $d$ from its original position, each asparagus token replaces a byzantium token, each byzantium token replaces a citrine token, and each citrine token replaces an asparagus token. Prove that it is possible to permute the tokens so that each token is moved to a distance of at most $d+2$ from its original position, and each square contains a token with the same color as the square.

C6. Let $k$ and $n$ be fixed positive integers. In the liar's guessing game, Amy chooses integers $x$ and $N$ with $1 \leq x \leq N$. She tells Ben what $N$ is, but not what $x$ is. Ben may then repeatedly ask Amy whether $x \in S$ for arbitrary sets $S$ of integers. Amy will always answer with yes or no, but she might lie. The only restriction is that she can lie at most $k$ times in a row. After he has asked as many questions as he wants, Ben must specify a set of at most $n$ positive integers. If $x$ is in this set he wins; otherwise, he loses. Prove that:

a) If $n \geq 2^{k}$ then Ben can always win.

b) For sufficiently large $k$ there exist $n \geq 1.99^{k}$ such that Ben cannot guarantee a win.

C7. There are given $2^{500}$ points on a circle labeled $1,2, \ldots, 2^{500}$ in some order. Prove that one can choose 100 pairwise disjoint chords joining some of these points so that the 100 sums of the pairs of numbers at the endpoints of the chosen chords are equal.

## Geometry

G1. In the triangle $A B C$ the point $J$ is the center of the excircle opposite to $A$. This excircle is tangent to the side $B C$ at $M$, and to the lines $A B$ and $A C$ at $K$ and $L$ respectively. The lines $L M$ and $B J$ meet at $F$, and the lines $K M$ and $C J$ meet at $G$. Let $S$ be the point of intersection of the lines $A F$ and $B C$, and let $T$ be the point of intersection of the lines $A G$ and $B C$. Prove that $M$ is the midpoint of $S T$.

G2. Let $A B C D$ be a cyclic quadrilateral whose diagonals $A C$ and $B D$ meet at $E$. The extensions of the sides $A D$ and $B C$ beyond $A$ and $B$ meet at $F$. Let $G$ be the point such that $E C G D$ is a parallelogram, and let $H$ be the image of $E$ under reflection in $A D$. Prove that $D, H, F, G$ are concyclic.

G3. In an acute triangle $A B C$ the points $D, E$ and $F$ are the feet of the altitudes through $A$, $B$ and $C$ respectively. The incenters of the triangles $A E F$ and $B D F$ are $I_{1}$ and $I_{2}$ respectively; the circumcenters of the triangles $A C I_{1}$ and $B C I_{2}$ are $O_{1}$ and $O_{2}$ respectively. Prove that $I_{1} I_{2}$ and $O_{1} O_{2}$ are parallel.

G4. Let $A B C$ be a triangle with $A B \neq A C$ and circumcenter $O$. The bisector of $\angle B A C$ intersects $B C$ at $D$. Let $E$ be the reflection of $D$ with respect to the midpoint of $B C$. The lines through $D$ and $E$ perpendicular to $B C$ intersect the lines $A O$ and $A D$ at $X$ and $Y$ respectively. Prove that the quadrilateral $B X C Y$ is cyclic.

G5. Let $A B C$ be a triangle with $\angle B C A=90^{\circ}$, and let $C_{0}$ be the foot of the altitude from $C$. Choose a point $X$ in the interior of the segment $C C_{0}$, and let $K, L$ be the points on the segments $A X, B X$ for which $B K=B C$ and $A L=A C$ respectively. Denote by $M$ the intersection of $A L$ and $B K$. Show that $M K=M L$.

G6. Let $A B C$ be a triangle with circumcenter $O$ and incenter $I$. The points $D, E$ and $F$ on the sides $B C, C A$ and $A B$ respectively are such that $B D+B F=C A$ and $C D+C E=A B$. The circumcircles of the triangles $B F D$ and $C D E$ intersect at $P \neq D$. Prove that $O P=O I$.

G7. Let $A B C D$ be a convex quadrilateral with non-parallel sides $B C$ and $A D$. Assume that there is a point $E$ on the side $B C$ such that the quadrilaterals $A B E D$ and $A E C D$ are circumscribed. Prove that there is a point $F$ on the side $A D$ such that the quadrilaterals $A B C F$ and $B C D F$ are circumscribed if and only if $A B$ is parallel to $C D$.

G8. Let $A B C$ be a triangle with circumcircle $\omega$ and $\ell$ a line without common points with $\omega$. Denote by $P$ the foot of the perpendicular from the center of $\omega$ to $\ell$. The side-lines $B C, C A, A B$ intersect $\ell$ at the points $X, Y, Z$ different from $P$. Prove that the circumcircles of the triangles $A X P, B Y P$ and $C Z P$ have a common point different from $P$ or are mutually tangent at $P$.

## Number Theory

N1. Call admissible a set $A$ of integers that has the following property:

$$
\text { If } x, y \in A \text { (possibly } x=y \text { ) then } x^{2}+k x y+y^{2} \in A \text { for every integer } k \text {. }
$$

Determine all pairs $m, n$ of nonzero integers such that the only admissible set containing both $m$ and $n$ is the set of all integers.

N2. Find all triples $(x, y, z)$ of positive integers such that $x \leq y \leq z$ and

$$
x^{3}\left(y^{3}+z^{3}\right)=2012(x y z+2) \text {. }
$$

N3. Determine all integers $m \geq 2$ such that every $n$ with $\frac{m}{3} \leq n \leq \frac{m}{2}$ divides the binomial coefficient $\left(\begin{array}{c}n \\ m-2 n\end{array}\right)$.

N4. An integer $a$ is called friendly if the equation $\left(m^{2}+n\right)\left(n^{2}+m\right)=a(m-n)^{3}$ has a solution over the positive integers.

a) Prove that there are at least 500 friendly integers in the set $\{1,2, \ldots, 2012\}$.

b) Decide whether $a=2$ is friendly.

N5. For a nonnegative integer $n$ define $\operatorname{rad}(n)=1$ if $n=0$ or $n=1$, and $\operatorname{rad}(n)=p_{1} p_{2} \cdots p_{k}$ where $p_{1}<p_{2}<\cdots<p_{k}$ are all prime factors of $n$. Find all polynomials $f(x)$ with nonnegative integer coefficients such that $\operatorname{rad}(f(n))$ divides $\operatorname{rad}\left(f\left(n^{r a d(n)}\right)\right)$ for every nonnegative integer $n$.

N6. Let $x$ and $y$ be positive integers. If $x^{2^{n}}-1$ is divisible by $2^{n} y+1$ for every positive integer $n$, prove that $x=1$.

N7. Find all $n \in \mathbb{N}$ for which there exist nonnegative integers $a_{1}, a_{2}, \ldots, a_{n}$ such that

$$
\frac{1}{2^{a_{1}}}+\frac{1}{2^{a_{2}}}+\cdots+\frac{1}{2^{a_{n}}}=\frac{1}{3^{a_{1}}}+\frac{2}{3^{a_{2}}}+\cdots+\frac{n}{3^{a_{n}}}=1 .
$$

N8. Prove that for every prime $p>100$ and every integer $r$ there exist two integers $a$ and $b$ such that $p$ divides $a^{2}+b^{5}-r$.

## Algebra

A1. Find all the functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that

$$
f(a)^{2}+f(b)^{2}+f(c)^{2}=2 f(a) f(b)+2 f(b) f(c)+2 f(c) f(a)
$$

for all integers $a, b, c$ satisfying $a+b+c=0$.

Solution. The substitution $a=b=c=0$ gives $3 f(0)^{2}=6 f(0)^{2}$, hence

$$
f(0)=0 \text {. }
$$

The substitution $b=-a$ and $c=0$ gives $\left((f(a)-f(-a))^{2}=0\right.$. Hence $f$ is an even function:

$$
f(a)=f(-a) \quad \text { for all } a \in \mathbb{Z}
$$

Now set $b=a$ and $c=-2 a$ to obtain $2 f(a)^{2}+f(2 a)^{2}=2 f(a)^{2}+4 f(a) f(2 a)$. Hence

$$
f(2 a)=0 \text { or } f(2 a)=4 f(a) \text { for all } a \in \mathbb{Z}
$$

If $f(r)=0$ for some $r \geq 1$ then the substitution $b=r$ and $c=-a-r$ gives $(f(a+r)-f(a))^{2}=0$. So $f$ is periodic with period $r$, i. e.

$$
f(a+r)=f(a) \text { for all } a \in \mathbb{Z}
$$

In particular, if $f(1)=0$ then $f$ is constant, thus $f(a)=0$ for all $a \in \mathbb{Z}$. This function clearly satisfies the functional equation. For the rest of the analysis, we assume $f(1)=k \neq 0$.

By (3) we have $f(2)=0$ or $f(2)=4 k$. If $f(2)=0$ then $f$ is periodic of period 2 , thus $f($ even $)=0$ and $f($ odd $)=k$. This function is a solution for every $k$. We postpone the verification; for the sequel assume $f(2)=4 k \neq 0$.

By (3) again, we have $f(4)=0$ or $f(4)=16 k$. In the first case $f$ is periodic of period 4 , and $f(3)=f(-1)=f(1)=k$, so we have $f(4 n)=0, f(4 n+1)=f(4 n+3)=k$, and $f(4 n+2)=4 k$ for all $n \in \mathbb{Z}$. This function is a solution too, which we justify later. For the rest of the analysis, we assume $f(4)=16 k \neq 0$.

We show now that $f(3)=9 k$. In order to do so, we need two substitutions:

$$
\begin{gathered}
a=1, b=2, c=-3 \Longrightarrow f(3)^{2}-10 k f(3)+9 k^{2}=0 \Longrightarrow f(3) \in\{k, 9 k\}, \\
a=1, b=3, c=-4 \Longrightarrow f(3)^{2}-34 k f(3)+225 k^{2}=0 \Longrightarrow f(3) \in\{9 k, 25 k\} .
\end{gathered}
$$

Therefore $f(3)=9 k$, as claimed. Now we prove inductively that the only remaining function is $f(x)=k x^{2}, x \in \mathbb{Z}$. We proved this for $x=0,1,2,3,4$. Assume that $n \geq 4$ and that $f(x)=k x^{2}$ holds for all integers $x \in[0, n]$. Then the substitutions $a=n, b=1, c=-n-1$ and $a=n-1$, $b=2, c=-n-1$ lead respectively to

$$
f(n+1) \in\left\{k(n+1)^{2}, k(n-1)^{2}\right\} \quad \text { and } \quad f(n+1) \in\left\{k(n+1)^{2}, k(n-3)^{2}\right\} \text {. }
$$

Since $k(n-1)^{2} \neq k(n-3)^{2}$ for $n \neq 2$, the only possibility is $f(n+1)=k(n+1)^{2}$. This completes the induction, so $f(x)=k x^{2}$ for all $x \geq 0$. The same expression is valid for negative values of $x$ since $f$ is even. To verify that $f(x)=k x^{2}$ is actually a solution, we need to check the identity $a^{4}+b^{4}+(a+b)^{4}=2 a^{2} b^{2}+2 a^{2}(a+b)^{2}+2 b^{2}(a+b)^{2}$, which follows directly by expanding both sides.

Therefore the only possible solutions of the functional equation are the constant function $f_{1}(x)=0$ and the following functions:

$$
f_{2}(x)=k x^{2} \quad f_{3}(x)=\left\{\begin{array}{cc}
0 & x \text { even } \\
k & x \text { odd }
\end{array} \quad f_{4}(x)=\left\{\begin{array}{ccc}
0 & x \equiv 0 & (\bmod 4) \\
k & x \equiv 1 & (\bmod 2) \\
4 k & x \equiv 2 & (\bmod 4)
\end{array}\right.\right.
$$

for any non-zero integer $k$. The verification that they are indeed solutions was done for the first two. For $f_{3}$ note that if $a+b+c=0$ then either $a, b, c$ are all even, in which case $f(a)=f(b)=f(c)=0$, or one of them is even and the other two are odd, so both sides of the equation equal $2 k^{2}$. For $f_{4}$ we use similar parity considerations and the symmetry of the equation, which reduces the verification to the triples $(0, k, k),(4 k, k, k),(0,0,0),(0,4 k, 4 k)$. They all satisfy the equation.

Comment. We used several times the same fact: For any $a, b \in \mathbb{Z}$ the functional equation is a quadratic equation in $f(a+b)$ whose coefficients depend on $f(a)$ and $f(b)$ :

$$
f(a+b)^{2}-2(f(a)+f(b)) f(a+b)+(f(a)-f(b))^{2}=0
$$

Its discriminant is $16 f(a) f(b)$. Since this value has to be non-negative for any $a, b \in \mathbb{Z}$, we conclude that either $f$ or $-f$ is always non-negative. Also, if $f$ is a solution of the functional equation, then $-f$ is also a solution. Therefore we can assume $f(x) \geq 0$ for all $x \in \mathbb{Z}$. Now, the two solutions of the quadratic equation are

$$
f(a+b) \in\left\{(\sqrt{f(a)}+\sqrt{f(b)})^{2},(\sqrt{f(a)}-\sqrt{f(b)})^{2}\right\} \quad \text { for all } a, b \in \mathbb{Z}
$$

The computation of $f(3)$ from $f(1), f(2)$ and $f(4)$ that we did above follows immediately by setting $(a, b)=(1,2)$ and $(a, b)=(1,-4)$. The inductive step, where $f(n+1)$ is derived from $f(n), f(n-1)$, $f(2)$ and $f(1)$, follows immediately using $(a, b)=(n, 1)$ and $(a, b)=(n-1,2)$.

A2. Let $\mathbb{Z}$ and $\mathbb{Q}$ be the sets of integers and rationals respectively.

a) Does there exist a partition of $\mathbb{Z}$ into three non-empty subsets $A, B, C$ such that the sets $A+B, B+C, C+A$ are disjoint?

b) Does there exist a partition of $\mathbb{Q}$ into three non-empty subsets $A, B, C$ such that the sets $A+B, B+C, C+A$ are disjoint?

Here $X+Y$ denotes the set $\{x+y \mid x \in X, y \in Y\}$, for $X, Y \subseteq \mathbb{Z}$ and $X, Y \subseteq \mathbb{Q}$.

Solution 1. a) The residue classes modulo 3 yield such a partition:

$$
A=\{3 k \mid k \in \mathbb{Z}\}, \quad B=\{3 k+1 \mid k \in \mathbb{Z}\}, \quad C=\{3 k+2 \mid k \in \mathbb{Z}\}
$$

b) The answer is no. Suppose that $\mathbb{Q}$ can be partitioned into non-empty subsets $A, B, C$ as stated. Note that for all $a \in A, b \in B, c \in C$ one has

$$
a+b-c \in C, \quad b+c-a \in A, \quad c+a-b \in B
$$

Indeed $a+b-c \notin A$ as $(A+B) \cap(A+C)=\emptyset$, and similarly $a+b-c \notin B$, hence $a+b-c \in C$. The other two relations follow by symmetry. Hence $A+B \subset C+C, B+C \subset A+A, C+A \subset B+B$.

The opposite inclusions also hold. Let $a, a^{\prime} \in A$ and $b \in B, c \in C$ be arbitrary. By (1) $a^{\prime}+c-b \in B$, and since $a \in A, c \in C$, we use (1) again to obtain

$$
a+a^{\prime}-b=a+\left(a^{\prime}+c-b\right)-c \in C .
$$

So $A+A \subset B+C$ and likewise $B+B \subset C+A, C+C \subset A+B$. In summary

$$
B+C=A+A, \quad C+A=B+B, \quad A+B=C+C .
$$

Furthermore suppose that $0 \in A$ without loss of generality. Then $B=\{0\}+B \subset A+B$ and $C=\{0\}+C \subset A+C$. So, since $B+C$ is disjoint with $A+B$ and $A+C$, it is also disjoint with $B$ and $C$. Hence $B+C$ is contained in $\mathbb{Z} \backslash(B \cup C)=A$. Because $B+C=A+A$, we obtain $A+A \subset A$. On the other hand $A=\{0\}+A \subset A+A$, implying $A=A+A=B+C$.

Therefore $A+B+C=A+A+A=A$, and now $B+B=C+A$ and $C+C=A+B$ yield $B+B+B=A+B+C=A, C+C+C=A+B+C=A$. In particular if $r \in \mathbb{Q}=A \cup B \cup C$ is arbitrary then $3 r \in A$.

However such a conclusion is impossible. Take any $b \in B(B \neq \emptyset)$ and let $r=b / 3 \in \mathbb{Q}$. Then $b=3 r \in A$ which is a contradiction.

Solution 2. We prove that the example for $\mathbb{Z}$ from the first solution is unique, and then use this fact to solve part b).

Let $\mathbb{Z}=A \cup B \cup C$ be a partition of $\mathbb{Z}$ with $A, B, C \neq \emptyset$ and $A+B, B+C, C+A$ disjoint. We need the relations (1) which clearly hold for $\mathbb{Z}$. Fix two consecutive integers from different sets, say $b \in B$ and $c=b+1 \in C$. For every $a \in A$ we have, in view of (1), $a-1=a+b-c \in C$ and $a+1=a+c-b \in B$. So every $a \in A$ is preceded by a number from $C$ and followed by a number from $B$.

In particular there are pairs of the form $c, c+1$ with $c \in C, c+1 \in A$. For such a pair and any $b \in B$ analogous reasoning shows that each $b \in B$ is preceded by a number from $A$ and followed by a number from $C$. There are also pairs $b, b-1$ with $b \in B, b-1 \in A$. We use them in a similar way to prove that each $c \in C$ is preceded by a number from $B$ and followed by a number from $A$.

By putting the observations together we infer that $A, B, C$ are the three congruence classes modulo 3. Observe that all multiples of 3 are in the set of the partition that contains 0 .

Now we turn to part b). Suppose that there is a partition of $\mathbb{Q}$ with the given properties. Choose three rationals $r_{i}=p_{i} / q_{i}$ from the three sets $A, B, C, i=1,2,3$, and set $N=3 q_{1} q_{2} q_{3}$.

Let $S \subset \mathbb{Q}$ be the set of fractions with denominators $N$ (irreducible or not). It is obtained through multiplication of every integer by the constant $1 / N$, hence closed under sums and differences. Moreover, if we identify each $k \in \mathbb{Z}$ with $k / N \in S$ then $S$ is essentially the set $\mathbb{Z}$ with respect to addition. The numbers $r_{i}$ belong to $S$ because

$$
r_{1}=\frac{3 p_{1} q_{2} q_{3}}{N}, \quad r_{2}=\frac{3 p_{2} q_{3} q_{1}}{N}, \quad r_{3}=\frac{3 p_{3} q_{1} q_{2}}{N}
$$

The partition $\mathbb{Q}=A \cup B \cup C$ of $\mathbb{Q}$ induces a partition $S=A^{\prime} \cup B^{\prime} \cup C^{\prime}$ of $S$, with $A^{\prime}=A \cap S$, $B^{\prime}=B \cap S, C^{\prime}=C \cap S$. Clearly $A^{\prime}+B^{\prime}, B^{\prime}+C^{\prime}, C^{\prime}+A^{\prime}$ are disjoint, so this partition has the properties we consider.

By the uniqueness of the example for $\mathbb{Z}$ the sets $A^{\prime}, B^{\prime}, C^{\prime}$ are the congruence classes modulo 3 , multiplied by $1 / N$. Also all multiples of $3 / N$ are in the same set, $A^{\prime}, B^{\prime}$ or $C^{\prime}$. This holds for $r_{1}, r_{2}, r_{3}$ in particular as they are all multiples of $3 / N$. However $r_{1}, r_{2}, r_{3}$ are in different sets $A^{\prime}, B^{\prime}, C^{\prime}$ since they were chosen from different sets $A, B, C$. The contradiction ends the proof.

Comment. The uniqueness of the example for $\mathbb{Z}$ can also be deduced from the argument in the first solution.

A3. Let $a_{2}, \ldots, a_{n}$ be $n-1$ positive real numbers, where $n \geq 3$, such that $a_{2} a_{3} \cdots a_{n}=1$. Prove that

$$
\left(1+a_{2}\right)^{2}\left(1+a_{3}\right)^{3} \cdots\left(1+a_{n}\right)^{n}>n^{n} .
$$

Solution. The substitution $a_{2}=\frac{x_{2}}{x_{1}}, a_{3}=\frac{x_{3}}{x_{2}}, \ldots, a_{n}=\frac{x_{1}}{x_{n-1}}$ transforms the original problem into the inequality

$$
\left(x_{1}+x_{2}\right)^{2}\left(x_{2}+x_{3}\right)^{3} \cdots\left(x_{n-1}+x_{1}\right)^{n}>n^{n} x_{1}^{2} x_{2}^{3} \cdots x_{n-1}^{n}
$$

for all $x_{1}, \ldots, x_{n-1}>0$. To prove this, we use the AM-GM inequality for each factor of the left-hand side as follows:

$$
\begin{array}{rlcl}
\left(x_{1}+x_{2}\right)^{2} & & & \geq 2^{2} x_{1} x_{2} \\
\left(x_{2}+x_{3}\right)^{3} & = & \left(2\left(\frac{x_{2}}{2}\right)+x_{3}\right)^{3} & \geq 3^{3}\left(\frac{x_{2}}{2}\right)^{2} x_{3} \\
\left(x_{3}+x_{4}\right)^{4} & = & \left(3\left(\frac{x_{3}}{3}\right)+x_{4}\right)^{4} & \geq 4^{4}\left(\frac{x_{3}}{3}\right)^{3} x_{4} \\
& \vdots & \vdots & \vdots
\end{array}
$$

Multiplying these inequalities together gives $\left({ }^{*}\right)$, with inequality sign $\geq$ instead of $>$. However for the equality to occur it is necessary that $x_{1}=x_{2}, x_{2}=2 x_{3}, \ldots, x_{n-1}=(n-1) x_{1}$, implying $x_{1}=(n-1) ! x_{1}$. This is impossible since $x_{1}>0$ and $n \geq 3$. Therefore the inequality is strict.

Comment. One can avoid the substitution $a_{i}=x_{i} / x_{i-1}$. Apply the weighted AM-GM inequality to each factor $\left(1+a_{k}\right)^{k}$, with the same weights like above, to obtain

$$
\left(1+a_{k}\right)^{k}=\left((k-1) \frac{1}{k-1}+a_{k}\right)^{k} \geq \frac{k^{k}}{(k-1)^{k-1}} a_{k}
$$

Multiplying all these inequalities together gives

$$
\left(1+a_{2}\right)^{2}\left(1+a_{3}\right)^{3} \cdots\left(1+a_{n}\right)^{n} \geq n^{n} a_{2} a_{3} \cdots a_{n}=n^{n} .
$$

The same argument as in the proof above shows that the equality cannot be attained.

A4. Let $f$ and $g$ be two nonzero polynomials with integer coefficients and $\operatorname{deg} f>\operatorname{deg} g$. Suppose that for infinitely many primes $p$ the polynomial $p f+g$ has a rational root. Prove that $f$ has a rational root.

Solution 1. Since $\operatorname{deg} f>\operatorname{deg} g$, we have $|g(x) / f(x)|<1$ for sufficiently large $x$; more precisely, there is a real number $R$ such that $|g(x) / f(x)|<1$ for all $x$ with $|x|>R$. Then for all such $x$ and all primes $p$ we have

$$
|p f(x)+g(x)| \geq|f(x)|\left(p-\frac{|g(x)|}{|f(x)|}\right)>0
$$

Hence all real roots of the polynomials $p f+g$ lie in the interval $[-R, R]$.

Let $f(x)=a_{n} x^{n}+a_{n-1} x^{n-1}+\cdots+a_{0}$ and $g(x)=b_{m} x^{m}+b_{m-1} x^{m-1}+\cdots+b_{0}$ where $n>m, a_{n} \neq 0$ and $b_{m} \neq 0$. Upon replacing $f(x)$ and $g(x)$ by $a_{n}^{n-1} f\left(x / a_{n}\right)$ and $a_{n}^{n-1} g\left(x / a_{n}\right)$ respectively, we reduce the problem to the case $a_{n}=1$. In other words one can assume that $f$ is monic. Then the leading coefficient of $p f+g$ is $p$, and if $r=u / v$ is a rational root of $p f+g$ with $(u, v)=1$ and $v>0$, then either $v=1$ or $v=p$.

First consider the case when $v=1$ infinitely many times. If $v=1$ then $|u| \leq R$, so there are only finitely many possibilities for the integer $u$. Therefore there exist distinct primes $p$ and $q$ for which we have the same value of $u$. Then the polynomials $p f+g$ and $q f+g$ share this root, implying $f(u)=g(u)=0$. So in this case $f$ and $g$ have an integer root in common.

Now suppose that $v=p$ infinitely many times. By comparing the exponent of $p$ in the denominators of $p f(u / p)$ and $g(u / p)$ we get $m=n-1$ and $p f(u / p)+g(u / p)=0$ reduces to an equation of the form

$$
\left(u^{n}+a_{n-1} p u^{n-1}+\ldots+a_{0} p^{n}\right)+\left(b_{n-1} u^{n-1}+b_{n-2} p u^{n-2}+\ldots+b_{0} p^{n-1}\right)=0 .
$$

The equation above implies that $u^{n}+b_{n-1} u^{n-1}$ is divisible by $p$ and hence, since $(u, p)=1$, we have $u+b_{n-1}=p k$ with some integer $k$. On the other hand all roots of $p f+g$ lie in the interval $[-R, R]$, so that

$$
\begin{gathered}
\frac{\left|p k-b_{n-1}\right|}{p}=\frac{|u|}{p}<R, \\
|k|<R+\frac{\left|b_{n-1}\right|}{p}<R+\left|b_{n-1}\right| .
\end{gathered}
$$

Therefore the integer $k$ can attain only finitely many values. Hence there exists an integer $k$ such that the number $\frac{p k-b_{n-1}}{p}=k-\frac{b_{n-1}}{p}$ is a root of $p f+g$ for infinitely many primes $p$. For these primes we have

$$
f\left(k-b_{n-1} \frac{1}{p}\right)+\frac{1}{p} g\left(k-b_{n-1} \frac{1}{p}\right)=0 .
$$

So the equation

$$
f\left(k-b_{n-1} x\right)+x g\left(k-b_{n-1} x\right)=0
$$

has infinitely many solutions of the form $x=1 / p$. Since the left-hand side is a polynomial, this implies that (1) is a polynomial identity, so it holds for all real $x$. In particular, by substituting $x=0$ in (1) we get $f(k)=0$. Thus the integer $k$ is a root of $f$.

In summary the monic polynomial $f$ obtained after the initial reduction always has an integer root. Therefore the original polynomial $f$ has a rational root.

Solution 2. Analogously to the first solution, there exists a real number $R$ such that the complex roots of all polynomials of the form $p f+g$ lie in the disk $|z| \leq R$.

For each prime $p$ such that $p f+g$ has a rational root, by GAUSs' lemma $p f+g$ is the product of two integer polynomials, one with degree 1 and the other with degree $\operatorname{deg} f-1$. Since $p$ is a prime, the leading coefficient of one of these factors divides the leading coefficient of $f$. Denote that factor by $h_{p}$.

By narrowing the set of the primes used we can assume that all polynomials $h_{p}$ have the same degree and the same leading coefficient. Their complex roots lie in the disk $|z| \leq R$, hence VIETA's formulae imply that all coefficients of all polynomials $h_{p}$ form a bounded set. Since these coefficients are integers, there are only finitely many possible polynomials $h_{p}$. Hence there is a polynomial $h$ such that $h_{p}=h$ for infinitely many primes $p$.

Finally, if $p$ and $q$ are distinct primes with $h_{p}=h_{q}=h$ then $h$ divides $(p-q) f$. Since $\operatorname{deg} h=1$ or $\operatorname{deg} h=\operatorname{deg} f-1$, in both cases $f$ has a rational root.

Comment. Clearly the polynomial $h$ is a common factor of $f$ and $g$. If $\operatorname{deg} h=1$ then $f$ and $g$ share a rational root. Otherwise $\operatorname{deg} h=\operatorname{deg} f-1$ forces $\operatorname{deg} g=\operatorname{deg} f-1$ and $g$ divides $f$ over the rationals.

Solution 3. Like in the first solution, there is a real number $R$ such that the real roots of all polynomials of the form $p f+g$ lie in the interval $[-R, R]$.

Let $p_{1}<p_{2}<\cdots$ be an infinite sequence of primes so that for every index $k$ the polynomial $p_{k} f+g$ has a rational root $r_{k}$. The sequence $r_{1}, r_{2}, \ldots$ is bounded, so it has a convergent subsequence $r_{k_{1}}, r_{k_{2}}, \ldots$ Now replace the sequences $\left(p_{1}, p_{2}, \ldots\right)$ and $\left(r_{1}, r_{2}, \ldots\right)$ by $\left(p_{k_{1}}, p_{k_{2}}, \ldots\right)$ and $\left(r_{k_{1}}, r_{k_{2}}, \ldots\right)$; after this we can assume that the sequence $r_{1}, r_{2}, \ldots$ is convergent. Let $\alpha=\lim _{k \rightarrow \infty} r_{k}$. We show that $\alpha$ is a rational root of $f$.

Over the interval $[-R, R]$, the polynomial $g$ is bounded, $|g(x)| \leq M$ with some fixed $M$. Therefore

$$
\left|f\left(r_{k}\right)\right|=\left|f\left(r_{k}\right)-\frac{p_{k} f\left(r_{k}\right)+g\left(r_{k}\right)}{p_{k}}\right|=\frac{\left|g\left(r_{k}\right)\right|}{p_{k}} \leq \frac{M}{p_{k}} \rightarrow 0,
$$

and

$$
f(\alpha)=f\left(\lim _{k \rightarrow \infty} r_{k}\right)=\lim _{k \rightarrow \infty} f\left(r_{k}\right)=0
$$

So $\alpha$ is a root of $f$ indeed.

Now let $u_{k}, v_{k}$ be relative prime integers for which $r_{k}=\frac{u_{k}}{v_{k}}$. Let $a$ be the leading coefficient of $f$, let $b=f(0)$ and $c=g(0)$ be the constant terms of $f$ and $g$, respectively. The leading coefficient of the polynomial $p_{k} f+g$ is $p_{k} a$, its constant term is $p_{k} b+c$. So $v_{k}$ divides $p_{k} a$ and $u_{k}$ divides $p_{k} b+c$. Let $p_{k} b+c=u_{k} e_{k}$ (if $p_{k} b+c=u_{k}=0$ then let $e_{k}=1$ ).

We prove that $\alpha$ is rational by using the following fact. Let $\left(p_{n}\right)$ and $\left(q_{n}\right)$ be sequences of integers such that the sequence $\left(p_{n} / q_{n}\right)$ converges. If $\left(p_{n}\right)$ or $\left(q_{n}\right)$ is bounded then $\lim \left(p_{n} / q_{n}\right)$ is rational.

Case 1: There is an infinite subsequence $\left(k_{n}\right)$ of indices such that $v_{k_{n}}$ divides $a$. Then $\left(v_{k_{n}}\right)$ is bounded, so $\alpha=\lim _{n \rightarrow \infty}\left(u_{k_{n}} / v_{k_{n}}\right)$ is rational.

Case 2: There is an infinite subsequence $\left(k_{n}\right)$ of indices such that $v_{k_{n}}$ does not divide $a$. For such indices we have $v_{k_{n}}=p_{k_{n}} d_{k_{n}}$ where $d_{k_{n}}$ is a divisor of $a$. Then

$$
\alpha=\lim _{n \rightarrow \infty} \frac{u_{k_{n}}}{v_{k_{n}}}=\lim _{n \rightarrow \infty} \frac{p_{k_{n}} b+c}{p_{k_{n}} d_{k_{n}} e_{k_{n}}}=\lim _{n \rightarrow \infty} \frac{b}{d_{k_{n}} e_{k_{n}}}+\lim _{n \rightarrow \infty} \frac{c}{p_{k_{n}} d_{k_{n}} e_{k_{n}}}=\lim _{n \rightarrow \infty} \frac{b}{d_{k_{n}} e_{k_{n}}} .
$$

Because the numerator $b$ in the last limit is bounded, $\alpha$ is rational.

A5. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy the conditions

$$
f(1+x y)-f(x+y)=f(x) f(y) \quad \text { for all } x, y \in \mathbb{R}
$$

and $f(-1) \neq 0$.

Solution. The only solution is the function $f(x)=x-1, x \in \mathbb{R}$.

We set $g(x)=f(x)+1$ and show that $g(x)=x$ for all real $x$. The conditions take the form

$$
g(1+x y)-g(x+y)=(g(x)-1)(g(y)-1) \quad \text { for all } x, y \in \mathbb{R} \text { and } g(-1) \neq 1
$$

Denote $C=g(-1)-1 \neq 0$. Setting $y=-1$ in (1) gives

$$
g(1-x)-g(x-1)=C(g(x)-1) .
$$

Set $x=1$ in (2) to obtain $C(g(1)-1)=0$. Hence $g(1)=1$ as $C \neq 0$. Now plugging in $x=0$ and $x=2$ yields $g(0)=0$ and $g(2)=2$ respectively.

We pass on to the key observations

$$
\begin{array}{ll}
g(x)+g(2-x)=2 & \text { for all } x \in \mathbb{R} \\
g(x+2)-g(x)=2 & \text { for all } x \in \mathbb{R}
\end{array}
$$

Replace $x$ by $1-x$ in (2), then change $x$ to $-x$ in the resulting equation. We obtain the relations $g(x)-g(-x)=C(g(1-x)-1), g(-x)-g(x)=C(g(1+x)-1)$. Then adding them up leads to $C(g(1-x)+g(1+x)-2)=0$. Thus $C \neq 0$ implies (3).

Let $u, v$ be such that $u+v=1$. Apply (1) to the pairs $(u, v)$ and $(2-u, 2-v)$ :

$$
g(1+u v)-g(1)=(g(u)-1)(g(v)-1), \quad g(3+u v)-g(3)=(g(2-u)-1)(g(2-v)-1) .
$$

Observe that the last two equations have equal right-hand sides by (3). Hence $u+v=1$ implies

$$
g(u v+3)-g(u v+1)=g(3)-g(1) .
$$

Each $x \leq 5 / 4$ is expressible in the form $x=u v+1$ with $u+v=1$ (the quadratic function $t^{2}-t+(x-1)$ has real roots for $\left.x \leq 5 / 4\right)$. Hence $g(x+2)-g(x)=g(3)-g(1)$ whenever $x \leq 5 / 4$. Because $g(x)=x$ holds for $x=0,1,2$, setting $x=0$ yields $g(3)=3$. This proves (4) for $x \leq 5 / 4$. If $x>5 / 4$ then $-x<5 / 4$ and so $g(2-x)-g(-x)=2$ by the above. On the other hand (3) gives $g(x)=2-g(2-x), g(x+2)=2-g(-x)$, so that $g(x+2)-g(x)=g(2-x)-g(-x)=2$. Thus (4) is true for all $x \in \mathbb{R}$.

Now replace $x$ by $-x$ in (3) to obtain $g(-x)+g(2+x)=2$. In view of (4) this leads to $g(x)+g(-x)=0$, i. e. $g(-x)=-g(x)$ for all $x$. Taking this into account, we apply (1) to the pairs $(-x, y)$ and $(x,-y)$ :

$g(1-x y)-g(-x+y)=(g(x)+1)(1-g(y)), \quad g(1-x y)-g(x-y)=(1-g(x))(g(y)+1)$.

Adding up yields $g(1-x y)=1-g(x) g(y)$. Then $g(1+x y)=1+g(x) g(y)$ by (3). Now the original equation (1) takes the form $g(x+y)=g(x)+g(y)$. Hence $g$ is additive.

By additvity $g(1+x y)=g(1)+g(x y)=1+g(x y)$; since $g(1+x y)=1+g(x) g(y)$ was shown above, we also have $g(x y)=g(x) g(y)$ ( $g$ is multiplicative). In particular $y=x$ gives $g\left(x^{2}\right)=g(x)^{2} \geq 0$ for all $x$, meaning that $g(x) \geq 0$ for $x \geq 0$. Since $g$ is additive and bounded from below on $[0,+\infty)$, it is linear; more exactly $g(x)=g(1) x=x$ for all $x \in \mathbb{R}$.

In summary $f(x)=x-1, x \in \mathbb{R}$. It is straightforward that this function satisfies the requirements.

Comment. There are functions that satisfy the given equation but vanish at -1 , for instance the constant function 0 and $f(x)=x^{2}-1, x \in \mathbb{R}$.

A6. Let $f: \mathbb{N} \rightarrow \mathbb{N}$ be a function, and let $f^{m}$ be $f$ applied $m$ times. Suppose that for every $n \in \mathbb{N}$ there exists a $k \in \mathbb{N}$ such that $f^{2 k}(n)=n+k$, and let $k_{n}$ be the smallest such $k$. Prove that the sequence $k_{1}, k_{2}, \ldots$ is unbounded.

Solution. We restrict attention to the set

$$
S=\left\{1, f(1), f^{2}(1), \ldots\right\}
$$

Observe that $S$ is unbounded because for every number $n$ in $S$ there exists a $k>0$ such that $f^{2 k}(n)=n+k$ is in $S$. Clearly $f$ maps $S$ into itself; moreover $f$ is injective on $S$. Indeed if $f^{i}(1)=f^{j}(1)$ with $i \neq j$ then the values $f^{m}(1)$ start repeating periodically from some point on, and $S$ would be finite.

Define $g: S \rightarrow S$ by $g(n)=f^{2 k_{n}}(n)=n+k_{n}$. We prove that $g$ is injective too. Suppose that $g(a)=g(b)$ with $a<b$. Then $a+k_{a}=f^{2 k_{a}}(a)=f^{2 k_{b}}(b)=b+k_{b}$ implies $k_{a}>k_{b}$. So, since $f$ is injective on $S$, we obtain

$$
f^{2\left(k_{a}-k_{b}\right)}(a)=b=a+\left(k_{a}-k_{b}\right) .
$$

However this contradicts the minimality of $k_{a}$ as $0<k_{a}-k_{b}<k_{a}$.

Let $T$ be the set of elements of $S$ that are not of the form $g(n)$ with $n \in S$. Note that $1 \in T$ by $g(n)>n$ for $n \in S$, so $T$ is non-empty. For each $t \in T$ denote $C_{t}=\left\{t, g(t), g^{2}(t), \ldots\right\}$; call $C_{t}$ the chain starting at $t$. Observe that distinct chains are disjoint because $g$ is injective. Each $n \in S \backslash T$ has the form $n=g\left(n^{\prime}\right)$ with $n^{\prime}<n, n^{\prime} \in S$. Repeated applications of the same observation show that $n \in C_{t}$ for some $t \in T$, i. e. $S$ is the disjoint union of the chains $C_{t}$.

If $f^{n}(1)$ is in the chain $C_{t}$ starting at $t=f^{n_{t}}(1)$ then $n=n_{t}+2 a_{1}+\cdots+2 a_{j}$ with

$$
f^{n}(1)=g^{j}\left(f^{n_{t}}(1)\right)=f^{2 a_{j}}\left(f^{2 a_{j-1}}\left(\cdots f^{2 a_{1}}\left(f^{n_{t}}(1)\right)\right)\right)=f^{n_{t}}(1)+a_{1}+\cdots+a_{j} .
$$

Hence

$$
f^{n}(1)=f^{n_{t}}(1)+\frac{n-n_{t}}{2}=t+\frac{n-n_{t}}{2} .
$$

Now we show that $T$ is infinite. We argue by contradiction. Suppose that there are only finitely many chains $C_{t_{1}}, \ldots, C_{t_{r}}$, starting at $t_{1}<\cdots<t_{r}$. Fix $N$. If $f^{n}(1)$ with $1 \leq n \leq N$ is in $C_{t}$ then $f^{n}(1)=t+\frac{n-n_{t}}{2} \leq t_{r}+\frac{N}{2}$ by (1). But then the $N+1$ distinct natural numbers $1, f(1), \ldots, f^{N}(1)$ are all less than $t_{r}+\frac{N}{2}$ and hence $N+1 \leq t_{r}+\frac{N}{2}$. This is a contradiction if $N$ is sufficiently large, and hence $T$ is infinite.

To complete the argument, choose any $k$ in $\mathbb{N}$ and consider the $k+1$ chains starting at the first $k+1$ numbers in $T$. Let $t$ be the greatest one among these numbers. Then each of the chains in question contains a number not exceeding $t$, and at least one of them does not contain any number among $t+1, \ldots, t+k$. So there is a number $n$ in this chain such that $g(n)-n>k$, i. e. $k_{n}>k$. In conclusion $k_{1}, k_{2}, \ldots$ is unbounded.

A7. We say that a function $f: \mathbb{R}^{k} \rightarrow \mathbb{R}$ is a metapolynomial if, for some positive integers $m$ and $n$, it can be represented in the form

$$
f\left(x_{1}, \ldots, x_{k}\right)=\max _{i=1, \ldots, m} \min _{j=1, \ldots, n} P_{i, j}\left(x_{1}, \ldots, x_{k}\right)
$$

where $P_{i, j}$ are multivariate polynomials. Prove that the product of two metapolynomials is also a metapolynomial.

Solution. We use the notation $f(x)=f\left(x_{1}, \ldots, x_{k}\right)$ for $x=\left(x_{1}, \ldots, x_{k}\right)$ and $[m]=\{1,2, \ldots, m\}$. Observe that if a metapolynomial $f(x)$ admits a representation like the one in the statement for certain positive integers $m$ and $n$, then they can be replaced by any $m^{\prime} \geq m$ and $n^{\prime} \geq n$. For instance, if we want to replace $m$ by $m+1$ then it is enough to define $P_{m+1, j}(x)=P_{m, j}(x)$ and note that repeating elements of a set do not change its maximum nor its minimum. So one can assume that any two metapolynomials are defined with the same $m$ and $n$. We reserve letters $P$ and $Q$ for polynomials, so every function called $P, P_{i, j}, Q, Q_{i, j}, \ldots$ is a polynomial function.

We start with a lemma that is useful to change expressions of the form $\min \max f_{i, j}$ to ones of the form $\max \min g_{i, j}$.

Lemma. Let $\left\{a_{i, j}\right\}$ be real numbers, for all $i \in[m]$ and $j \in[n]$. Then

$$
\min _{i \in[m]} \max _{j \in[n]} a_{i, j}=\max _{j_{1}, \ldots, j_{m} \in[n]} \min _{i \in[m]} a_{i, j_{i}}
$$

where the max in the right-hand side is over all vectors $\left(j_{1}, \ldots, j_{m}\right)$ with $j_{1}, \ldots, j_{m} \in[n]$.

Proof. We can assume for all $i$ that $a_{i, n}=\max \left\{a_{i, 1}, \ldots, a_{i, n}\right\}$ and $a_{m, n}=\min \left\{a_{1, n}, \ldots, a_{m, n}\right\}$. The left-hand side is $=a_{m, n}$ and hence we need to prove the same for the right-hand side. If $\left(j_{1}, j_{2}, \ldots, j_{m}\right)=(n, n, \ldots, n)$ then $\min \left\{a_{1, j_{1}}, \ldots, a_{m, j_{m}}\right\}=\min \left\{a_{1, n}, \ldots, a_{m, n}\right\}=a_{m, n}$ which implies that the right-hand side is $\geq a_{m, n}$. It remains to prove the opposite inequality and this is equivalent to $\min \left\{a_{1, j_{1}}, \ldots, a_{m, j_{m}}\right\} \leq a_{m, n}$ for all possible $\left(j_{1}, j_{2}, \ldots, j_{m}\right)$. This is true because $\min \left\{a_{1, j_{1}}, \ldots, a_{m, j_{m}}\right\} \leq a_{m, j_{m}} \leq a_{m, n}$.

We need to show that the family $\mathcal{M}$ of metapolynomials is closed under multiplication, but it turns out easier to prove more: that it is also closed under addition, maxima and minima.

First we prove the assertions about the maxima and the minima. If $f_{1}, \ldots, f_{r}$ are metapolynomials, assume them defined with the same $m$ and $n$. Then

$$
f=\max \left\{f_{1}, \ldots, f_{r}\right\}=\max \left\{\max _{i \in[m]} \min _{j \in[n]} P_{i, j}^{1}, \ldots, \max _{i \in[m]} \min _{j \in[n]} P_{i, j}^{r}\right\}=\max _{s \in[r], i \in[m]} \min _{j \in[n]} P_{i, j}^{s}
$$

It follows that $f=\max \left\{f_{1}, \ldots, f_{r}\right\}$ is a metapolynomial. The same argument works for the minima, but first we have to replace $\min \max$ by $\max \min$, and this is done via the lemma.

Another property we need is that if $f=\max \min P_{i, j}$ is a metapolynomial then so is $-f$. Indeed, $-f=\min \left(-\min P_{i, j}\right)=\min \max P_{i, j}$.

To prove $\mathcal{M}$ is closed under addition let $f=\max \min P_{i, j}$ and $g=\max \min Q_{i, j}$. Then

$$
\begin{gathered}
f(x)+g(x)=\max _{i \in[m]} \min _{j \in[n]} P_{i, j}(x)+\max _{i \in[m]} \min _{j \in[n]} Q_{i, j}(x) \\
=\max _{i_{1}, i_{2} \in[m]}\left(\min _{j \in[n]} P_{i_{1}, j}(x)+\min _{j \in[n]} Q_{i_{2}, j}(x)\right)=\max _{i_{1}, i_{2} \in[m]} \min _{j_{1}, j_{2} \in[n]}\left(P_{i_{1}, j_{1}}(x)+Q_{i_{2}, j_{2}}(x)\right),
\end{gathered}
$$

and hence $f(x)+g(x)$ is a metapolynomial.

We proved that $\mathcal{M}$ is closed under sums, maxima and minima, in particular any function that can be expressed by sums, max, min, polynomials or even metapolynomials is in $\mathcal{M}$.

We would like to proceed with multiplication along the same lines like with addition, but there is an essential difference. In general the product of the maxima of two sets is not equal
to the maximum of the product of the sets. We need to deal with the fact that $a<b$ and $c<d$ do not imply $a c<b d$. However this is true for $a, b, c, d \geq 0$.

In view of this we decompose each function $f(x)$ into its positive part $f^{+}(x)=\max \{f(x), 0\}$ and its negative part $f^{-}(x)=\max \{0,-f(x)\}$. Note that $f=f^{+}-f^{-}$and $f^{+}, f^{-} \in \mathcal{M}$ if $f \in \mathcal{M}$. The whole problem reduces to the claim that if $f$ and $g$ are metapolynomials with $f, g \geq 0$ then $f g$ it is also a metapolynomial.

Assuming this claim, consider arbitrary $f, g \in \mathcal{M}$. We have

$$
f g=\left(f^{+}-f^{-}\right)\left(g^{+}-g^{-}\right)=f^{+} g^{+}-f^{+} g^{-}-f^{-} g^{+}+f^{-} g^{-},
$$

and hence $f g \in \mathcal{M}$. Indeed, $\mathcal{M}$ is closed under addition, also $f^{+} g^{+}, f^{+} g^{-}, f^{-} g^{+}, f^{-} g^{-} \in \mathcal{M}$ because $f^{+}, f^{-}, g^{+}, g^{-} \geq 0$.

It remains to prove the claim. In this case $f, g \geq 0$, and one can try to repeat the argument for the sum. More precisely, let $f=\max \min P_{i j} \geq 0$ and $g=\max \min Q_{i j} \geq 0$. Then

$$
f g=\max \min P_{i, j} \cdot \max \min Q_{i, j}=\max \min P_{i, j}^{+} \cdot \max \min Q_{i, j}^{+}=\max \min P_{i_{1}, j_{1}}^{+} \cdot Q_{i_{2}, j_{2}}^{+} .
$$

Hence it suffices to check that $P^{+} Q^{+} \in \mathcal{M}$ for any pair of polynomials $P$ and $Q$. This reduces to the identity

$$
u^{+} v^{+}=\max \left\{0, \min \{u v, u, v\}, \min \left\{u v, u v^{2}, u^{2} v\right\}, \min \left\{u v, u, u^{2} v\right\}, \min \left\{u v, u v^{2}, v\right\}\right\}
$$

with $u$ replaced by $P(x)$ and $v$ replaced by $Q(x)$. The formula is proved by a case-by-case analysis. If $u \leq 0$ or $v \leq 0$ then both sides equal 0 . In case $u, v \geq 0$, the right-hand side is clearly $\leq u v$. To prove the opposite inequality we use that $u v$ equals

$$
\begin{array}{ll}
\min \{u v, u, v\} & \text { if } 0 \leq u, v \leq 1, \\
\min \left\{u v, u v^{2}, u^{2} v\right\} & \text { if } 1 \leq u, v, \\
\min \left\{u v, u, u^{2} v\right\} & \text { if } 0 \leq v \leq 1 \leq u, \\
\min \left\{u v, u v^{2}, v\right\} & \text { if } 0 \leq u \leq 1 \leq v .
\end{array}
$$

Comment. The case $k=1$ is simpler and can be solved by proving that a function $f: \mathbb{R} \rightarrow \mathbb{R}$ is a metapolynomial if and only if it is a piecewise polinomial (and continuos) function.

It is enough to prove that all such functions are metapolynomials, and this easily reduces to the following case. Given a polynomial $P(x)$ with $P(0)=0$, the function $f$ defined by $f(x)=P(x)$ for $x \geq 0$ and 0 otherwise is a metapolynomial. For this last claim, it suffices to prove that $\left(x^{+}\right)^{n}$ is a metapolynomial, and this follows from the formula $\left(x^{+}\right)^{n}=\max \left\{0, \min \left\{x^{n-1}, x^{n}\right\}, \min \left\{x^{n}, x^{n+1}\right\}\right\}$.

## Combinatorics

C1. Several positive integers are written in a row. Iteratively, Alice chooses two adjacent numbers $x$ and $y$ such that $x>y$ and $x$ is to the left of $y$, and replaces the pair $(x, y)$ by either $(y+1, x)$ or $(x-1, x)$. Prove that she can perform only finitely many such iterations.

Solution 1. Note first that the allowed operation does not change the maximum $M$ of the initial sequence. Let $a_{1}, a_{2}, \ldots, a_{n}$ be the numbers obtained at some point of the process. Consider the sum

$$
S=a_{1}+2 a_{2}+\cdots+n a_{n}
$$

We claim that $S$ increases by a positive integer amount with every operation. Let the operation replace the pair ( $\left.a_{i}, a_{i+1}\right)$ by a pair $\left(c, a_{i}\right)$, where $a_{i}>a_{i+1}$ and $c=a_{i+1}+1$ or $c=a_{i}-1$. Then the new and the old value of $S$ differ by $d=\left(i c+(i+1) a_{i}\right)-\left(i a_{i}+(i+1) a_{i+1}\right)=a_{i}-a_{i+1}+i\left(c-a_{i+1}\right)$. The integer $d$ is positive since $a_{i}-a_{i+1} \geq 1$ and $c-a_{i+1} \geq 0$.

On the other hand $S \leq(1+2+\cdots+n) M$ as $a_{i} \leq M$ for all $i=1, \ldots, n$. Since $S$ increases by at least 1 at each step and never exceeds the constant $(1+2+\cdots+n) M$, the process stops after a finite number of iterations.

Solution 2. Like in the first solution note that the operations do not change the maximum $M$ of the initial sequence. Now consider the reverse lexicographical order for $n$-tuples of integers. We say that $\left(x_{1}, \ldots, x_{n}\right)<\left(y_{1}, \ldots, y_{n}\right)$ if $x_{n}<y_{n}$, or if $x_{n}=y_{n}$ and $x_{n-1}<y_{n-1}$, or if $x_{n}=y_{n}$, $x_{n-1}=y_{n-1}$ and $x_{n-2}<y_{n-2}$, etc. Each iteration creates a sequence that is greater than the previous one with respect to this order, and no sequence occurs twice during the process. On the other hand there are finitely many possible sequences because their terms are always positive integers not exceeding $M$. Hence the process cannot continue forever.

Solution 3. Let the current numbers be $a_{1}, a_{2}, \ldots, a_{n}$. Define the score $s_{i}$ of $a_{i}$ as the number of $a_{j}$ 's that are less than $a_{i}$. Call the sequence $s_{1}, s_{2}, \ldots, s_{n}$ the score sequence of $a_{1}, a_{2}, \ldots, a_{n}$.

Let us say that a sequence $x_{1}, \ldots, x_{n}$ dominates a sequence $y_{1}, \ldots, y_{n}$ if the first index $i$ with $x_{i} \neq y_{i}$ is such that $x_{i}<y_{i}$. We show that after each operation the new score sequence dominates the old one. Score sequences do not repeat, and there are finitely many possibilities for them, no more than $(n-1)^{n}$. Hence the process will terminate.

Consider an operation that replaces $(x, y)$ by $(a, x)$, with $a=y+1$ or $a=x-1$. Suppose that $x$ was originally at position $i$. For each $j<i$ the score $s_{j}$ does not increase with the change because $y \leq a$ and $x \leq x$. If $s_{j}$ decreases for some $j<i$ then the new score sequence dominates the old one. Assume that $s_{j}$ stays the same for all $j<i$ and consider $s_{i}$. Since $x>y$ and $y \leq a \leq x$, we see that $s_{i}$ decreases by at least 1 . This concludes the proof.

Comment. All three proofs work if $x$ and $y$ are not necessarily adjacent, and if the pair $(x, y)$ is replaced by any pair $(a, x)$, with $a$ an integer satisfying $y \leq a \leq x$. There is nothing special about the "weights" $1,2, \ldots, n$ in the definition of $S=\sum_{i=1}^{n} i a_{i}$ from the first solution. For any sequence $w_{1}<w_{2}<\cdots<w_{n}$ of positive integers, the sum $\sum_{i=1}^{n} w_{i} a_{i}$ increases by at least 1 with each operation.

Consider the same problem, but letting Alice replace the pair $(x, y)$ by $(a, x)$, where $a$ is any positive integer less than $x$. The same conclusion holds in this version, i. e. the process stops eventually. The solution using the reverse lexicographical order works without any change. The first solution would require a special set of weights like $w_{i}=M^{i}$ for $i=1, \ldots, n$.

Comment. The first and the second solutions provide upper bounds for the number of possible operations, respectively of order $M n^{2}$ and $M^{n}$ where $M$ is the maximum of the original sequence. The upper bound $(n-1)^{n}$ in the third solution does not depend on $M$.

C2. Let $n \geq 1$ be an integer. What is the maximum number of disjoint pairs of elements of the set $\{1,2, \ldots, n\}$ such that the sums of the different pairs are different integers not exceeding $n$ ?

Solution. Consider $x$ such pairs in $\{1,2, \ldots, n\}$. The sum $S$ of the $2 x$ numbers in them is at least $1+2+\cdots+2 x$ since the pairs are disjoint. On the other hand $S \leq n+(n-1)+\cdots+(n-x+1)$ because the sums of the pairs are different and do not exceed $n$. This gives the inequality

$$
\frac{2 x(2 x+1)}{2} \leq n x-\frac{x(x-1)}{2},
$$

which leads to $x \leq \frac{2 n-1}{5}$. Hence there are at most $\left\lfloor\frac{2 n-1}{5}\right\rfloor$ pairs with the given properties.

We show a construction with exactly $\left\lfloor\frac{2 n-1}{5}\right\rfloor$ pairs. First consider the case $n=5 k+3$ with $k \geq 0$, where $\left\lfloor\frac{2 n-1}{5}\right\rfloor=2 k+1$. The pairs are displayed in the following table.

| Pairs | $3 k+1$ | $3 k$ | $\cdots$ | $2 k+2$ | $4 k+2$ | $4 k+1$ | $\cdots$ | $3 k+3$ | $3 k+2$ |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|  | 2 | 4 | $\cdots$ | $2 k$ | 1 | 3 | $\cdots$ | $2 k-1$ | $2 k+1$ |
| Sums | $3 k+3$ | $3 k+4$ | $\cdots$ | $4 k+2$ | $4 k+3$ | $4 k+4$ | $\cdots$ | $5 k+2$ | $5 k+3$ |

The $2 k+1$ pairs involve all numbers from 1 to $4 k+2$; their sums are all numbers from $3 k+3$ to $5 k+3$. The same construction works for $n=5 k+4$ and $n=5 k+5$ with $k \geq 0$. In these cases the required number $\left\lfloor\frac{2 n-1}{5}\right\rfloor$ of pairs equals $2 k+1$ again, and the numbers in the table do not exceed $5 k+3$. In the case $n=5 k+2$ with $k \geq 0$ one needs only $2 k$ pairs. They can be obtained by ignoring the last column of the table (thus removing $5 k+3$ ). Finally, $2 k$ pairs are also needed for the case $n=5 k+1$ with $k \geq 0$. Now it suffices to ignore the last column of the table and then subtract 1 from each number in the first row.

Comment. The construction above is not unique. For instance, the following table shows another set of $2 k+1$ pairs for the cases $n=5 k+3, n=5 k+4$, and $n=5 k+5$.

| Pairs | 1 | 2 | $\cdots$ | $k$ | $k+1$ | $k+2$ | $\cdots$ | $2 k+1$ |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|  | $4 k+1$ | $4 k-1$ | $\cdots$ | $2 k+3$ | $4 k+2$ | $4 k$ | $\cdots$ | $2 k+2$ |
| Sums | $4 k+2$ | $4 k+1$ | $\cdots$ | $3 k+3$ | $5 k+3$ | $5 k+2$ | $\cdots$ | $4 k+3$ |

The table for the case $n=5 k+2$ would be the same, with the pair $(k+1,4 k+2)$ removed. For the case $n=5 k+1$ remove the last column and subtract 2 from each number in the second row.

C3. In a $999 \times 999$ square table some cells are white and the remaining ones are red. Let $T$ be the number of triples $\left(C_{1}, C_{2}, C_{3}\right)$ of cells, the first two in the same row and the last two in the same column, with $C_{1}$ and $C_{3}$ white and $C_{2}$ red. Find the maximum value $T$ can attain.

Solution. We prove that in an $n \times n$ square table there are at most $\frac{4 n^{4}}{27}$ such triples.

Let row $i$ and column $j$ contain $a_{i}$ and $b_{j}$ white cells respectively, and let $R$ be the set of red cells. For every red cell $(i, j)$ there are $a_{i} b_{j}$ admissible triples $\left(C_{1}, C_{2}, C_{3}\right)$ with $C_{2}=(i, j)$, therefore

$$
T=\sum_{(i, j) \in R} a_{i} b_{j}
$$

We use the inequality $2 a b \leq a^{2}+b^{2}$ to obtain

$$
T \leq \frac{1}{2} \sum_{(i, j) \in R}\left(a_{i}^{2}+b_{j}^{2}\right)=\frac{1}{2} \sum_{i=1}^{n}\left(n-a_{i}\right) a_{i}^{2}+\frac{1}{2} \sum_{j=1}^{n}\left(n-b_{j}\right) b_{j}^{2}
$$

This is because there are $n-a_{i}$ red cells in row $i$ and $n-b_{j}$ red cells in column $j$. Now we maximize the right-hand side.

By the AM-GM inequality we have

$$
(n-x) x^{2}=\frac{1}{2}(2 n-2 x) \cdot x \cdot x \leq \frac{1}{2}\left(\frac{2 n}{3}\right)^{3}=\frac{4 n^{3}}{27}
$$

with equality if and only if $x=\frac{2 n}{3}$. By putting everything together, we get

$$
T \leq \frac{n}{2} \frac{4 n^{3}}{27}+\frac{n}{2} \frac{4 n^{3}}{27}=\frac{4 n^{4}}{27}
$$

If $n=999$ then any coloring of the square table with $x=\frac{2 n}{3}=666$ white cells in each row and column attains the maximum as all inequalities in the previous argument become equalities. For example color a cell $(i, j)$ white if $i-j \equiv 1,2, \ldots, 666(\bmod 999)$, and red otherwise.

Therefore the maximum value $T$ can attain is $T=\frac{4 \cdot 999^{4}}{27}$.

Comment. One can obtain a better preliminary estimate with the CAUCHY-SCHWARZ inequality:

$$
T=\sum_{(i, j) \in R} a_{i} b_{j} \leq\left(\sum_{(i, j) \in R} a_{i}^{2}\right)^{\frac{1}{2}} \cdot\left(\sum_{(i, j) \in R} b_{j}^{2}\right)^{\frac{1}{2}}=\left(\sum_{i=1}^{n}\left(n-a_{i}\right) a_{i}^{2}\right)^{\frac{1}{2}} \cdot\left(\sum_{j=1}^{n}\left(n-b_{j}\right) b_{j}^{2}\right)^{\frac{1}{2}}
$$

It can be used to reach the same conclusion.

C4. Players $A$ and $B$ play a game with $N \geq 2012$ coins and 2012 boxes arranged around a circle. Initially $A$ distributes the coins among the boxes so that there is at least 1 coin in each box. Then the two of them make moves in the order $B, A, B, A, \ldots$ by the following rules:

- On every move of his $B$ passes 1 coin from every box to an adjacent box.
- On every move of hers $A$ chooses several coins that were not involved in $B$ 's previous move and are in different boxes. She passes every chosen coin to an adjacent box.

Player $A$ 's goal is to ensure at least 1 coin in each box after every move of hers, regardless of how $B$ plays and how many moves are made. Find the least $N$ that enables her to succeed.

Solution. We argue for a general $n \geq 7$ instead of 2012 and prove that the required minimum $N$ is $2 n-2$. For $n=2012$ this gives $N_{\min }=4022$.

a) If $N=2 n-2$ player $A$ can achieve her goal. Let her start the game with a regular distribution: $n-2$ boxes with 2 coins and 2 boxes with 1 coin. Call the boxes of the two kinds red and white respectively. We claim that on her first move $A$ can achieve a regular distribution again, regardless of $B$ 's first move $M$. She acts according as the following situation $S$ occurs after $M$ or not: The initial distribution contains a red box $R$ with 2 white neighbors, and $R$ receives no coins from them on move $M$.

Suppose that $S$ does not occur. Exactly one of the coins $c_{1}$ and $c_{2}$ in a given red box $X$ is involved in $M$, say $c_{1}$. If $M$ passes $c_{1}$ to the right neighbor of $X$, let $A$ pass $c_{2}$ to its left neighbor, and vice versa. By doing so with all red boxes $A$ performs a legal move $M^{\prime}$. Thus $M$ and $M^{\prime}$ combined move the 2 coins of every red box in opposite directions. Hence after $M$ and $M^{\prime}$ are complete each neighbor of a red box $X$ contains exactly 1 coin that was initially in $X$. So each box with a red neighbor is non-empty after $M^{\prime}$. If initially there is a box $X$ with 2 white neighbors ( $X$ is red and unique) then $X$ receives a coin from at least one of them on move $M$ since $S$ does not occur. Such a coin is not involved in $M^{\prime}$, so $X$ is also non-empty after $M^{\prime}$. Furthermore each box $Y$ has given away its initial content after $M$ and $M^{\prime}$. A red neighbor of $Y$ adds 1 coin to it; a white neighbor adds at most 1 coin because it is not involved in $M^{\prime}$. Hence each box contains 1 or 2 coins after $M^{\prime}$. Because $N=2 n-2$, such a distribution is regular.

Now let $S$ occur after move $M$. Then $A$ leaves untouched the exceptional red box $R$. With all remaining red boxes she proceeds like in the previous case, thus making a legal move $M^{\prime \prime}$. Box $R$ receives no coins from its neighbors on either move, so there is 1 coin in it after $M^{\prime \prime}$. Like above $M$ and $M^{\prime \prime}$ combined pass exactly 1 coin from every red box different from $R$ to each of its neighbors. Every box except $R$ has a red neighbor different from $R$, hence all boxes are non-empty after $M^{\prime \prime}$. Next, each box $Y$ except $R$ loses its initial content after $M$ and $M^{\prime \prime}$. A red neighbor of $Y$ adds at most 1 coin to it; a white neighbor also adds at most 1 coin as it does not participate in $M^{\prime \prime}$. Thus each box has 1 or 2 coins after $M^{\prime \prime}$, and the obtained distribution is regular.

Player $A$ can apply the described strategy indefinitely, so $N=2 n-2$ enables her to succeed.

b) For $N \leq 2 n-3$ player $B$ can achieve an empty box after some move of $A$. Let $\alpha$ be a set of $\ell$ consecutive boxes containing a total of $N(\alpha)$ coins. We call $\alpha$ an arc if $\ell \leq n-2$ and $N(\alpha) \leq 2 \ell-3$. Note that $\ell \geq 2$ by the last condition. Moreover if both extremes of $\alpha$ are non-empty boxes then $N(\alpha) \geq 2$, so that $N(\alpha) \leq 2 \ell-3$ implies $\ell \geq 3$. Observe also that if an extreme $X$ of $\alpha$ has more than 1 coin then ignoring $X$ yields a shorter arc. It follows that every arc contains an arc whose extremes have at most 1 coin each.

Given a clockwise labeling $1,2, \ldots, n$ of the boxes, suppose that boxes $1,2, \ldots, \ell$ form an arc $\alpha$, with $\ell \leq n-2$ and $N(\alpha) \leq 2 \ell-3$. Suppose also that all $n \geq 7$ boxes are non-empty. Then $B$ can move so that an arc $\alpha^{\prime}$ with $N\left(\alpha^{\prime}\right)<N(\alpha)$ will appear after any response of $A$.

One may assume exactly 1 coin in boxes 1 and $\ell$ by a previous remark. Let $B$ pass 1 coin in counterclockwise direction from box 1 and box $n$, and in clockwise direction from each remaining box. This leaves $N(\alpha)-2$ coins in the boxes of $\alpha$. In addition, due to $3 \leq \ell \leq n-2$, box $\ell$ has exactly 1 coin $c$, the one received from box $\ell-1$.

Let player $A$ 's next move $M$ pass $k \leq 2$ coins to boxes $1,2, \ldots, \ell$ from the remaining ones. Only boxes 1 and $\ell$ can receive such coins, at most 1 each. If $k<2$ then after move $M$ boxes $1,2, \ldots, \ell$ form an arc $\alpha^{\prime}$ with $N\left(\alpha^{\prime}\right)<N(\alpha)$. If $k=2$ then $M$ adds a coin to box $\ell$. Also $M$ does not move coin $c$ from $\ell$ because $c$ is involved in the previous move of $B$. In summary boxes $1,2, \ldots, \ell$ contain $N(\alpha)$ coins like before, so they form an arc. However there are 2 coins now in the extreme $\ell$ of the arc. Ignore $\ell$ to obtain a shorter arc $\alpha^{\prime}$ with $N\left(\alpha^{\prime}\right)<N(\alpha)$.

Consider any initial distribution without empty boxes. Since $N \leq 2 n-3$, there are at least 3 boxes in it with exactly 1 coin. It follows from $n \geq 7$ that some 2 of them are the extremes of an $\operatorname{arc} \alpha$. Hence $B$ can make the move described above, which leads to an arc $\alpha^{\prime}$ with $N\left(\alpha^{\prime}\right)<N(\alpha)$ after $A^{\prime}$ 's response. If all boxes in the new distribution are non-empty he can repeat the same, and so on. Because $N(\alpha)$ cannot decrease indefinitely, an empty box will occur after some move of $A$.

C5. The columns and the rows of a $3 n \times 3 n$ square board are numbered $1,2, \ldots, 3 n$. Every square $(x, y)$ with $1 \leq x, y \leq 3 n$ is colored asparagus, byzantium or citrine according as the modulo 3 remainder of $x+y$ is 0 , 1 or 2 respectively. One token colored asparagus, byzantium or citrine is placed on each square, so that there are $3 n^{2}$ tokens of each color.

Suppose that one can permute the tokens so that each token is moved to a distance of at most $d$ from its original position, each asparagus token replaces a byzantium token, each byzantium token replaces a citrine token, and each citrine token replaces an asparagus token. Prove that it is possible to permute the tokens so that each token is moved to a distance of at most $d+2$ from its original position, and each square contains a token with the same color as the square.

Solution. Without loss of generality it suffices to prove that the A-tokens can be moved to distinct $\mathrm{A}$-squares in such a way that each $\mathrm{A}$-token is moved to a distance at most $d+2$ from its original place. This means we need a perfect matching between the $3 n^{2} \mathrm{~A}$-squares and the $3 n^{2}$ A-tokens such that the distance in each pair of the matching is at most $d+2$.

To find the matching, we construct a bipartite graph. The A-squares will be the vertices in one class of the graph; the vertices in the other class will be the A-tokens.

Split the board into $3 \times 1$ horizontal triminos; then each trimino contains exactly one Asquare. Take a permutation $\pi$ of the tokens which moves A-tokens to B-tokens, B-tokens to C-tokens, and C-tokens to A-tokens, in each case to a distance at most $d$. For each A-square $S$, and for each A-token $T$, connect $S$ and $T$ by an edge if $T, \pi(T)$ or $\pi^{-1}(T)$ is on the trimino containing $S$. We allow multiple edges; it is even possible that the same square and the same token are connected with three edges. Obviously the lengths of the edges in the graph do not exceed $d+2$. By length of an edge we mean the distance between the A-square and the A-token it connects.

Each A-token $T$ is connected with the three A-squares whose triminos contain $T, \pi(T)$ and $\pi^{-1}(T)$. Therefore in the graph all tokens are of degree 3. We show that the same is true for the A-squares. Let $S$ be an arbitrary A-square, and let $T_{1}, T_{2}, T_{3}$ be the three tokens on the trimino containing $S$. For $i=1,2,3$, if $T_{i}$ is an A-token, then $S$ is connected with $T_{i}$; if $T_{i}$ is a B-token then $S$ is connected with $\pi^{-1}\left(T_{i}\right)$; finally, if $T_{i}$ is a C-token then $S$ is connected with $\pi\left(T_{i}\right)$. Hence in the graph the A-squares also are of degree 3.

Since the A-squares are of degree 3 , from every set $\mathcal{S}$ of A-squares exactly $3|\mathcal{S}|$ edges start. These edges end in at least $|\mathcal{S}|$ tokens because the A-tokens also are of degree 3. Hence every set $\mathcal{S}$ of A-squares has at least $|\mathcal{S}|$ neighbors among the A-tokens.

Therefore, by HALL's marriage theorem, the graph contains a perfect matching between the two vertex classes. So there is a perfect matching between the A-squares and A-tokens with edges no longer than $d+2$. It follows that the tokens can be permuted as specified in the problem statement.

Comment 1. In the original problem proposal the board was infinite and there were only two colors. Having $n$ colors for some positive integer $n$ was an option; we chose $n=3$. Moreover, we changed the board to a finite one to avoid dealing with infinite graphs (although Hall's theorem works in the infinite case as well).

With only two colors Hall's theorem is not needed. In this case we split the board into $2 \times 1$ dominos, and in the resulting graph all vertices are of degree 2. The graph consists of disjoint cycles with even length and infinite paths, so the existence of the matching is trivial.

Having more than three colors would make the problem statement more complicated, because we need a matching between every two color classes of tokens. However, this would not mean a significant increase in difficulty.

Comment 2. According to Wikipedia, the color asparagus (hexadecimal code \#87A96B) is a tone of green that is named after the vegetable. Crayola created this color in 1993 as one of the 16 to be named in the Name The Color Contest. Byzantium (\#702963) is a dark tone of purple. Its first recorded use as a color name in English was in 1926. Citrine (\#E4D00A) is variously described as yellow, greenish-yellow, brownish-yellow or orange. The first known use of citrine as a color name in English was in the 14th century.

C6. Let $k$ and $n$ be fixed positive integers. In the liar's guessing game, Amy chooses integers $x$ and $N$ with $1 \leq x \leq N$. She tells Ben what $N$ is, but not what $x$ is. Ben may then repeatedly ask Amy whether $x \in S$ for arbitrary sets $S$ of integers. Amy will always answer with yes or no, but she might lie. The only restriction is that she can lie at most $k$ times in a row. After he has asked as many questions as he wants, Ben must specify a set of at most $n$ positive integers. If $x$ is in this set he wins; otherwise, he loses. Prove that:

a) If $n \geq 2^{k}$ then Ben can always win.

b) For sufficiently large $k$ there exist $n \geq 1.99^{k}$ such that Ben cannot guarantee a win.

Solution. Consider an answer $A \in\{y e s, n o\}$ to a question of the kind "Is $x$ in the set $S$ ?" We say that $A$ is inconsistent with a number $i$ if $A=y e s$ and $i \notin S$, or if $A=n o$ and $i \in S$. Observe that an answer inconsistent with the target number $x$ is a lie.

a) Suppose that Ben has determined a set $T$ of size $m$ that contains $x$. This is true initially with $m=N$ and $T=\{1,2, \ldots, N\}$. For $m>2^{k}$ we show how Ben can find a number $y \in T$ that is different from $x$. By performing this step repeatedly he can reduce $T$ to be of size $2^{k} \leq n$ and thus win.

Since only the size $m>2^{k}$ of $T$ is relevant, assume that $T=\left\{0,1, \ldots, 2^{k}, \ldots, m-1\right\}$. Ben begins by asking repeatedly whether $x$ is $2^{k}$. If Amy answers no $k+1$ times in a row, one of these answers is truthful, and so $x \neq 2^{k}$. Otherwise Ben stops asking about $2^{k}$ at the first answer yes. He then asks, for each $i=1, \ldots, k$, if the binary representation of $x$ has a 0 in the $i$ th digit. Regardless of what the $k$ answers are, they are all inconsistent with a certain number $y \in\left\{0,1, \ldots, 2^{k}-1\right\}$. The preceding answer yes about $2^{k}$ is also inconsistent with $y$. Hence $y \neq x$. Otherwise the last $k+1$ answers are not truthful, which is impossible.

Either way, Ben finds a number in $T$ that is different from $x$, and the claim is proven.

b) We prove that if $1<\lambda<2$ and $n=\left\lfloor(2-\lambda) \lambda^{k+1}\right\rfloor-1$ then Ben cannot guarantee a win. To complete the proof, then it suffices to take $\lambda$ such that $1.99<\lambda<2$ and $k$ large enough so that

$$
n=\left\lfloor(2-\lambda) \lambda^{k+1}\right\rfloor-1 \geq 1.99^{k}
$$

Consider the following strategy for Amy. First she chooses $N=n+1$ and $x \in\{1,2, \ldots, n+1\}$ arbitrarily. After every answer of hers Amy determines, for each $i=1,2, \ldots, n+1$, the number $m_{i}$ of consecutive answers she has given by that point that are inconsistent with $i$. To decide on her next answer, she then uses the quantity

$$
\phi=\sum_{i=1}^{n+1} \lambda^{m_{i}}
$$

No matter what Ben's next question is, Amy chooses the answer which minimizes $\phi$.

We claim that with this strategy $\phi$ will always stay less than $\lambda^{k+1}$. Consequently no exponent $m_{i}$ in $\phi$ will ever exceed $k$, hence Amy will never give more than $k$ consecutive answers inconsistent with some $i$. In particular this applies to the target number $x$, so she will never lie more than $k$ times in a row. Thus, given the claim, Amy's strategy is legal. Since the strategy does not depend on $x$ in any way, Ben can make no deductions about $x$, and therefore he cannot guarantee a win.

It remains to show that $\phi<\lambda^{k+1}$ at all times. Initially each $m_{i}$ is 0 , so this condition holds in the beginning due to $1<\lambda<2$ and $n=\left\lfloor(2-\lambda) \lambda^{k+1}\right\rfloor-1$. Suppose that $\phi<\lambda^{k+1}$ at some point, and Ben has just asked if $x \in S$ for some set $S$. According as Amy answers yes or no, the new value of $\phi$ becomes

$$
\phi_{1}=\sum_{i \in S} 1+\sum_{i \notin S} \lambda^{m_{i}+1} \quad \text { or } \quad \phi_{2}=\sum_{i \in S} \lambda^{m_{i}+1}+\sum_{i \notin S} 1
$$

Since Amy chooses the option minimizing $\phi$, the new $\phi$ will equal $\min \left(\phi_{1}, \phi_{2}\right)$. Now we have

$$
\min \left(\phi_{1}, \phi_{2}\right) \leq \frac{1}{2}\left(\phi_{1}+\phi_{2}\right)=\frac{1}{2}\left(\sum_{i \in S}\left(1+\lambda^{m_{i}+1}\right)+\sum_{i \notin S}\left(\lambda^{m_{i}+1}+1\right)\right)=\frac{1}{2}(\lambda \phi+n+1)
$$

Because $\phi<\lambda^{k+1}$, the assumptions $\lambda<2$ and $n=\left\lfloor(2-\lambda) \lambda^{k+1}\right\rfloor-1$ lead to

$$
\min \left(\phi_{1}, \phi_{2}\right)<\frac{1}{2}\left(\lambda^{k+2}+(2-\lambda) \lambda^{k+1}\right)=\lambda^{k+1}
$$

The claim follows, which completes the solution.

Comment. Given a fixed $k$, let $f(k)$ denote the minimum value of $n$ for which Ben can guarantee a victory. The problem asks for a proof that for large $k$

$$
1.99^{k} \leq f(k) \leq 2^{k}
$$

A computer search shows that $f(k)=2,3,4,7,11,17$ for $k=1,2,3,4,5,6$.

C7. There are given $2^{500}$ points on a circle labeled $1,2, \ldots, 2^{500}$ in some order. Prove that one can choose 100 pairwise disjoint chords joining some of these points so that the 100 sums of the pairs of numbers at the endpoints of the chosen chords are equal.

Solution. The proof is based on the following general fact.

Lemma. In a graph $G$ each vertex $v$ has degree $d_{v}$. Then $G$ contains an independent set $S$ of vertices such that $|S| \geq f(G)$ where

$$
f(G)=\sum_{v \in G} \frac{1}{d_{v}+1}
$$

Proof. Induction on $n=|G|$. The base $n=1$ is clear. For the inductive step choose a vertex $v_{0}$ in $G$ of minimum degree $d$. Delete $v_{0}$ and all of its neighbors $v_{1}, \ldots, v_{d}$ and also all edges with endpoints $v_{0}, v_{1}, \ldots, v_{d}$. This gives a new graph $G^{\prime}$. By the inductive assumption $G^{\prime}$ contains an independent set $S^{\prime}$ of vertices such that $\left|S^{\prime}\right| \geq f\left(G^{\prime}\right)$. Since no vertex in $S^{\prime}$ is a neighbor of $v_{0}$ in $G$, the set $S=S^{\prime} \cup\left\{v_{0}\right\}$ is independent in $G$.

Let $d_{v}^{\prime}$ be the degree of a vertex $v$ in $G^{\prime}$. Clearly $d_{v}^{\prime} \leq d_{v}$ for every such vertex $v$, and also $d_{v_{i}} \geq d$ for all $i=0,1, \ldots, d$ by the minimal choice of $v_{0}$. Therefore

$$
f\left(G^{\prime}\right)=\sum_{v \in G^{\prime}} \frac{1}{d_{v}^{\prime}+1} \geq \sum_{v \in G^{\prime}} \frac{1}{d_{v}+1}=f(G)-\sum_{i=0}^{d} \frac{1}{d_{v_{i}}+1} \geq f(G)-\frac{d+1}{d+1}=f(G)-1 .
$$

Hence $|S|=\left|S^{\prime}\right|+1 \geq f\left(G^{\prime}\right)+1 \geq f(G)$, and the induction is complete.

We pass on to our problem. For clarity denote $n=2^{499}$ and draw all chords determined by the given $2 n$ points. Color each chord with one of the colors $3,4, \ldots, 4 n-1$ according to the sum of the numbers at its endpoints. Chords with a common endpoint have different colors. For each color $c$ consider the following graph $G_{c}$. Its vertices are the chords of color $c$, and two chords are neighbors in $G_{c}$ if they intersect. Let $f\left(G_{c}\right)$ have the same meaning as in the lemma for all graphs $G_{c}$.

Every chord $\ell$ divides the circle into two arcs, and one of them contains $m(\ell) \leq n-1$ given points. (In particular $m(\ell)=0$ if $\ell$ joins two consecutive points.) For each $i=0,1, \ldots, n-2$ there are $2 n$ chords $\ell$ with $m(\ell)=i$. Such a chord has degree at most $i$ in the respective graph. Indeed let $A_{1}, \ldots, A_{i}$ be all points on either arc determined by a chord $\ell$ with $m(\ell)=i$ and color $c$. Every $A_{j}$ is an endpoint of at most 1 chord colored $c, j=1, \ldots, i$. Hence at most $i$ chords of color $c$ intersect $\ell$.

It follows that for each $i=0,1, \ldots, n-2$ the $2 n$ chords $\ell$ with $m(\ell)=i$ contribute at least $\frac{2 n}{i+1}$ to the sum $\sum_{c} f\left(G_{c}\right)$. Summation over $i=0,1, \ldots, n-2$ gives

$$
\sum_{c} f\left(G_{c}\right) \geq 2 n \sum_{i=1}^{n-1} \frac{1}{i}
$$

Because there are $4 n-3$ colors in all, averaging yields a color $c$ such that

$$
f\left(G_{c}\right) \geq \frac{2 n}{4 n-3} \sum_{i=1}^{n-1} \frac{1}{i}>\frac{1}{2} \sum_{i=1}^{n-1} \frac{1}{i}
$$

By the lemma there are at least $\frac{1}{2} \sum_{i=1}^{n-1} \frac{1}{i}$ pairwise disjoint chords of color $c$, i. e. with the same sum $c$ of the pairs of numbers at their endpoints. It remains to show that $\frac{1}{2} \sum_{i=1}^{n-1} \frac{1}{i} \geq 100$ for $n=2^{499}$. Indeed we have

$$
\sum_{i=1}^{n-1} \frac{1}{i}>\sum_{i=1}^{2^{400}} \frac{1}{i}=1+\sum_{k=1}^{400} \sum_{i=2^{k-1+1}}^{2^{k}} \frac{1}{i}>1+\sum_{k=1}^{400} \frac{2^{k-1}}{2^{k}}=201>200
$$

This completes the solution.

## Geometry

G1. In the triangle $A B C$ the point $J$ is the center of the excircle opposite to $A$. This excircle is tangent to the side $B C$ at $M$, and to the lines $A B$ and $A C$ at $K$ and $L$ respectively. The lines $L M$ and $B J$ meet at $F$, and the lines $K M$ and $C J$ meet at $G$. Let $S$ be the point of intersection of the lines $A F$ and $B C$, and let $T$ be the point of intersection of the lines $A G$ and $B C$. Prove that $M$ is the midpoint of $S T$.

Solution. Let $\alpha=\angle C A B, \beta=\angle A B C$ and $\gamma=\angle B C A$. The line $A J$ is the bisector of $\angle C A B$, so $\angle J A K=\angle J A L=\frac{\alpha}{2}$. By $\angle A K J=\angle A L J=90^{\circ}$ the points $K$ and $L$ lie on the circle $\omega$ with diameter $A J$.

The triangle $K B M$ is isosceles as $B K$ and $B M$ are tangents to the excircle. Since $B J$ is the bisector of $\angle K B M$, we have $\angle M B J=90^{\circ}-\frac{\beta}{2}$ and $\angle B M K=\frac{\beta}{2}$. Likewise $\angle M C J=90^{\circ}-\frac{\gamma}{2}$ and $\angle C M L=\frac{\gamma}{2}$. Also $\angle B M F=\angle C M L$, therefore

$$
\angle L F J=\angle M B J-\angle B M F=\left(90^{\circ}-\frac{\beta}{2}\right)-\frac{\gamma}{2}=\frac{\alpha}{2}=\angle L A J .
$$

Hence $F$ lies on the circle $\omega$. (By the angle computation, $F$ and $A$ are on the same side of $B C$.) Analogously, $G$ also lies on $\omega$. Since $A J$ is a diameter of $\omega$, we obtain $\angle A F J=\angle A G J=90^{\circ}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-29.jpg?height=703&width=1242&top_left_y=1276&top_left_x=407)

The lines $A B$ and $B C$ are symmetric with respect to the external bisector $B F$. Because $A F \perp B F$ and $K M \perp B F$, the segments $S M$ and $A K$ are symmetric with respect to $B F$, hence $S M=A K$. By symmetry $T M=A L$. Since $A K$ and $A L$ are equal as tangents to the excircle, it follows that $S M=T M$, and the proof is complete.

Comment. After discovering the circle $A F K J L G$, there are many other ways to complete the solution. For instance, from the cyclic quadrilaterals $J M F S$ and $J M G T$ one can find $\angle T S J=\angle S T J=\frac{\alpha}{2}$. Another possibility is to use the fact that the lines $A S$ and $G M$ are parallel (both are perpendicular to the external angle bisector $B J$ ), so $\frac{M S}{M T}=\frac{A G}{G T}=1$.

G2. Let $A B C D$ be a cyclic quadrilateral whose diagonals $A C$ and $B D$ meet at $E$. The extensions of the sides $A D$ and $B C$ beyond $A$ and $B$ meet at $F$. Let $G$ be the point such that $E C G D$ is a parallelogram, and let $H$ be the image of $E$ under reflection in $A D$. Prove that $D, H, F, G$ are concyclic.

Solution. We show first that the triangles $F D G$ and $F B E$ are similar. Since $A B C D$ is cyclic, the triangles $E A B$ and $E D C$ are similar, as well as $F A B$ and $F C D$. The parallelogram $E C G D$ yields $G D=E C$ and $\angle C D G=\angle D C E$; also $\angle D C E=\angle D C A=\angle D B A$ by inscribed angles. Therefore

$$
\begin{gathered}
\angle F D G=\angle F D C+\angle C D G=\angle F B A+\angle A B D=\angle F B E, \\
\frac{G D}{E B}=\frac{C E}{E B}=\frac{C D}{A B}=\frac{F D}{F B} .
\end{gathered}
$$

It follows that $F D G$ and $F B E$ are similar, and so $\angle F G D=\angle F E B$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-30.jpg?height=954&width=974&top_left_y=948&top_left_x=538)

Since $H$ is the reflection of $E$ with respect to $F D$, we conclude that

$$
\angle F H D=\angle F E D=180^{\circ}-\angle F E B=180^{\circ}-\angle F G D .
$$

This proves that $D, H, F, G$ are concyclic.

Comment. Points $E$ and $G$ are always in the half-plane determined by the line $F D$ that contains $B$ and $C$, but $H$ is always in the other half-plane. In particular, $D H F G$ is cyclic if and only if $\angle F H D+\angle F G D=180^{\circ}$.

G3. In an acute triangle $A B C$ the points $D, E$ and $F$ are the feet of the altitudes through $A$, $B$ and $C$ respectively. The incenters of the triangles $A E F$ and $B D F$ are $I_{1}$ and $I_{2}$ respectively; the circumcenters of the triangles $A C I_{1}$ and $B C I_{2}$ are $O_{1}$ and $O_{2}$ respectively. Prove that $I_{1} I_{2}$ and $O_{1} O_{2}$ are parallel.

Solution. Let $\angle C A B=\alpha, \angle A B C=\beta, \angle B C A=\gamma$. We start by showing that $A, B, I_{1}$ and $I_{2}$ are concyclic. Since $A I_{1}$ and $B I_{2}$ bisect $\angle C A B$ and $\angle A B C$, their extensions beyond $I_{1}$ and $I_{2}$ meet at the incenter $I$ of the triangle. The points $E$ and $F$ are on the circle with diameter $B C$, so $\angle A E F=\angle A B C$ and $\angle A F E=\angle A C B$. Hence the triangles $A E F$ and $A B C$ are similar with ratio of similitude $\frac{A E}{A B}=\cos \alpha$. Because $I_{1}$ and $I$ are their incenters, we obtain $I_{1} A=I A \cos \alpha$ and $I I_{1}=I A-I_{1} A=2 I A \sin ^{2} \frac{\alpha}{2}$. By symmetry $I I_{2}=2 I B \sin ^{2} \frac{\beta}{2}$. The law of sines in the triangle $A B I$ gives $I A \sin \frac{\alpha}{2}=I B \sin \frac{\beta}{2}$. Hence

$$
I I_{1} \cdot I A=2\left(I A \sin \frac{\alpha}{2}\right)^{2}=2\left(I B \sin \frac{\beta}{2}\right)^{2}=I I_{2} \cdot I B
$$

Therefore $A, B, I_{1}$ and $I_{2}$ are concyclic, as claimed.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-31.jpg?height=848&width=1466&top_left_y=998&top_left_x=295)

In addition $I I_{1} \cdot I A=I I_{2} \cdot I B$ implies that $I$ has the same power with respect to the circles $\left(A C I_{1}\right),\left(B C I_{2}\right)$ and $\left(A B I_{1} I_{2}\right)$. Then $C I$ is the radical axis of $\left(A C I_{1}\right)$ and $\left(B C I_{2}\right)$; in particular $C I$ is perpendicular to the line of centers $O_{1} O_{2}$.

Now it suffices to prove that $C I \perp I_{1} I_{2}$. Let $C I$ meet $I_{1} I_{2}$ at $Q$, then it is enough to check that $\angle I I_{1} Q+\angle I_{1} I Q=90^{\circ}$. Since $\angle I_{1} I Q$ is external for the triangle $A C I$, we have

$$
\angle I I_{1} Q+\angle I_{1} I Q=\angle I I_{1} Q+(\angle A C I+\angle C A I)=\angle I I_{1} I_{2}+\angle A C I+\angle C A I .
$$

It remains to note that $\angle I I_{1} I_{2}=\frac{\beta}{2}$ from the cyclic quadrilateral $A B I_{1} I_{2}$, and $\angle A C I=\frac{\gamma}{2}$, $\angle C A I=\frac{\alpha}{2}$. Therefore $\angle I I_{1} Q+\angle I_{1} I Q=\frac{\alpha}{2}+\frac{\beta}{2}+\frac{\gamma}{2}=90^{\circ}$, completing the proof.

Comment. It follows from the first part of the solution that the common point $I_{3} \neq C$ of the circles $\left(A C I_{1}\right)$ and $\left(B C I_{2}\right)$ is the incenter of the triangle $C D E$.

G4. Let $A B C$ be a triangle with $A B \neq A C$ and circumcenter $O$. The bisector of $\angle B A C$ intersects $B C$ at $D$. Let $E$ be the reflection of $D$ with respect to the midpoint of $B C$. The lines through $D$ and $E$ perpendicular to $B C$ intersect the lines $A O$ and $A D$ at $X$ and $Y$ respectively. Prove that the quadrilateral $B X C Y$ is cyclic.

Solution. The bisector of $\angle B A C$ and the perpendicular bisector of $B C$ meet at $P$, the midpoint of the minor arc $\widehat{B C}$ (they are different lines as $A B \neq A C$ ). In particular $O P$ is perpendicular to $B C$ and intersects it at $M$, the midpoint of $B C$.

Denote by $Y^{\prime}$ the reflexion of $Y$ with respect to $O P$. Since $\angle B Y C=\angle B Y^{\prime} C$, it suffices to prove that $B X C Y^{\prime}$ is cyclic.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-32.jpg?height=1039&width=826&top_left_y=720&top_left_x=615)

We have

$$
\angle X A P=\angle O P A=\angle E Y P \text {. }
$$

The first equality holds because $O A=O P$, and the second one because $E Y$ and $O P$ are both perpendicular to $B C$ and hence parallel. But $\left\{Y, Y^{\prime}\right\}$ and $\{E, D\}$ are pairs of symmetric points with respect to $O P$, it follows that $\angle E Y P=\angle D Y^{\prime} P$ and hence

$$
\angle X A P=\angle D Y^{\prime} P=\angle X Y^{\prime} P .
$$

The last equation implies that $X A Y^{\prime} P$ is cyclic. By the powers of $D$ with respect to the circles $\left(X A Y^{\prime} P\right)$ and $(A B P C)$ we obtain

$$
X D \cdot D Y^{\prime}=A D \cdot D P=B D \cdot D C
$$

It follows that $B X C Y^{\prime}$ is cyclic, as desired.

G5. Let $A B C$ be a triangle with $\angle B C A=90^{\circ}$, and let $C_{0}$ be the foot of the altitude from $C$. Choose a point $X$ in the interior of the segment $C C_{0}$, and let $K, L$ be the points on the segments $A X, B X$ for which $B K=B C$ and $A L=A C$ respectively. Denote by $M$ the intersection of $A L$ and $B K$. Show that $M K=M L$.

Solution. Let $C^{\prime}$ be the reflection of $C$ in the line $A B$, and let $\omega_{1}$ and $\omega_{2}$ be the circles with centers $A$ and $B$, passing through $L$ and $K$ respectively. Since $A C^{\prime}=A C=A L$ and $B C^{\prime}=B C=B K$, both $\omega_{1}$ and $\omega_{2}$ pass through $C$ and $C^{\prime}$. By $\angle B C A=90^{\circ}, A C$ is tangent to $\omega_{2}$ at $C$, and $B C$ is tangent to $\omega_{1}$ at $C$. Let $K_{1} \neq K$ be the second intersection of $A X$ and $\omega_{2}$, and let $L_{1} \neq L$ be the second intersection of $B X$ and $\omega_{1}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-33.jpg?height=1051&width=1016&top_left_y=688&top_left_x=520)

By the powers of $X$ with respect to $\omega_{2}$ and $\omega_{1}$,

$$
X K \cdot X K_{1}=X C \cdot X C^{\prime}=X L \cdot X L_{1},
$$

so the points $K_{1}, L, K, L_{1}$ lie on a circle $\omega_{3}$.

The power of $A$ with respect to $\omega_{2}$ gives

$$
A L^{2}=A C^{2}=A K \cdot A K_{1},
$$

indicating that $A L$ is tangent to $\omega_{3}$ at $L$. Analogously, $B K$ is tangent to $\omega_{3}$ at $K$. Hence $M K$ and $M L$ are the two tangents from $M$ to $\omega_{3}$ and therefore $M K=M L$.

G6. Let $A B C$ be a triangle with circumcenter $O$ and incenter $I$. The points $D, E$ and $F$ on the sides $B C, C A$ and $A B$ respectively are such that $B D+B F=C A$ and $C D+C E=A B$. The circumcircles of the triangles $B F D$ and $C D E$ intersect at $P \neq D$. Prove that $O P=O I$.

Solution. By Miquel's theorem the circles $(A E F)=\omega_{A},(B F D)=\omega_{B}$ and $(C D E)=\omega_{C}$ have a common point, for arbitrary points $D, E$ and $F$ on $B C, C A$ and $A B$. So $\omega_{A}$ passes through the common point $P \neq D$ of $\omega_{B}$ and $\omega_{C}$.

Let $\omega_{A}, \omega_{B}$ and $\omega_{C}$ meet the bisectors $A I, B I$ and $C I$ at $A \neq A^{\prime}, B \neq B^{\prime}$ and $C \neq C^{\prime}$ respectively. The key observation is that $A^{\prime}, B^{\prime}$ and $C^{\prime}$ do not depend on the particular choice of $D, E$ and $F$, provided that $B D+B F=C A, C D+C E=A B$ and $A E+A F=B C$ hold true (the last equality follows from the other two). For a proof we need the following fact.

Lemma. Given is an angle with vertex $A$ and measure $\alpha$. A circle $\omega$ through $A$ intersects the angle bisector at $L$ and sides of the angle at $X$ and $Y$. Then $A X+A Y=2 A L \cos \frac{\alpha}{2}$.

Proof. Note that $L$ is the midpoint of $\operatorname{arc} \widehat{X L Y}$ in $\omega$ and set $X L=Y L=u, X Y=v$. By PtOLEMY's theorem $A X \cdot Y L+A Y \cdot X L=A L \cdot X Y$, which rewrites as $(A X+A Y) u=A L \cdot v$. Since $\angle L X Y=\frac{\alpha}{2}$ and $\angle X L Y=180^{\circ}-\alpha$, we have $v=2 \cos \frac{\alpha}{2} u$ by the law of sines, and the claim follows.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-34.jpg?height=551&width=671&top_left_y=1118&top_left_x=698)

Apply the lemma to $\angle B A C=\alpha$ and the circle $\omega=\omega_{A}$, which intersects $A I$ at $A^{\prime}$. This gives $2 A A^{\prime} \cos \frac{\alpha}{2}=A E+A F=B C$; by symmetry analogous relations hold for $B B^{\prime}$ and $C C^{\prime}$. It follows that $A^{\prime}, B^{\prime}$ and $C^{\prime}$ are independent of the choice of $D, E$ and $F$, as stated.

We use the lemma two more times with $\angle B A C=\alpha$. Let $\omega$ be the circle with diameter $A I$. Then $X$ and $Y$ are the tangency points of the incircle of $A B C$ with $A B$ and $A C$, and hence $A X=A Y=\frac{1}{2}(A B+A C-B C)$. So the lemma yields $2 A I \cos \frac{\alpha}{2}=A B+A C-B C$. Next, if $\omega$ is the circumcircle of $A B C$ and $A I$ intersects $\omega$ at $M \neq A$ then $\{X, Y\}=\{B, C\}$, and so $2 A M \cos \frac{\alpha}{2}=A B+A C$ by the lemma. To summarize,

$$
2 A A^{\prime} \cos \frac{\alpha}{2}=B C, \quad 2 A I \cos \frac{\alpha}{2}=A B+A C-B C, \quad 2 A M \cos \frac{\alpha}{2}=A B+A C
$$

These equalities imply $A A^{\prime}+A I=A M$, hence the segments $A M$ and $I A^{\prime}$ have a common midpoint. It follows that $I$ and $A^{\prime}$ are equidistant from the circumcenter $O$. By symmetry $O I=O A^{\prime}=O B^{\prime}=O C^{\prime}$, so $I, A^{\prime}, B^{\prime}, C^{\prime}$ are on a circle centered at $O$.

To prove $O P=O I$, now it suffices to show that $I, A^{\prime}, B^{\prime}, C^{\prime}$ and $P$ are concyclic. Clearly one can assume $P \neq I, A^{\prime}, B^{\prime}, C^{\prime}$.

We use oriented angles to avoid heavy case distinction. The oriented angle between the lines $l$ and $m$ is denoted by $\angle(l, m)$. We have $\angle(l, m)=-\angle(m, l)$ and $\angle(l, m)+\angle(m, n)=\angle(l, n)$ for arbitrary lines $l, m$ and $n$. Four distinct non-collinear points $U, V, X, Y$ are concyclic if and only if $\angle(U X, V X)=\angle(U Y, V Y)$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-35.jpg?height=1048&width=1059&top_left_y=184&top_left_x=493)

Suppose for the moment that $A^{\prime}, B^{\prime}, P, I$ are distinct and noncollinear; then it is enough to check the equality $\angle\left(A^{\prime} P, B^{\prime} P\right)=\angle\left(A^{\prime} I, B^{\prime} I\right)$. Because $A, F, P, A^{\prime}$ are on the circle $\omega_{A}$, we have $\angle\left(A^{\prime} P, F P\right)=\angle\left(A^{\prime} A, F A\right)=\angle\left(A^{\prime} I, A B\right)$. Likewise $\angle\left(B^{\prime} P, F P\right)=\angle\left(B^{\prime} I, A B\right)$. Therefore

$$
\angle\left(A^{\prime} P, B^{\prime} P\right)=\angle\left(A^{\prime} P, F P\right)+\angle\left(F P, B^{\prime} P\right)=\angle\left(A^{\prime} I, A B\right)-\angle\left(B^{\prime} I, A B\right)=\angle\left(A^{\prime} I, B^{\prime} I\right) \text {. }
$$

Here we assumed that $P \neq F$. If $P=F$ then $P \neq D, E$ and the conclusion follows similarly (use $\angle\left(A^{\prime} F, B^{\prime} F\right)=\angle\left(A^{\prime} F, E F\right)+\angle(E F, D F)+\angle\left(D F, B^{\prime} F\right)$ and inscribed angles in $\left.\omega_{A}, \omega_{B}, \omega_{C}\right)$.

There is no loss of generality in assuming $A^{\prime}, B^{\prime}, P, I$ distinct and noncollinear. If $A B C$ is an equilateral triangle then the equalities $\left(^{*}\right)$ imply that $A^{\prime}, B^{\prime}, C^{\prime}, I, O$ and $P$ coincide, so $O P=O I$. Otherwise at most one of $A^{\prime}, B^{\prime}, C^{\prime}$ coincides with $I$. If say $C^{\prime}=I$ then $O I \perp C I$ by the previous reasoning. It follows that $A^{\prime}, B^{\prime} \neq I$ and hence $A^{\prime} \neq B^{\prime}$. Finally $A^{\prime}, B^{\prime}$ and $I$ are noncollinear because $I, A^{\prime}, B^{\prime}, C^{\prime}$ are concyclic.

Comment. The proposer remarks that the locus $\gamma$ of the points $P$ is an arc of the circle $\left(A^{\prime} B^{\prime} C^{\prime} I\right)$. The reflection $I^{\prime}$ of $I$ in $O$ belongs to $\gamma$; it is obtained by choosing $D, E$ and $F$ to be the tangency points of the three excircles with their respective sides. The rest of the circle $\left(A^{\prime} B^{\prime} C^{\prime} I\right)$, except $I$, can be included in $\gamma$ by letting $D, E$ and $F$ vary on the extensions of the sides and assuming signed lengths. For instance if $B$ is between $C$ and $D$ then the length $B D$ must be taken with a negative sign. The incenter $I$ corresponds to the limit case where $D$ tends to infinity.

G7. Let $A B C D$ be a convex quadrilateral with non-parallel sides $B C$ and $A D$. Assume that there is a point $E$ on the side $B C$ such that the quadrilaterals $A B E D$ and $A E C D$ are circumscribed. Prove that there is a point $F$ on the side $A D$ such that the quadrilaterals $A B C F$ and $B C D F$ are circumscribed if and only if $A B$ is parallel to $C D$.

Solution. Let $\omega_{1}$ and $\omega_{2}$ be the incircles and $O_{1}$ and $O_{2}$ the incenters of the quadrilaterals $A B E D$ and $A E C D$ respectively. A point $F$ with the stated property exists only if $\omega_{1}$ and $\omega_{2}$ are also the incircles of the quadrilaterals $A B C F$ and $B C D F$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-36.jpg?height=494&width=868&top_left_y=593&top_left_x=591)

Let the tangents from $B$ to $\omega_{2}$ and from $C$ to $\omega_{1}$ (other than $B C$ ) meet $A D$ at $F_{1}$ and $F_{2}$ respectively. We need to prove that $F_{1}=F_{2}$ if and only if $A B \| C D$.

Lemma. The circles $\omega_{1}$ and $\omega_{2}$ with centers $O_{1}$ and $O_{2}$ are inscribed in an angle with vertex $O$. The points $P, S$ on one side of the angle and $Q, R$ on the other side are such that $\omega_{1}$ is the incircle of the triangle $P Q O$, and $\omega_{2}$ is the excircle of the triangle $R S O$ opposite to $O$. Denote $p=O O_{1} \cdot O O_{2}$. Then exactly one of the following relations holds:

$$
O P \cdot O R<p<O Q \cdot O S, \quad O P \cdot O R>p>O Q \cdot O S, \quad O P \cdot O R=p=O Q \cdot O S
$$

Proof. Denote $\angle O P O_{1}=u, \angle O Q O_{1}=v, \angle O O_{2} R=x, \angle O O_{2} S=y, \angle P O Q=2 \varphi$. Because $P O_{1}, Q O_{1}, R O_{2}, S O_{2}$ are internal or external bisectors in the triangles $P Q O$ and $R S O$, we have

$$
u+v=x+y\left(=90^{\circ}-\varphi\right) .
$$

By the law of sines

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-36.jpg?height=417&width=880&top_left_y=1756&top_left_x=588)

$$
\frac{O P}{O O_{1}}=\frac{\sin (u+\varphi)}{\sin u} \quad \text { and } \quad \frac{O O_{2}}{O R}=\frac{\sin (x+\varphi)}{\sin x}
$$

Therefore, since $x, u$ and $\varphi$ are acute,

$O P \cdot O R \geq p \Leftrightarrow \frac{O P}{O O_{1}} \geq \frac{O O_{2}}{O R} \Leftrightarrow \sin x \sin (u+\varphi) \geq \sin u \sin (x+\varphi) \Leftrightarrow \sin (x-u) \geq 0 \Leftrightarrow x \geq u$.

Thus $O P \cdot O R \geq p$ is equivalent to $x \geq u$, with $O P \cdot O R=p$ if and only if $x=u$.

Analogously, $p \geq O Q \cdot O S$ is equivalent to $v \geq y$, with $p=O Q \cdot O S$ if and only if $v=y$. On the other hand $x \geq u$ and $v \geq y$ are equivalent by (1), with $x=u$ if and only if $v=y$. The conclusion of the lemma follows from here.

Going back to the problem, apply the lemma to the quadruples $\left\{B, E, D, F_{1}\right\},\{A, B, C, D\}$ and $\left\{A, E, C, F_{2}\right\}$. Assuming $O E \cdot O F_{1}>p$, we obtain

$$
O E \cdot O F_{1}>p \Rightarrow O B \cdot O D<p \Rightarrow O A \cdot O C>p \Rightarrow O E \cdot O F_{2}<p .
$$

In other words, $O E \cdot O F_{1}>p$ implies

$$
O B \cdot O D<p<O A \cdot O C \text { and } O E \cdot O F_{1}>p>O E \cdot O F_{2} \text {. }
$$

Similarly, $O E \cdot O F_{1}<p$ implies

$$
O B \cdot O D>p>O A \cdot O C \text { and } O E \cdot O F_{1}<p<O E \cdot O F_{2} \text {. }
$$

In these cases $F_{1} \neq F_{2}$ and $O B \cdot O D \neq O A \cdot O C$, so the lines $A B$ and $C D$ are not parallel.

There remains the case $O E \cdot O F_{1}=p$. Here the lemma leads to $O B \cdot O D=p=O A \cdot O C$ and $O E \cdot O F_{1}=p=O E \cdot O F_{2}$. Therefore $F_{1}=F_{2}$ and $A B \| C D$.

Comment. The conclusion is also true if $B C$ and $A D$ are parallel. One can prove a limit case of the lemma for the configuration shown in the figure below, where $r_{1}$ and $r_{2}$ are parallel rays starting at $O^{\prime}$ and $O^{\prime \prime}$, with $O^{\prime} O^{\prime \prime} \perp r_{1}, r_{2}$ and $O$ the midpoint of $O^{\prime} O^{\prime \prime}$. Two circles with centers $O_{1}$ and $O_{2}$ are inscribed in the strip between $r_{1}$ and $r_{2}$. The lines $P Q$ and $R S$ are tangent to the circles, with $P, S$ on $r_{1}$, and $Q, R$ on $r_{2}$, so that $O, O_{1}$ are on the same side of $P Q$ and $O, O_{2}$ are on different sides of $R S$. Denote $s=O O_{1}+O O_{2}$. Then exactly one of the following relations holds:

$$
O^{\prime} P+O^{\prime \prime} R<s<O^{\prime \prime} Q+O^{\prime} S, \quad O^{\prime} P+O^{\prime \prime} R>s>O^{\prime \prime} Q+O^{\prime} S, \quad O^{\prime} P+O^{\prime \prime} R=s=O^{\prime \prime} Q+O^{\prime} S .
$$

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-37.jpg?height=300&width=780&top_left_y=1403&top_left_x=638)

Once this is established, the proof of the original statement for $B C \| A D$ is analogous to the one in the intersecting case. One replaces products by sums of relevant segments.

G8. Let $A B C$ be a triangle with circumcircle $\omega$ and $\ell$ a line without common points with $\omega$. Denote by $P$ the foot of the perpendicular from the center of $\omega$ to $\ell$. The side-lines $B C, C A, A B$ intersect $\ell$ at the points $X, Y, Z$ different from $P$. Prove that the circumcircles of the triangles $A X P, B Y P$ and $C Z P$ have a common point different from $P$ or are mutually tangent at $P$.

Solution 1. Let $\omega_{A}, \omega_{B}, \omega_{C}$ and $\omega$ be the circumcircles of triangles $A X P, B Y P, C Z P$ and $A B C$ respectively. The strategy of the proof is to construct a point $Q$ with the same power with respect to the four circles. Then each of $P$ and $Q$ has the same power with respect to $\omega_{A}, \omega_{B}, \omega_{C}$ and hence the three circles are coaxial. In other words they have another common point $P^{\prime}$ or the three of them are tangent at $P$.

We first give a description of the point $Q$. Let $A^{\prime} \neq A$ be the second intersection of $\omega$ and $\omega_{A}$; define $B^{\prime}$ and $C^{\prime}$ analogously. We claim that $A A^{\prime}, B B^{\prime}$ and $C C^{\prime}$ have a common point. Once this claim is established, the point just constructed will be on the radical axes of the three pairs of circles $\left\{\omega, \omega_{A}\right\},\left\{\omega, \omega_{B}\right\},\left\{\omega, \omega_{C}\right\}$. Hence it will have the same power with respect to $\omega, \omega_{A}, \omega_{B}, \omega_{C}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-38.jpg?height=783&width=1242&top_left_y=965&top_left_x=407)

We proceed to prove that $A A^{\prime}, B B^{\prime}$ and $C C^{\prime}$ intersect at one point. Let $r$ be the circumradius of triangle $A B C$. Define the points $X^{\prime}, Y^{\prime}, Z^{\prime}$ as the intersections of $A A^{\prime}, B B^{\prime}, C C^{\prime}$ with $\ell$. Observe that $X^{\prime}, Y^{\prime}, Z^{\prime}$ do exist. If $A A^{\prime}$ is parallel to $\ell$ then $\omega_{A}$ is tangent to $\ell$; hence $X=P$ which is a contradiction. Similarly, $B B^{\prime}$ and $C C^{\prime}$ are not parallel to $\ell$.

From the powers of the point $X^{\prime}$ with respect to the circles $\omega_{A}$ and $\omega$ we get

$$
X^{\prime} P \cdot\left(X^{\prime} P+P X\right)=X^{\prime} P \cdot X^{\prime} X=X^{\prime} A^{\prime} \cdot X^{\prime} A=X^{\prime} O^{2}-r^{2}
$$

hence

$$
X^{\prime} P \cdot P X=X^{\prime} O^{2}-r^{2}-X^{\prime} P^{2}=O P^{2}-r^{2} .
$$

We argue analogously for the points $Y^{\prime}$ and $Z^{\prime}$, obtaining

$$
X^{\prime} P \cdot P X=Y^{\prime} P \cdot P Y=Z^{\prime} P \cdot P Z=O P^{2}-r^{2}=k^{2}
$$

In these computations all segments are regarded as directed segments. We keep the same convention for the sequel.

We prove that the lines $A A^{\prime}, B B^{\prime}, C C^{\prime}$ intersect at one point by CEVA's theorem. To avoid distracting remarks we interpret everything projectively, i. e. whenever two lines are parallel they meet at a point on the line at infinity.

Let $U, V, W$ be the intersections of $A A^{\prime}, B B^{\prime}, C C^{\prime}$ with $B C, C A, A B$ respectively. The idea is that although it is difficult to calculate the ratio $\frac{B U}{C U}$, it is easier to deal with the cross-ratio $\frac{B U}{C U} / \frac{B X}{C X}$ because we can send it to the line $\ell$. With this in mind we apply MEnELaus' theorem to the triangle $A B C$ and obtain $\frac{B X}{C X} \cdot \frac{C Y}{A Y} \cdot \frac{A Z}{B Z}=1$. Hence Ceva's ratio can be expressed as

$$
\frac{B U}{C U} \cdot \frac{C V}{A V} \cdot \frac{A W}{B W}=\frac{B U}{C U} / \frac{B X}{C X} \cdot \frac{C V}{A V} / \frac{C Y}{A Y} \cdot \frac{A W}{B W} / \frac{A Z}{B Z}
$$

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-39.jpg?height=594&width=1145&top_left_y=565&top_left_x=453)

Project the line $B C$ to $\ell$ from $A$. The cross-ratio between $B C$ and $U X$ equals the cross-ratio between $Z Y$ and $X^{\prime} X$. Repeating the same argument with the lines $C A$ and $A B$ gives

$$
\frac{B U}{C U} \cdot \frac{C V}{A V} \cdot \frac{A W}{B W}=\frac{Z X^{\prime}}{Y X^{\prime}} / \frac{Z X}{Y X} \cdot \frac{X Y^{\prime}}{Z Y^{\prime}} / \frac{X Y}{Z Y} \cdot \frac{Y Z^{\prime}}{X Z^{\prime}} / \frac{Y Z}{X Z}
$$

and hence

$$
\frac{B U}{C U} \cdot \frac{C V}{A V} \cdot \frac{A W}{B W}=(-1) \cdot \frac{Z X^{\prime}}{Y X^{\prime}} \cdot \frac{X Y^{\prime}}{Z Y^{\prime}} \cdot \frac{Y Z^{\prime}}{X Z^{\prime}}
$$

The equations (1) reduce the problem to a straightforward computation on the line $\ell$. For instance, the transformation $t \mapsto-k^{2} / t$ preserves cross-ratio and interchanges the points $X, Y, Z$ with the points $X^{\prime}, Y^{\prime}, Z^{\prime}$. Then

$$
\frac{B U}{C U} \cdot \frac{C V}{A V} \cdot \frac{A W}{B W}=(-1) \cdot \frac{Z X^{\prime}}{Y X^{\prime}} / \frac{Z Z^{\prime}}{Y Z^{\prime}} \cdot \frac{X Y^{\prime}}{Z Y^{\prime}} / \frac{X Z^{\prime}}{Z Z^{\prime}}=-1
$$

We proved that CEvA's ratio equals -1 , so $A A^{\prime}, B B^{\prime}, C C^{\prime}$ intersect at one point $Q$.

Comment 1. There is a nice projective argument to prove that $A X^{\prime}, B Y^{\prime}, C Z^{\prime}$ intersect at one point. Suppose that $\ell$ and $\omega$ intersect at a pair of complex conjugate points $D$ and $E$. Consider a projective transformation that takes $D$ and $E$ to $[i ; 1,0]$ and $[-i, 1,0]$. Then $\ell$ is the line at infinity, and $\omega$ is a conic through the special points $[i ; 1,0]$ and $[-i, 1,0]$, hence it is a circle. So one can assume that $A X, B Y, C Z$ are parallel to $B C, C A, A B$. The involution on $\ell$ taking $X, Y, Z$ to $X^{\prime}, Y^{\prime}, Z^{\prime}$ and leaving $D, E$ fixed is the involution changing each direction to its perpendicular one. Hence $A X, B Y, C Z$ are also perpendicular to $A X^{\prime}, B Y^{\prime}, C Z^{\prime}$.

It follows from the above that $A X^{\prime}, B Y^{\prime}, C Z^{\prime}$ intersect at the orthocenter of triangle $A B C$.

Comment 2. The restriction that the line $\ell$ does not intersect the circumcricle $\omega$ is unnecessary. The proof above works in general. In case $\ell$ intersects $\omega$ at $D$ and $E$ point $P$ is the midpoint of $D E$, and some equations can be interpreted differently. For instance

$$
X^{\prime} P \cdot X^{\prime} X=X^{\prime} A^{\prime} \cdot X^{\prime} A=X^{\prime} D \cdot X^{\prime} E
$$

and hence the pairs $X^{\prime} X$ and $D E$ are harmonic conjugates. This means that $X^{\prime}, Y^{\prime}, Z^{\prime}$ are the harmonic conjugates of $X, Y, Z$ with respect to the segment $D E$.

Solution 2. First we prove that there is an inversion in space that takes $\ell$ and $\omega$ to parallel circles on a sphere. Let $Q R$ be the diameter of $\omega$ whose extension beyond $Q$ passes through $P$. Let $\Pi$ be the plane carrying our objects. In space, choose a point $O$ such that the line $Q O$ is perpendicular to $\Pi$ and $\angle P O R=90^{\circ}$, and apply an inversion with pole $O$ (the radius of the inversion does not matter). For any object $\mathcal{T}$ denote by $\mathcal{T}^{\prime}$ the image of $\mathcal{T}$ under this inversion.

The inversion takes the plane $\Pi$ to a sphere $\Pi^{\prime}$. The lines in $\Pi$ are taken to circles through $O$, and the circles in $\Pi$ also are taken to circles on $\Pi^{\prime}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-40.jpg?height=491&width=1288&top_left_y=560&top_left_x=384)

Since the line $\ell$ and the circle $\omega$ are perpendicular to the plane $O P Q$, the circles $\ell^{\prime}$ and $\omega^{\prime}$ also are perpendicular to this plane. Hence, the planes of the circles $\ell^{\prime}$ and $\omega^{\prime}$ are parallel.

Now consider the circles $A^{\prime} X^{\prime} P^{\prime}, B^{\prime} Y^{\prime} P^{\prime}$ and $C^{\prime} Z^{\prime} P^{\prime}$. We want to prove that either they have a common point (on $\Pi^{\prime}$ ), different from $P^{\prime}$, or they are tangent to each other.

![](https://cdn.mathpix.com/cropped/2024_04_17_93f7104904c3717a5058g-40.jpg?height=819&width=870&top_left_y=1321&top_left_x=593)

The point $X^{\prime}$ is the second intersection of the circles $B^{\prime} C^{\prime} O$ and $\ell^{\prime}$, other than $O$. Hence, the lines $O X^{\prime}$ and $B^{\prime} C^{\prime}$ are coplanar. Moreover, they lie in the parallel planes of $\ell^{\prime}$ and $\omega^{\prime}$. Therefore, $O X^{\prime}$ and $B^{\prime} C^{\prime}$ are parallel. Analogously, $O Y^{\prime}$ and $O Z^{\prime}$ are parallel to $A^{\prime} C^{\prime}$ and $A^{\prime} B^{\prime}$.

Let $A_{1}$ be the second intersection of the circles $A^{\prime} X^{\prime} P^{\prime}$ and $\omega^{\prime}$, other than $A^{\prime}$. The segments $A^{\prime} A_{1}$ and $P^{\prime} X^{\prime}$ are coplanar, and therefore parallel. Now we know that $B^{\prime} C^{\prime}$ and $A^{\prime} A_{1}$ are parallel to $O X^{\prime}$ and $X^{\prime} P^{\prime}$ respectively, but these two segments are perpendicular because $O P^{\prime}$ is a diameter in $\ell^{\prime}$. We found that $A^{\prime} A_{1}$ and $B^{\prime} C^{\prime}$ are perpendicular, hence $A^{\prime} A_{1}$ is the altitude in the triangle $A^{\prime} B^{\prime} C^{\prime}$, starting from $A$.

Analogously, let $B_{1}$ and $C_{1}$ be the second intersections of $\omega^{\prime}$ with the circles $B^{\prime} P^{\prime} Y^{\prime}$ and $C^{\prime} P^{\prime} Z^{\prime}$, other than $B^{\prime}$ and $C^{\prime}$ respectively. Then $B^{\prime} B_{1}$ and $C^{\prime} C_{1}$ are the other two altitudes in the triangle $A^{\prime} B^{\prime} C^{\prime}$.

Let $H$ be the orthocenter of the triangle $A^{\prime} B^{\prime} C^{\prime}$. Let $W$ be the second intersection of the line $P^{\prime} H$ with the sphere $\Pi^{\prime}$, other than $P^{\prime}$. The point $W$ lies on the sphere $\Pi^{\prime}$, in the plane of the circle $A^{\prime} P^{\prime} X^{\prime}$, so $W$ lies on the circle $A^{\prime} P^{\prime} X^{\prime}$. Similarly, $W$ lies on the circles $B^{\prime} P^{\prime} Y^{\prime}$ and $C^{\prime} P^{\prime} Z^{\prime}$ as well; indeed $W$ is the second common point of the three circles.

If the line $P^{\prime} H$ is tangent to the sphere then $W$ coincides with $P^{\prime}$, and $P^{\prime} H$ is the common tangent of the three circles.

## Number Theory

N1. Call admissible a set $A$ of integers that has the following property:

$$
\text { If } x, y \in A \text { (possibly } x=y \text { ) then } x^{2}+k x y+y^{2} \in A \text { for every integer } k \text {. }
$$

Determine all pairs $m, n$ of nonzero integers such that the only admissible set containing both $m$ and $n$ is the set of all integers.

Solution. A pair of integers $m, n$ fulfills the condition if and only if $\operatorname{gcd}(m, n)=1$. Suppose that $\operatorname{gcd}(m, n)=d>1$. The set

$$
A=\{\ldots,-2 d,-d, 0, d, 2 d, \ldots\}
$$

is admissible, because if $d$ divides $x$ and $y$ then it divides $x^{2}+k x y+y^{2}$ for every integer $k$. Also $m, n \in A$ and $A \neq \mathbb{Z}$.

Now let $\operatorname{gcd}(m, n)=1$, and let $A$ be an admissible set containing $m$ and $n$. We use the following observations to prove that $A=\mathbb{Z}$ :

(i) $k x^{2} \in A$ for every $x \in A$ and every integer $k$.

(ii) $(x+y)^{2} \in A$ for all $x, y \in A$.

To justify (i) let $y=x$ in the definition of an admissible set; to justify (ii) let $k=2$.

Since $\operatorname{gcd}(m, n)=1$, we also have $\operatorname{gcd}\left(m^{2}, n^{2}\right)=1$. Hence one can find integers $a, b$ such that $a m^{2}+b n^{2}=1$. It follows from (i) that $a m^{2} \in A$ and $b n^{2} \in A$. Now we deduce from (ii) that $1=\left(a m^{2}+b n^{2}\right)^{2} \in A$. But if $1 \in A$ then (i) implies $k \in A$ for every integer $k$.

N2. Find all triples $(x, y, z)$ of positive integers such that $x \leq y \leq z$ and

$$
x^{3}\left(y^{3}+z^{3}\right)=2012(x y z+2) \text {. }
$$

Solution. First note that $x$ divides $2012 \cdot 2=2^{3} \cdot 503$. If $503 \mid x$ then the right-hand side of the equation is divisible by $503^{3}$, and it follows that $503^{2} \mid x y z+2$. This is false as $503 \mid x$. Hence $x=2^{m}$ with $m \in\{0,1,2,3\}$. If $m \geq 2$ then $2^{6} \mid 2012(x y z+2)$. However the highest powers of 2 dividing 2012 and $x y z+2=2^{m} y z+2$ are $2^{2}$ and $2^{1}$ respectively. So $x=1$ or $x=2$, yielding the two equations

$$
y^{3}+z^{3}=2012(y z+2), \quad \text { and } \quad y^{3}+z^{3}=503(y z+1) \text {. }
$$

In both cases the prime $503=3 \cdot 167+2$ divides $y^{3}+z^{3}$. We claim that $503 \mid y+z$. This is clear if $503 \mid y$, so let $503 \nmid y$ and $503 \nmid z$. Then $y^{502} \equiv z^{502}(\bmod 503)$ by FeRmat's little theorem. On the other hand $y^{3} \equiv-z^{3}(\bmod 503)$ implies $y^{3 \cdot 167} \equiv-z^{3 \cdot 167}(\bmod 503)$, i. e. $y^{501} \equiv-z^{501}(\bmod 503)$. It follows that $y \equiv-z(\bmod 503)$ as claimed.

Therefore $y+z=503 k$ with $k \geq 1$. In view of $y^{3}+z^{3}=(y+z)\left((y-z)^{2}+y z\right)$ the two equations take the form

$$
\begin{aligned}
& k(y-z)^{2}+(k-4) y z=8 \\
& k(y-z)^{2}+(k-1) y z=1 .
\end{aligned}
$$

In (1) we have $(k-4) y z \leq 8$, which implies $k \leq 4$. Indeed if $k>4$ then $1 \leq(k-4) y z \leq 8$, so that $y \leq 8$ and $z \leq 8$. This is impossible as $y+z=503 k \geq 503$. Note next that $y^{3}+z^{3}$ is even in the first equation. Hence $y+z=503 k$ is even too, meaning that $k$ is even. Thus $k=2$ or $k=4$. Clearly (1) has no integer solutions for $k=4$. If $k=2$ then (1) takes the form $(y+z)^{2}-5 y z=4$. Since $y+z=503 k=503 \cdot 2$, this leads to $5 y z=503^{2} \cdot 2^{2}-4$. However $503^{2} \cdot 2^{2}-4$ is not a multiple of 5 . Therefore (1) has no integer solutions.

Equation (2) implies $0 \leq(k-1) y z \leq 1$, so that $k=1$ or $k=2$. Also $0 \leq k(y-z)^{2} \leq 1$, hence $k=2$ only if $y=z$. However then $y=z=1$, which is false in view of $y+z \geq 503$. Therefore $k=1$ and (2) takes the form $(y-z)^{2}=1$, yielding $z-y=|y-z|=1$. Combined with $k=1$ and $y+z=503 k$, this leads to $y=251, z=252$.

In summary the triple $(2,251,252)$ is the only solution.

N3. Determine all integers $m \geq 2$ such that every $n$ with $\frac{m}{3} \leq n \leq \frac{m}{2}$ divides the binomial coefficient $\left(\begin{array}{c}n \\ m-2 n\end{array}\right)$.

Solution. The integers in question are all prime numbers.

First we check that all primes satisfy the condition, and even a stronger one. Namely, if $p$ is a prime then every $n$ with $1 \leq n \leq \frac{p}{2}$ divides $\left(\begin{array}{c}n \\ p-2 n\end{array}\right)$. This is true for $p=2$ where $n=1$ is the only possibility. For an odd prime $p$ take $n \in\left[1, \frac{p}{2}\right]$ and consider the following identity of binomial coefficients:

$$
(p-2 n) \cdot\left(\begin{array}{c}
n \\
p-2 n
\end{array}\right)=n \cdot\left(\begin{array}{c}
n-1 \\
p-2 n-1
\end{array}\right)
$$

Since $p \geq 2 n$ and $p$ is odd, all factors are non-zero. If $d=\operatorname{gcd}(p-2 n, n)$ then $d$ divides $p$, but $d \leq n<p$ and hence $d=1$. It follows that $p-2 n$ and $n$ are relatively prime, and so the factor $n$ in the right-hand side divides the binomial coefficient $\left(\begin{array}{c}n \\ p-2 n\end{array}\right)$.

Next we show that no composite number $m$ has the stated property. Consider two cases.

- If $m=2 k$ with $k>1$, pick $n=k$. Then $\frac{m}{3} \leq n \leq \frac{m}{2}$ but $\left(\begin{array}{c}n \\ m-2 n\end{array}\right)=\left(\begin{array}{l}k \\ 0\end{array}\right)=1$ is not divisible by $k>1$.
- If $m$ is odd then there exist an odd prime $p$ and an integer $k \geq 1$ with $m=p(2 k+1)$. Pick $n=p k$, then $\frac{m}{3} \leq n \leq \frac{m}{2}$ by $k \geq 1$. However

$$
\frac{1}{n}\left(\begin{array}{c}
n \\
m-2 n
\end{array}\right)=\frac{1}{p k}\left(\begin{array}{c}
p k \\
p
\end{array}\right)=\frac{(p k-1)(p k-2) \cdots(p k-(p-1))}{p !}
$$

is not an integer, because $p$ divides the denominator but not the numerator.

N4. An integer $a$ is called friendly if the equation $\left(m^{2}+n\right)\left(n^{2}+m\right)=a(m-n)^{3}$ has a solution over the positive integers.

a) Prove that there are at least 500 friendly integers in the set $\{1,2, \ldots, 2012\}$.

b) Decide whether $a=2$ is friendly.

Solution. a) Every $a$ of the form $a=4 k-3$ with $k \geq 2$ is friendly. Indeed the numbers $m=2 k-1>0$ and $n=k-1>0$ satisfy the given equation with $a=4 k-3$ :

$$
\left(m^{2}+n\right)\left(n^{2}+m\right)=\left((2 k-1)^{2}+(k-1)\right)\left((k-1)^{2}+(2 k-1)\right)=(4 k-3) k^{3}=a(m-n)^{3} \text {. }
$$

Hence $5,9, \ldots, 2009$ are friendly and so $\{1,2, \ldots, 2012\}$ contains at least 502 friendly numbers.

b) We show that $a=2$ is not friendly. Consider the equation with $a=2$ and rewrite its left-hand side as a difference of squares:

$$
\frac{1}{4}\left(\left(m^{2}+n+n^{2}+m\right)^{2}-\left(m^{2}+n-n^{2}-m\right)^{2}\right)=2(m-n)^{3}
$$

Since $m^{2}+n-n^{2}-m=(m-n)(m+n-1)$, we can further reformulate the equation as

$$
\left(m^{2}+n+n^{2}+m\right)^{2}=(m-n)^{2}\left(8(m-n)+(m+n-1)^{2}\right) .
$$

It follows that $8(m-n)+(m+n-1)^{2}$ is a perfect square. Clearly $m>n$, hence there is an integer $s \geq 1$ such that

$$
(m+n-1+2 s)^{2}=8(m-n)+(m+n-1)^{2} .
$$

Subtracting the squares gives $s(m+n-1+s)=2(m-n)$. Since $m+n-1+s>m-n$, we conclude that $s<2$. Therefore the only possibility is $s=1$ and $m=3 n$. However then the left-hand side of the given equation (with $a=2$ ) is greater than $m^{3}=27 n^{3}$, whereas its right-hand side equals $16 n^{3}$. The contradiction proves that $a=2$ is not friendly.

Comment. A computer search shows that there are 561 friendly numbers in $\{1,2, \ldots, 2012\}$.

N5. For a nonnegative integer $n$ define $\operatorname{rad}(n)=1$ if $n=0$ or $n=1$, and $\operatorname{rad}(n)=p_{1} p_{2} \cdots p_{k}$ where $p_{1}<p_{2}<\cdots<p_{k}$ are all prime factors of $n$. Find all polynomials $f(x)$ with nonnegative integer coefficients such that $\operatorname{rad}(f(n))$ divides $\operatorname{rad}\left(f\left(n^{\operatorname{rad}(n)}\right)\right)$ for every nonnegative integer $n$.

Solution 1. We are going to prove that $f(x)=a x^{m}$ for some nonnegative integers $a$ and $m$. If $f(x)$ is the zero polynomial we are done, so assume that $f(x)$ has at least one positive coefficient. In particular $f(1)>0$.

Let $p$ be a prime number. The condition is that $f(n) \equiv 0(\bmod p)$ implies

$$
f\left(n^{\operatorname{rad}(n)}\right) \equiv 0 \quad(\bmod p)
$$

Since $\operatorname{rad}\left(n^{\operatorname{rad}(n)^{k}}\right)=\operatorname{rad}(n)$ for all $k$, repeated applications of the preceding implication show that if $p$ divides $f(n)$ then

$$
f\left(n^{\operatorname{rad}(n)^{k}}\right) \equiv 0 \quad(\bmod p) \quad \text { for all } k .
$$

The idea is to construct a prime $p$ and a positive integer $n$ such that $p-1$ divides $n$ and $p$ divides $f(n)$. In this case, for $k$ large enough $p-1$ divides $\operatorname{rad}(n)^{k}$. Hence if $(p, n)=1$ then $n^{r a d(n)^{k}} \equiv 1(\bmod p)$ by FERMAT's little theorem, so that

$$
f(1) \equiv f\left(n^{\operatorname{rad}(n)^{k}}\right) \equiv 0 \quad(\bmod p) .
$$

Suppose that $f(x)=g(x) x^{m}$ with $g(0) \neq 0$. Let $t$ be a positive integer, $p$ any prime factor of $g(-t)$ and $n=(p-1) t$. So $p-1$ divides $n$ and $f(n)=f((p-1) t) \equiv f(-t) \equiv 0(\bmod p)$, hence either $(p, n)>1$ or $(2)$ holds. If $(p,(p-1) t)>1$ then $p$ divides $t$ and $g(0) \equiv g(-t) \equiv 0(\bmod p)$, meaning that $p$ divides $g(0)$.

In conclusion we proved that each prime factor of $g(-t)$ divides $g(0) f(1) \neq 0$, and thus the set of prime factors of $g(-t)$ when $t$ ranges through the positive integers is finite. This is known to imply that $g(x)$ is a constant polynomial, and so $f(x)=a x^{m}$.

Solution 2. Let $f(x)$ be a polynomial with integer coefficients (not necessarily nonnegative) such that $\operatorname{rad}(f(n))$ divides $\operatorname{rad}\left(f\left(n^{\operatorname{rad}(n)}\right)\right)$ for any nonnegative integer $n$. We give a complete description of all polynomials with this property. More precisely, we claim that if $f(x)$ is such a polynomial and $\xi$ is a root of $f(x)$ then so is $\xi^{d}$ for every positive integer $d$.

Therefore each root of $f(x)$ is zero or a root of unity. In particular, if a root of unity $\xi$ is a root of $f(x)$ then $1=\xi^{d}$ is a root too (for some positive integer $d$ ). In the original problem $f(x)$ has nonnegative coefficients. Then either $f(x)$ is the zero polynomial or $f(1)>0$ and $\xi=0$ is the only possible root. In either case $f(x)=a x^{m}$ with $a$ and $m$ nonnegative integers.

To prove the claim let $\xi$ be a root of $f(x)$, and let $g(x)$ be an irreducible factor of $f(x)$ such that $g(\xi)=0$. If 0 or 1 are roots of $g(x)$ then either $\xi=0$ or $\xi=1$ (because $g(x)$ is irreducible) and we are done. So assume that $g(0), g(1) \neq 0$. By decomposing $d$ as a product of prime numbers, it is enough to consider the case $d=p$ prime. We argue for $p=2$. Since $\operatorname{rad}\left(2^{k}\right)=2$ for every $k$, we have

$$
\operatorname{rad}\left(f\left(2^{k}\right)\right) \mid \operatorname{rad}\left(f\left(2^{2 k}\right)\right) .
$$

Now we prove that $g(x)$ divides $f\left(x^{2}\right)$. Suppose that this is not the case. Then, since $g(x)$ is irreducible, there are integer-coefficient polynomials $a(x), b(x)$ and an integer $N$ such that

$$
a(x) g(x)+b(x) f\left(x^{2}\right)=N
$$

Each prime factor $p$ of $g\left(2^{k}\right)$ divides $f\left(2^{k}\right)$, so by $\operatorname{rad}\left(f\left(2^{k}\right)\right) \mid \operatorname{rad}\left(f\left(2^{2 k}\right)\right)$ it also divides $f\left(2^{2 k}\right)$. From the equation above with $x=2^{k}$ it follows that $p$ divides $N$.

In summary, each prime divisor of $g\left(2^{k}\right)$ divides $N$, for all $k \geq 0$. Let $p_{1}, \ldots, p_{n}$ be the odd primes dividing $N$, and suppose that

$$
g(1)=2^{\alpha} p_{1}^{\alpha_{1}} \cdots p_{n}^{\alpha_{n}}
$$

If $k$ is divisible by $\varphi\left(p_{1}^{\alpha_{1}+1} \cdots p_{n}^{\alpha_{n}+1}\right)$ then

$$
2^{k} \equiv 1 \quad\left(\bmod p_{1}^{\alpha_{1}+1} \cdots p_{n}^{\alpha_{n}+1}\right)
$$

yielding

$$
g\left(2^{k}\right) \equiv g(1) \quad\left(\bmod p_{1}^{\alpha_{1}+1} \cdots p_{n}^{\alpha_{n}+1}\right)
$$

It follows that for each $i$ the maximal power of $p_{i}$ dividing $g\left(2^{k}\right)$ and $g(1)$ is the same, namely $p_{i}^{\alpha_{i}}$. On the other hand, for large enough $k$, the maximal power of 2 dividing $g\left(2^{k}\right)$ and $g(0) \neq 0$ is the same. From the above, for $k$ divisible by $\varphi\left(p_{1}^{\alpha_{1}+1} \cdots p_{n}^{\alpha_{n}+1}\right)$ and large enough, we obtain that $g\left(2^{k}\right)$ divides $g(0) \cdot g(1)$. This is impossible because $g(0), g(1) \neq 0$ are fixed and $g\left(2^{k}\right)$ is arbitrarily large.

In conclusion, $g(x)$ divides $f\left(x^{2}\right)$. Recall that $\xi$ is a root of $f(x)$ such that $g(\xi)=0$; then $f\left(\xi^{2}\right)=0$, i. e. $\xi^{2}$ is a root of $f(x)$.

Likewise if $\xi$ is a root of $f(x)$ and $p$ an arbitrary prime then $\xi^{p}$ is a root too. The argument is completely analogous, in the proof above just replace 2 by $p$ and "odd prime" by "prime different from $p . "$

Comment. The claim in the second solution can be proved by varying $n(\bmod p)$ in $(1)$. For instance, we obtain

$$
f\left(n^{\operatorname{rad}(n+p k)}\right) \equiv 0 \quad(\bmod p)
$$

for every positive integer $k$. One can prove that if $(n, p)=1$ then $\operatorname{rad}(n+p k)$ runs through all residue classes $r(\bmod p-1)$ with $(r, p-1)$ squarefree. Hence if $f(n) \equiv 0(\bmod p)$ then $f\left(n^{r}\right) \equiv 0(\bmod p)$ for all integers $r$. This implies the claim by an argument leading to the identity (3).

N6. Let $x$ and $y$ be positive integers. If $x^{2^{n}}-1$ is divisible by $2^{n} y+1$ for every positive integer $n$, prove that $x=1$.

Solution. First we prove the following fact: For every positive integer $y$ there exist infinitely many primes $p \equiv 3(\bmod 4)$ such that $p$ divides some number of the form $2^{n} y+1$.

Clearly it is enough to consider the case $y$ odd. Let

$$
2 y+1=p_{1}^{e_{1}} \cdots p_{r}^{e_{r}}
$$

be the prime factorization of $2 y+1$. Suppose on the contrary that there are finitely many primes $p_{r+1}, \ldots, p_{r+s} \equiv 3(\bmod 4)$ that divide some number of the form $2^{n} y+1$ but do not divide $2 y+1$.

We want to find an $n$ such that $p_{i}^{e_{i}} \| 2^{n} y+1$ for $1 \leq i \leq r$ and $p_{i} \nmid 2^{n} y+1$ for $r+1 \leq i \leq r+s$. For this it suffices to take

$$
n=1+\varphi\left(p_{1}^{e_{1}+1} \cdots p_{r}^{e_{r}+1} p_{r+1}^{1} \cdots p_{r+s}^{1}\right)
$$

because then

$$
2^{n} y+1 \equiv 2 y+1 \quad\left(\bmod p_{1}^{e_{1}+1} \cdots p_{r}^{e_{r}+1} p_{r+1}^{1} \cdots p_{r+s}^{1}\right)
$$

The last congruence means that $p_{1}^{e_{1}}, \ldots, p_{r}^{e_{r}}$ divide exactly $2^{n} y+1$ and no prime $p_{r+1}, \ldots, p_{r+s}$ divides $2^{n} y+1$. It follows that the prime factorization of $2^{n} y+1$ consists of the prime powers $p_{1}^{e_{1}}, \ldots, p_{r}^{e_{r}}$ and powers of primes $\equiv 1(\bmod 4)$. Because $y$ is odd, we obtain

$$
2^{n} y+1 \equiv p_{1}^{e_{1}} \cdots p_{r}^{e_{r}} \equiv 2 y+1 \equiv 3 \quad(\bmod 4)
$$

This is a contradiction since $n>1$, and so $2^{n} y+1 \equiv 1(\bmod 4)$.

Now we proceed to the problem. If $p$ is a prime divisor of $2^{n} y+1$ the problem statement implies that $x^{d} \equiv 1(\bmod p)$ for $d=2^{n}$. By FERMAT's little theorem the same congruence holds for $d=p-1$, so it must also hold for $d=\left(2^{n}, p-1\right)$. For $p \equiv 3(\bmod 4)$ we have $\left(2^{n}, p-1\right)=2$, therefore in this case $x^{2} \equiv 1(\bmod p)$.

In summary, we proved that every prime $p \equiv 3(\bmod 4)$ that divides some number of the form $2^{n} y+1$ also divides $x^{2}-1$. This is possible only if $x=1$, otherwise by the above $x^{2}-1$ would be a positive integer with infinitely many prime factors.

Comment. For each $x$ and each odd prime $p$ the maximal power of $p$ dividing $x^{2^{n}}-1$ for some $n$ is bounded and hence the same must be true for the numbers $2^{n} y+1$. We infer that $p^{2}$ divides $2^{p-1}-1$ for each prime divisor $p$ of $2^{n} y+1$. However trying to reach a contradiction with this conclusion alone seems hopeless, since it is not even known if there are infinitely many primes $p$ without this property.

N7. Find all $n \in \mathbb{N}$ for which there exist nonnegative integers $a_{1}, a_{2}, \ldots, a_{n}$ such that

$$
\frac{1}{2^{a_{1}}}+\frac{1}{2^{a_{2}}}+\cdots+\frac{1}{2^{a_{n}}}=\frac{1}{3^{a_{1}}}+\frac{2}{3^{a_{2}}}+\cdots+\frac{n}{3^{a_{n}}}=1 .
$$

Solution. Such numbers $a_{1}, a_{2}, \ldots, a_{n}$ exist if and only if $n \equiv 1(\bmod 4)$ or $n \equiv 2(\bmod 4)$.

Let $\sum_{k=1}^{n} \frac{k}{3^{a} k}=1$ with $a_{1}, a_{2}, \ldots, a_{n}$ nonnegative integers. Then $1 \cdot x_{1}+2 \cdot x_{2}+\cdots+n \cdot x_{n}=3^{a}$ with $x_{1}, \ldots, x_{n}$ powers of 3 and $a \geq 0$. The right-hand side is odd, and the left-hand side has the same parity as $1+2+\cdots+n$. Hence the latter sum is odd, which implies $n \equiv 1,2(\bmod 4)$. Now we prove the converse.

Call feasible a sequence $b_{1}, b_{2}, \ldots, b_{n}$ if there are nonnegative integers $a_{1}, a_{2}, \ldots, a_{n}$ such that

$$
\frac{1}{2^{a_{1}}}+\frac{1}{2^{a_{2}}}+\cdots+\frac{1}{2^{a_{n}}}=\frac{b_{1}}{3^{a_{1}}}+\frac{b_{2}}{3^{a_{2}}}+\cdots+\frac{b_{n}}{3^{a_{n}}}=1
$$

Let $b_{k}$ be a term of a feasible sequence $b_{1}, b_{2}, \ldots, b_{n}$ with exponents $a_{1}, a_{2}, \ldots, a_{n}$ like above, and let $u, v$ be nonnegative integers with sum $3 b_{k}$. Observe that

$$
\frac{1}{2^{a_{k}+1}}+\frac{1}{2^{a_{k}+1}}=\frac{1}{2^{a_{k}}} \quad \text { and } \quad \frac{u}{3^{a_{k}+1}}+\frac{v}{3^{a_{k}+1}}=\frac{b_{k}}{3^{a_{k}}}
$$

It follows that the sequence $b_{1}, \ldots, b_{k-1}, u, v, b_{k+1}, \ldots, b_{n}$ is feasible. The exponents $a_{i}$ are the same for the unchanged terms $b_{i}, i \neq k$; the new terms $u, v$ have exponents $a_{k}+1$.

We state the conclusion in reverse. If two terms $u, v$ of a sequence are replaced by one term $\frac{u+v}{3}$ and the obtained sequence is feasible, then the original sequence is feasible too. Denote by $\alpha_{n}$ the sequence $1,2, \ldots, n$. To show that $\alpha_{n}$ is feasible for $n \equiv 1,2(\bmod 4)$, we transform it by $n-1$ replacements $\{u, v\} \mapsto \frac{u+v}{3}$ to the one-term sequence $\alpha_{1}$. The latter is feasible, with $a_{1}=0$. Note that if $m$ and $2 m$ are terms of a sequence then $\{m, 2 m\} \mapsto m$, so $2 m$ can be ignored if necessary.

Let $n \geq 16$. We prove that $\alpha_{n}$ can be reduced to $\alpha_{n-12}$ by 12 operations. Write $n=12 k+r$ where $k \geq 1$ and $0 \leq r \leq 11$. If $0 \leq r \leq 5$ then the last 12 terms of $\alpha_{n}$ can be partitioned into 2 singletons $\{12 k-6\},\{12 k\}$ and the following 5 pairs:

$$
\{12 k-6-i, 12 k-6+i\}, i=1, \ldots, 5-r ; \quad\{12 k-j, 12 k+j\}, j=1, \ldots, r .
$$

(There is only one kind of pairs if $r \in\{0,5\}$.) One can ignore $12 k-6$ and $12 k$ since $\alpha_{n}$ contains $6 k-3$ and $6 k$. Furthermore the 5 operations $\{12 k-6-i, 12 k-6+i\} \mapsto 8 k-4$ and $\{12 k-j, 12 k+j\} \mapsto 8 k$ remove the 10 terms in the pairs and bring in 5 new terms equal to $8 k-4$ or $8 k$. All of these can be ignored too as $4 k-2$ and $4 k$ are still present in the sequence. Indeed $4 k \leq n-12$ is equivalent to $8 k \geq 12-r$, which is true for $r \in\{4,5\}$. And if $r \in\{0,1,2,3\}$ then $n \geq 16$ implies $k \geq 2$, so $8 k \geq 12-r$ also holds. Thus $\alpha_{n}$ reduces to $\alpha_{n-12}$.

The case $6 \leq r \leq 11$ is analogous. Consider the singletons $\{12 k\},\{12 k+6\}$ and the 5 pairs

$$
\{12 k-i, 12 k+i\}, i=1, \ldots, 11-r ; \quad\{12 k+6-j, 12 k+6+j\}, j=1, \ldots, r-6
$$

Ignore the singletons like before, then remove the pairs via operations $\{12 k-i, 12 k+i\} \mapsto 8 k$ and $\{12 k+6-j, 12 k+6+j\} \mapsto 8 k+4$. The 5 newly-appeared terms $8 k$ and $8 k+4$ can be ignored too since $4 k+2 \leq n-12$ (this follows from $k \geq 1$ and $r \geq 6$ ). We obtain $\alpha_{n-12}$ again.

The problem reduces to $2 \leq n \leq 15$. In fact $n \in\{2,5,6,9,10,13,14\}$ by $n \equiv 1,2(\bmod 4)$. The cases $n=2,6,10,14$ reduce to $n=1,5,9,13$ respectively because the last even term of $\alpha_{n}$ can be ignored. For $n=5$ apply $\{4,5\} \mapsto 3$, then $\{3,3\} \mapsto 2$, then ignore the 2 occurrences of 2 . For $n=9$ ignore 6 first, then apply $\{5,7\} \mapsto 4,\{4,8\} \mapsto 4,\{3,9\} \mapsto 4$. Now ignore the 3 occurrences of 4 , then ignore 2. Finally $n=13$ reduces to $n=10$ by $\{11,13\} \mapsto 8$ and ignoring 8 and 12 . The proof is complete.

N8. Prove that for every prime $p>100$ and every integer $r$ there exist two integers $a$ and $b$ such that $p$ divides $a^{2}+b^{5}-r$.

Solution 1. Throughout the solution, all congruence relations are meant modulo $p$.

Fix $p$, and let $\mathcal{P}=\{0,1, \ldots, p-1\}$ be the set of residue classes modulo $p$. For every $r \in \mathcal{P}$, let $S_{r}=\left\{(a, b) \in \mathcal{P} \times \mathcal{P}: a^{2}+b^{5} \equiv r\right\}$, and let $s_{r}=\left|S_{r}\right|$. Our aim is to prove $s_{r}>0$ for all $r \in \mathcal{P}$.

We will use the well-known fact that for every residue class $r \in \mathcal{P}$ and every positive integer $k$, there are at most $k$ values $x \in \mathcal{P}$ such that $x^{k} \equiv r$.

Lemma. Let $N$ be the number of quadruples $(a, b, c, d) \in \mathcal{P}^{4}$ for which $a^{2}+b^{5} \equiv c^{2}+d^{5}$. Then

$$
N=\sum_{r \in \mathcal{P}} s_{r}^{2}
$$

and

$$
N \leq p\left(p^{2}+4 p-4\right)
$$

Proof. (a) For each residue class $r$ there exist exactly $s_{r}$ pairs $(a, b)$ with $a^{2}+b^{5} \equiv r$ and $s_{r}$ pairs $(c, d)$ with $c^{2}+d^{5} \equiv r$. So there are $s_{r}^{2}$ quadruples with $a^{2}+b^{5} \equiv c^{2}+d^{5} \equiv r$. Taking the sum over all $r \in \mathcal{P}$, the statement follows.

(b) Choose an arbitrary pair $(b, d) \in \mathcal{P}$ and look for the possible values of $a, c$.

1. Suppose that $b^{5} \equiv d^{5}$, and let $k$ be the number of such pairs $(b, d)$. The value $b$ can be chosen in $p$ different ways. For $b \equiv 0$ only $d=0$ has this property; for the nonzero values of $b$ there are at most 5 possible values for $d$. So we have $k \leq 1+5(p-1)=5 p-4$.

The values $a$ and $c$ must satisfy $a^{2} \equiv c^{2}$, so $a \equiv \pm c$, and there are exactly $2 p-1$ such pairs $(a, c)$.

2. Now suppose $b^{5} \not \equiv d^{5}$. In this case $a$ and $c$ must be distinct. By $(a-c)(a+c)=d^{5}-b^{5}$, the value of $a-c$ uniquely determines $a+c$ and thus $a$ and $c$ as well. Hence, there are $p-1$ suitable pairs $(a, c)$.

Thus, for each of the $k$ pairs $(b, d)$ with $b^{5} \equiv d^{5}$ there are $2 p-1$ pairs $(a, c)$, and for each of the other $p^{2}-k$ pairs $(b, d)$ there are $p-1$ pairs $(a, c)$. Hence,

$$
N=k(2 p-1)+\left(p^{2}-k\right)(p-1)=p^{2}(p-1)+k p \leq p^{2}(p-1)+(5 p-4) p=p\left(p^{2}+4 p-4\right)
$$

To prove the statement of the problem, suppose that $S_{r}=\emptyset$ for some $r \in \mathcal{P}$; obviously $r \not \equiv 0$. Let $T=\left\{x^{10}: x \in \mathcal{P} \backslash\{0\}\right\}$ be the set of nonzero 10th powers modulo $p$. Since each residue class is the 10 th power of at most 10 elements in $\mathcal{P}$, we have $|T| \geq \frac{p-1}{10} \geq 4$ by $p>100$.

For every $t \in T$, we have $S_{t r}=\emptyset$. Indeed, if $(x, y) \in S_{t r}$ and $t \equiv z^{10}$ then

$$
\left(z^{-5} x\right)^{2}+\left(z^{-2} y\right)^{5} \equiv t^{-1}\left(x^{2}+y^{5}\right) \equiv r
$$

so $\left(z^{-5} x, z^{-2} y\right) \in S_{r}$. So, there are at least $\frac{p-1}{10} \geq 4$ empty sets among $S_{1}, \ldots, S_{p-1}$, and there are at most $p-4$ nonzero values among $s_{0}, s_{2}, \ldots, s_{p-1}$. Then by the AM-QM inequality we obtain

$$
N=\sum_{r \in \mathcal{P} \backslash r T} s_{r}^{2} \geq \frac{1}{p-4}\left(\sum_{r \in \mathcal{P} \backslash r T} s_{r}\right)^{2}=\frac{|\mathcal{P} \times \mathcal{P}|^{2}}{p-4}=\frac{p^{4}}{p-4}>p\left(p^{2}+4 p-4\right),
$$

which is impossible by the lemma.

Solution 2. If $5 \nmid p-1$, then all modulo $p$ residue classes are complete fifth powers and the statement is trivial. So assume that $p=10 k+1$ where $k \geq 10$. Let $g$ be a primitive root modulo $p$.

We will use the following facts:

(F1) If some residue class $x$ is not quadratic then $x^{(p-1) / 2} \equiv-1(\bmod p)$.

(F2) For every integer $d$, as a simple corollary of the summation formula for geometric progressions,

$$
\sum_{i=0}^{2 k-1} g^{5 d i} \equiv\left\{\begin{array}{ll}
2 k & \text { if } 2 k \mid d \\
0 & \text { if } 2 k \not \nless d
\end{array} \quad(\bmod p)\right.
$$

Suppose that, contrary to the statement, some modulo $p$ residue class $r$ cannot be expressed as $a^{2}+b^{5}$. Of course $r \not \equiv 0(\bmod p)$. By $(\mathrm{F} 1)$ we have $\left(r-b^{5}\right)^{(p-1) / 2}=\left(r-b^{5}\right)^{5 k} \equiv-1(\bmod p)$ for all residue classes $b$.

For $t=1,2 \ldots, k-1$ consider the sums

$$
S(t)=\sum_{i=0}^{2 k-1}\left(r-g^{5 i}\right)^{5 k} g^{5 t i}
$$

By the indirect assumption and (F2),

$$
S(t)=\sum_{i=0}^{2 k-1}\left(r-\left(g^{i}\right)^{5}\right)^{5 k} g^{5 t i} \equiv \sum_{i=0}^{2 k-1}(-1) g^{5 t i} \equiv-\sum_{i=0}^{2 k-1} g^{5 t i} \equiv 0 \quad(\bmod p)
$$

because $2 k$ cannot divide $t$.

On the other hand, by the binomial theorem,

$$
\begin{aligned}
S(t) & =\sum_{i=0}^{2 k-1}\left(\sum_{j=0}^{5 k}\left(\begin{array}{c}
5 k \\
j
\end{array}\right) r^{5 k-j}\left(-g^{5 i}\right)^{j}\right) g^{5 t i}=\sum_{j=0}^{5 k}(-1)^{j}\left(\begin{array}{c}
5 k \\
j
\end{array}\right) r^{5 k-j}\left(\sum_{i=0}^{2 k-1} g^{5(j+t) i}\right) \equiv \\
& \equiv \sum_{j=0}^{5 k}(-1)^{j}\left(\begin{array}{c}
5 k \\
j
\end{array}\right) r^{5 k-j}\left\{\begin{array}{ll}
2 k & \text { if } 2 k \mid j+t \\
0 & \text { if } 2 k \not j j+t
\end{array}(\bmod p) .\right.
\end{aligned}
$$

Since $1 \leq j+t<6 k$, the number $2 k$ divides $j+t$ only for $j=2 k-t$ and $j=4 k-t$. Hence,

$$
\begin{gathered}
0 \equiv S(t) \equiv(-1)^{t}\left(\left(\begin{array}{c}
5 k \\
2 k-t
\end{array}\right) r^{3 k+t}+\left(\begin{array}{c}
5 k \\
4 k-t
\end{array}\right) r^{k+t}\right) \cdot 2 k \quad(\bmod p), \\
\left(\begin{array}{c}
5 k \\
2 k-t
\end{array}\right) r^{2 k}+\left(\begin{array}{c}
5 k \\
4 k-t
\end{array}\right) \equiv 0 \quad(\bmod p) .
\end{gathered}
$$

Taking this for $t=1,2$ and eliminating $r$, we get

$$
\begin{aligned}
0 & \equiv\left(\begin{array}{c}
5 k \\
2 k-2
\end{array}\right)\left(\left(\begin{array}{c}
5 k \\
2 k-1
\end{array}\right) r^{2 k}+\left(\begin{array}{c}
5 k \\
4 k-1
\end{array}\right)\right)-\left(\begin{array}{c}
5 k \\
2 k-1
\end{array}\right)\left(\left(\begin{array}{c}
5 k \\
2 k-2
\end{array}\right) r^{2 k}+\left(\begin{array}{c}
5 k \\
4 k-2
\end{array}\right)\right) \\
& =\left(\begin{array}{c}
5 k \\
2 k-2
\end{array}\right)\left(\begin{array}{c}
5 k \\
4 k-1
\end{array}\right)-\left(\begin{array}{c}
5 k \\
2 k-1
\end{array}\right)\left(\begin{array}{c}
5 k \\
4 k-2
\end{array}\right) \\
& =\frac{(5 k) !^{2}}{(2 k-1) !(3 k+2) !(4 k-1) !(k+2) !}((2 k-1)(k+2)-(3 k+2)(4 k-1)) \\
& =\frac{-(5 k) !^{2} \cdot 2 k(5 k+1)}{(2 k-1) !(3 k+2) !(4 k-1) !(k+2) !}(\bmod p) .
\end{aligned}
$$

But in the last expression none of the numbers is divisible by $p=10 k+1$, a contradiction.

Comment 1. The argument in the second solution is valid whenever $k \geq 3$, that is for all primes $p=10 k+1$ except $p=11$. This is an exceptional case when the statement is not true; $r=7$ cannot be expressed as desired.

Comment 2. The statement is true in a more general setting: for every positive integer $n$, for all sufficiently large $p$, each residue class modulo $p$ can be expressed as $a^{2}+b^{n}$. Choosing $t=3$ would allow using the Cauchy-Davenport theorem (together with some analysis on the case of equality).

In the literature more general results are known. For instance, the statement easily follows from the Hasse-Weil bound.