File size: 181,813 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
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
# Shortlisted Problems with Solutions 

$54^{\text {th }}$ International Mathematical Olympiad

Santa Marta, Colombia 2013

## Note of Confidentiality

## The Shortlisted Problems should be kept strictly confidential until IMO 2014.

## Contributing Countries

The Organizing Committee and the Problem Selection Committee of IMO 2013 thank the following 50 countries for contributing 149 problem proposals.

Argentina, Armenia, Australia, Austria, Belgium, Belarus, Brazil, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, El Salvador, Estonia, Finland, France, Georgia, Germany, Greece, Hungary, India, Indonesia, Iran, Ireland, Israel, Italy, Japan, Latvia, Lithuania, Luxembourg, Malaysia, Mexico, Netherlands, Nicaragua, Pakistan, Panama, Poland, Romania, Russia, Saudi Arabia, Serbia, Slovenia, Sweden, Switzerland, Tajikistan, Thailand, Turkey, U.S.A., Ukraine, United Kingdom

## Problem Selection Committee

Federico Ardila (chairman)

Ilya I. Bogdanov

Géza Kós

Carlos Gustavo Tamm de Araújo Moreira (Gugu)

Christian Reiher

## Problems

## Algebra

A1. Let $n$ be a positive integer and let $a_{1}, \ldots, a_{n-1}$ be arbitrary real numbers. Define the sequences $u_{0}, \ldots, u_{n}$ and $v_{0}, \ldots, v_{n}$ inductively by $u_{0}=u_{1}=v_{0}=v_{1}=1$, and

$$
u_{k+1}=u_{k}+a_{k} u_{k-1}, \quad v_{k+1}=v_{k}+a_{n-k} v_{k-1} \quad \text { for } k=1, \ldots, n-1 .
$$

Prove that $u_{n}=v_{n}$.

(France)

A2. Prove that in any set of 2000 distinct real numbers there exist two pairs $a>b$ and $c>d$ with $a \neq c$ or $b \neq d$, such that

$$
\left|\frac{a-b}{c-d}-1\right|<\frac{1}{100000}
$$

(Lithuania)

A3. Let $\mathbb{Q}_{>0}$ be the set of positive rational numbers. Let $f: \mathbb{Q}_{>0} \rightarrow \mathbb{R}$ be a function satisfying the conditions

$$
f(x) f(y) \geqslant f(x y) \text { and } f(x+y) \geqslant f(x)+f(y)
$$

for all $x, y \in \mathbb{Q}_{>0}$. Given that $f(a)=a$ for some rational $a>1$, prove that $f(x)=x$ for all $x \in \mathbb{Q}_{>0}$.

(Bulgaria)

A4. Let $n$ be a positive integer, and consider a sequence $a_{1}, a_{2}, \ldots, a_{n}$ of positive integers. Extend it periodically to an infinite sequence $a_{1}, a_{2}, \ldots$ by defining $a_{n+i}=a_{i}$ for all $i \geqslant 1$. If

$$
a_{1} \leqslant a_{2} \leqslant \cdots \leqslant a_{n} \leqslant a_{1}+n
$$

and

$$
a_{a_{i}} \leqslant n+i-1 \quad \text { for } i=1,2, \ldots, n
$$

prove that

$$
a_{1}+\cdots+a_{n} \leqslant n^{2} .
$$

(Germany)

A5. Let $\mathbb{Z}_{\geqslant 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\geqslant 0} \rightarrow \mathbb{Z}_{\geqslant 0}$ satisfying the relation

$$
f(f(f(n)))=f(n+1)+1
$$

for all $n \in \mathbb{Z}_{\geqslant 0}$.

(Serbia)

A6. Let $m \neq 0$ be an integer. Find all polynomials $P(x)$ with real coefficients such that

$$
\left(x^{3}-m x^{2}+1\right) P(x+1)+\left(x^{3}+m x^{2}+1\right) P(x-1)=2\left(x^{3}-m x+1\right) P(x)
$$

for all real numbers $x$.

## Combinatorics

C1. Let $n$ be a positive integer. Find the smallest integer $k$ with the following property: Given any real numbers $a_{1}, \ldots, a_{d}$ such that $a_{1}+a_{2}+\cdots+a_{d}=n$ and $0 \leqslant a_{i} \leqslant 1$ for $i=1,2, \ldots, d$, it is possible to partition these numbers into $k$ groups (some of which may be empty) such that the sum of the numbers in each group is at most 1 .

(Poland)

C2. In the plane, 2013 red points and 2014 blue points are marked so that no three of the marked points are collinear. One needs to draw $k$ lines not passing through the marked points and dividing the plane into several regions. The goal is to do it in such a way that no region contains points of both colors.

Find the minimal value of $k$ such that the goal is attainable for every possible configuration of 4027 points.

(Australia)

C3. A crazy physicist discovered a new kind of particle which he called an imon, after some of them mysteriously appeared in his lab. Some pairs of imons in the lab can be entangled, and each imon can participate in many entanglement relations. The physicist has found a way to perform the following two kinds of operations with these particles, one operation at a time.

(i) If some imon is entangled with an odd number of other imons in the lab, then the physicist can destroy it.

(ii) At any moment, he may double the whole family of imons in his lab by creating a copy $I^{\prime}$ of each imon $I$. During this procedure, the two copies $I^{\prime}$ and $J^{\prime}$ become entangled if and only if the original imons $I$ and $J$ are entangled, and each copy $I^{\prime}$ becomes entangled with its original imon $I$; no other entanglements occur or disappear at this moment.

Prove that the physicist may apply a sequence of such operations resulting in a family of imons, no two of which are entangled.

(Japan)

C4. Let $n$ be a positive integer, and let $A$ be a subset of $\{1, \ldots, n\}$. An $A$-partition of $n$ into $k$ parts is a representation of $n$ as a sum $n=a_{1}+\cdots+a_{k}$, where the parts $a_{1}, \ldots, a_{k}$ belong to $A$ and are not necessarily distinct. The number of different parts in such a partition is the number of (distinct) elements in the set $\left\{a_{1}, a_{2}, \ldots, a_{k}\right\}$.

We say that an $A$-partition of $n$ into $k$ parts is optimal if there is no $A$-partition of $n$ into $r$ parts with $r<k$. Prove that any optimal $A$-partition of $n$ contains at most $\sqrt[3]{6 n}$ different parts.

(Germany)

C5. Let $r$ be a positive integer, and let $a_{0}, a_{1}, \ldots$ be an infinite sequence of real numbers. Assume that for all nonnegative integers $m$ and $s$ there exists a positive integer $n \in[m+1, m+r]$ such that

$$
a_{m}+a_{m+1}+\cdots+a_{m+s}=a_{n}+a_{n+1}+\cdots+a_{n+s}
$$

Prove that the sequence is periodic, i. e. there exists some $p \geqslant 1$ such that $a_{n+p}=a_{n}$ for all $n \geqslant 0$.

C6. In some country several pairs of cities are connected by direct two-way flights. It is possible to go from any city to any other by a sequence of flights. The distance between two cities is defined to be the least possible number of flights required to go from one of them to the other. It is known that for any city there are at most 100 cities at distance exactly three from it. Prove that there is no city such that more than 2550 other cities have distance exactly four from it.

(Russia)

C7. Let $n \geqslant 2$ be an integer. Consider all circular arrangements of the numbers $0,1, \ldots, n$; the $n+1$ rotations of an arrangement are considered to be equal. A circular arrangement is called beautiful if, for any four distinct numbers $0 \leqslant a, b, c, d \leqslant n$ with $a+c=b+d$, the chord joining numbers $a$ and $c$ does not intersect the chord joining numbers $b$ and $d$.

Let $M$ be the number of beautiful arrangements of $0,1, \ldots, n$. Let $N$ be the number of pairs $(x, y)$ of positive integers such that $x+y \leqslant n$ and $\operatorname{gcd}(x, y)=1$. Prove that

$$
M=N+1
$$

(Russia)

C8. Players $A$ and $B$ play a paintful game on the real line. Player $A$ has a pot of paint with four units of black ink. A quantity $p$ of this ink suffices to blacken a (closed) real interval of length $p$. In every round, player $A$ picks some positive integer $m$ and provides $1 / 2^{m}$ units of ink from the pot. Player $B$ then picks an integer $k$ and blackens the interval from $k / 2^{m}$ to $(k+1) / 2^{m}$ (some parts of this interval may have been blackened before). The goal of player $A$ is to reach a situation where the pot is empty and the interval $[0,1]$ is not completely blackened.

Decide whether there exists a strategy for player $A$ to win in a finite number of moves.

(Austria)

## Geometry

G1. Let $A B C$ be an acute-angled triangle with orthocenter $H$, and let $W$ be a point on side $B C$. Denote by $M$ and $N$ the feet of the altitudes from $B$ and $C$, respectively. Denote by $\omega_{1}$ the circumcircle of $B W N$, and let $X$ be the point on $\omega_{1}$ which is diametrically opposite to $W$. Analogously, denote by $\omega_{2}$ the circumcircle of $C W M$, and let $Y$ be the point on $\omega_{2}$ which is diametrically opposite to $W$. Prove that $X, Y$ and $H$ are collinear.

(Thaliand)

G2. Let $\omega$ be the circumcircle of a triangle $A B C$. Denote by $M$ and $N$ the midpoints of the sides $A B$ and $A C$, respectively, and denote by $T$ the midpoint of the $\operatorname{arc} B C$ of $\omega$ not containing $A$. The circumcircles of the triangles $A M T$ and $A N T$ intersect the perpendicular bisectors of $A C$ and $A B$ at points $X$ and $Y$, respectively; assume that $X$ and $Y$ lie inside the triangle $A B C$. The lines $M N$ and $X Y$ intersect at $K$. Prove that $K A=K T$.

(Iran)

G3. In a triangle $A B C$, let $D$ and $E$ be the feet of the angle bisectors of angles $A$ and $B$, respectively. A rhombus is inscribed into the quadrilateral $A E D B$ (all vertices of the rhombus lie on different sides of $A E D B$ ). Let $\varphi$ be the non-obtuse angle of the rhombus. Prove that $\varphi \leqslant \max \{\angle B A C, \angle A B C\}$.

(Serbia)

G4. Let $A B C$ be a triangle with $\angle B>\angle C$. Let $P$ and $Q$ be two different points on line $A C$ such that $\angle P B A=\angle Q B A=\angle A C B$ and $A$ is located between $P$ and $C$. Suppose that there exists an interior point $D$ of segment $B Q$ for which $P D=P B$. Let the ray $A D$ intersect the circle $A B C$ at $R \neq A$. Prove that $Q B=Q R$.

(Georgia)

G5. Let $A B C D E F$ be a convex hexagon with $A B=D E, B C=E F, C D=F A$, and $\angle A-\angle D=\angle C-\angle F=\angle E-\angle B$. Prove that the diagonals $A D, B E$, and $C F$ are concurrent.

(Ukraine)

G6. Let the excircle of the triangle $A B C$ lying opposite to $A$ touch its side $B C$ at the point $A_{1}$. Define the points $B_{1}$ and $C_{1}$ analogously. Suppose that the circumcentre of the triangle $A_{1} B_{1} C_{1}$ lies on the circumcircle of the triangle $A B C$. Prove that the triangle $A B C$ is right-angled.

(Russia)

## Number Theory

N1. Let $\mathbb{Z}_{>0}$ be the set of positive integers. Find all functions $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ such that

$$
m^{2}+f(n) \mid m f(m)+n
$$

for all positive integers $m$ and $n$.

(Malaysia)

N2. Prove that for any pair of positive integers $k$ and $n$ there exist $k$ positive integers $m_{1}, m_{2}, \ldots, m_{k}$ such that

$$
1+\frac{2^{k}-1}{n}=\left(1+\frac{1}{m_{1}}\right)\left(1+\frac{1}{m_{2}}\right) \cdots\left(1+\frac{1}{m_{k}}\right) .
$$

(Japan)

N3. Prove that there exist infinitely many positive integers $n$ such that the largest prime divisor of $n^{4}+n^{2}+1$ is equal to the largest prime divisor of $(n+1)^{4}+(n+1)^{2}+1$.

(Belgium)

N4. Determine whether there exists an infinite sequence of nonzero digits $a_{1}, a_{2}, a_{3}, \ldots$ and a positive integer $N$ such that for every integer $k>N$, the number $\overline{a_{k} a_{k-1} \ldots a_{1}}$ is a perfect square.

(Iran)

N5. Fix an integer $k \geqslant 2$. Two players, called Ana and Banana, play the following game of numbers: Initially, some integer $n \geqslant k$ gets written on the blackboard. Then they take moves in turn, with Ana beginning. A player making a move erases the number $m$ just written on the blackboard and replaces it by some number $m^{\prime}$ with $k \leqslant m^{\prime}<m$ that is coprime to $m$. The first player who cannot move anymore loses.

An integer $n \geqslant k$ is called good if Banana has a winning strategy when the initial number is $n$, and bad otherwise.

Consider two integers $n, n^{\prime} \geqslant k$ with the property that each prime number $p \leqslant k$ divides $n$ if and only if it divides $n^{\prime}$. Prove that either both $n$ and $n^{\prime}$ are good or both are bad.

(Italy)

N6. Determine all functions $f: \mathbb{Q} \longrightarrow \mathbb{Z}$ satisfying

$$
f\left(\frac{f(x)+a}{b}\right)=f\left(\frac{x+a}{b}\right)
$$

for all $x \in \mathbb{Q}, a \in \mathbb{Z}$, and $b \in \mathbb{Z}_{>0}$. (Here, $\mathbb{Z}_{>0}$ denotes the set of positive integers.)

(Israel)

N7. Let $\nu$ be an irrational positive number, and let $m$ be a positive integer. A pair $(a, b)$ of positive integers is called good if

$$
a\lceil b \nu\rceil-b\lfloor a \nu\rfloor=m .
$$

A good pair $(a, b)$ is called excellent if neither of the pairs $(a-b, b)$ and $(a, b-a)$ is good. (As usual, by $\lfloor x\rfloor$ and $\lceil x\rceil$ we denote the integer numbers such that $x-1<\lfloor x\rfloor \leqslant x$ and $x \leqslant\lceil x\rceil<x+1$.)

Prove that the number of excellent pairs is equal to the sum of the positive divisors of $m$.

## Solutions

## Algebra

A1. Let $n$ be a positive integer and let $a_{1}, \ldots, a_{n-1}$ be arbitrary real numbers. Define the sequences $u_{0}, \ldots, u_{n}$ and $v_{0}, \ldots, v_{n}$ inductively by $u_{0}=u_{1}=v_{0}=v_{1}=1$, and

$$
u_{k+1}=u_{k}+a_{k} u_{k-1}, \quad v_{k+1}=v_{k}+a_{n-k} v_{k-1} \quad \text { for } k=1, \ldots, n-1 .
$$

Prove that $u_{n}=v_{n}$.

(France)

Solution 1. We prove by induction on $k$ that

$$
u_{k}=\sum_{\substack{0<i_{1}<\ldots<i_{t}<k \\ i_{j}+1-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}}
$$

Note that we have one trivial summand equal to 1 (which corresponds to $t=0$ and the empty sequence, whose product is 1 ).

For $k=0,1$ the sum on the right-hand side only contains the empty product, so (1) holds due to $u_{0}=u_{1}=1$. For $k \geqslant 1$, assuming the result is true for $0,1, \ldots, k$, we have

$$
\begin{aligned}
u_{k+1} & =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}}+\sum_{\substack{0<i_{1}<\ldots<i_{t}<k-1, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}} \cdot a_{k} \\
& =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2, k \notin\left\{i_{1}, \ldots, i_{t}\right\}}} a_{i_{1}} \ldots a_{i_{t}}+\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2, k \in\left\{i_{1}, \ldots, i_{t}\right\}}} a_{i_{1}} \ldots a_{i_{t}} \\
& =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}},
\end{aligned}
$$

as required.

Applying (1) to the sequence $b_{1}, \ldots, b_{n}$ given by $b_{k}=a_{n-k}$ for $1 \leqslant k \leqslant n$, we get

$$
v_{k}=\sum_{\substack{0<i_{1}<\ldots<i_{t}<k, i_{j+1}-i_{j} \geqslant 2}} b_{i_{1}} \ldots b_{i_{t}}=\sum_{\substack{n>i_{1}>\ldots>i_{t}>n-k \\ i_{j}-i_{j+1} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}}
$$

For $k=n$ the expressions (1) and (2) coincide, so indeed $u_{n}=v_{n}$.

Solution 2. Define recursively a sequence of multivariate polynomials by

$$
P_{0}=P_{1}=1, \quad P_{k+1}\left(x_{1}, \ldots, x_{k}\right)=P_{k}\left(x_{1}, \ldots, x_{k-1}\right)+x_{k} P_{k-1}\left(x_{1}, \ldots, x_{k-2}\right),
$$

so $P_{n}$ is a polynomial in $n-1$ variables for each $n \geqslant 1$. Two easy inductive arguments show that

$$
u_{n}=P_{n}\left(a_{1}, \ldots, a_{n-1}\right), \quad v_{n}=P_{n}\left(a_{n-1}, \ldots, a_{1}\right)
$$

so we need to prove $P_{n}\left(x_{1}, \ldots, x_{n-1}\right)=P_{n}\left(x_{n-1}, \ldots, x_{1}\right)$ for every positive integer $n$. The cases $n=1,2$ are trivial, and the cases $n=3,4$ follow from $P_{3}(x, y)=1+x+y$ and $P_{4}(x, y, z)=$ $1+x+y+z+x z$.

Now we proceed by induction, assuming that $n \geqslant 5$ and the claim hold for all smaller cases. Using $F(a, b)$ as an abbreviation for $P_{|a-b|+1}\left(x_{a}, \ldots, x_{b}\right)$ (where the indices $a, \ldots, b$ can be either in increasing or decreasing order),

$$
\begin{aligned}
F(n, 1) & =F(n, 2)+x_{1} F(n, 3)=F(2, n)+x_{1} F(3, n) \\
& =\left(F(2, n-1)+x_{n} F(2, n-2)\right)+x_{1}\left(F(3, n-1)+x_{n} F(3, n-2)\right) \\
& =\left(F(n-1,2)+x_{1} F(n-1,3)\right)+x_{n}\left(F(n-2,2)+x_{1} F(n-2,3)\right) \\
& =F(n-1,1)+x_{n} F(n-2,1)=F(1, n-1)+x_{n} F(1, n-2) \\
& =F(1, n),
\end{aligned}
$$

as we wished to show.

Solution 3. Using matrix notation, we can rewrite the recurrence relation as

$$
\left(\begin{array}{c}
u_{k+1} \\
u_{k+1}-u_{k}
\end{array}\right)=\left(\begin{array}{c}
u_{k}+a_{k} u_{k-1} \\
a_{k} u_{k-1}
\end{array}\right)=\left(\begin{array}{cc}
1+a_{k} & -a_{k} \\
a_{k} & -a_{k}
\end{array}\right)\left(\begin{array}{c}
u_{k} \\
u_{k}-u_{k-1}
\end{array}\right)
$$

for $1 \leqslant k \leqslant n-1$, and similarly

$$
\left(v_{k+1} ; v_{k}-v_{k+1}\right)=\left(v_{k}+a_{n-k} v_{k-1} ;-a_{n-k} v_{k-1}\right)=\left(v_{k} ; v_{k-1}-v_{k}\right)\left(\begin{array}{cc}
1+a_{n-k} & -a_{n-k} \\
a_{n-k} & -a_{n-k}
\end{array}\right)
$$

for $1 \leqslant k \leqslant n-1$. Hence, introducing the $2 \times 2$ matrices $A_{k}=\left(\begin{array}{cc}1+a_{k} & -a_{k} \\ a_{k} & -a_{k}\end{array}\right)$ we have

$$
\left(\begin{array}{c}
u_{k+1} \\
u_{k+1}-u_{k}
\end{array}\right)=A_{k}\left(\begin{array}{c}
u_{k} \\
u_{k}-u_{k-1}
\end{array}\right) \quad \text { and } \quad\left(v_{k+1} ; v_{k}-v_{k+1}\right)=\left(v_{k} ; v_{k-1}-v_{k}\right) A_{n-k} .
$$

for $1 \leqslant k \leqslant n-1$. Since $\left(\begin{array}{c}u_{1} \\ u_{1}-u_{0}\end{array}\right)=\left(\begin{array}{l}1 \\ 0\end{array}\right)$ and $\left(v_{1} ; v_{0}-v_{1}\right)=(1 ; 0)$, we get

$$
\left(\begin{array}{c}
u_{n} \\
u_{n}-u_{n-1}
\end{array}\right)=A_{n-1} A_{n-2} \cdots A_{1} \cdot\left(\begin{array}{l}
1 \\
0
\end{array}\right) \quad \text { and } \quad\left(v_{n} ; v_{n-1}-v_{n}\right)=(1 ; 0) \cdot A_{n-1} A_{n-2} \cdots A_{1} \text {. }
$$

It follows that

$$
\left(u_{n}\right)=(1 ; 0)\left(\begin{array}{c}
u_{n} \\
u_{n}-u_{n-1}
\end{array}\right)=(1 ; 0) \cdot A_{n-1} A_{n-2} \cdots A_{1} \cdot\left(\begin{array}{l}
1 \\
0
\end{array}\right)=\left(v_{n} ; v_{n-1}-v_{n}\right)\left(\begin{array}{l}
1 \\
0
\end{array}\right)=\left(v_{n}\right) .
$$

Comment 1. These sequences are related to the Fibonacci sequence; when $a_{1}=\cdots=a_{n-1}=1$, we have $u_{k}=v_{k}=F_{k+1}$, the $(k+1)$ st Fibonacci number. Also, for every positive integer $k$, the polynomial $P_{k}\left(x_{1}, \ldots, x_{k-1}\right)$ from Solution 2 is the sum of $F_{k+1}$ monomials.

Comment 2. One may notice that the condition is equivalent to

$$
\frac{u_{k+1}}{u_{k}}=1+\frac{a_{k}}{1+\frac{a_{k-1}}{1+\ldots+\frac{a_{2}}{1+a_{1}}}} \quad \text { and } \quad \frac{v_{k+1}}{v_{k}}=1+\frac{a_{n-k}}{1+\frac{a_{n-k+1}}{1+\ldots+\frac{a_{n-2}}{1+a_{n-1}}}}
$$

so the problem claims that the corresponding continued fractions for $u_{n} / u_{n-1}$ and $v_{n} / v_{n-1}$ have the same numerator.

Comment 3. An alternative variant of the problem is the following.

Let $n$ be a positive integer and let $a_{1}, \ldots, a_{n-1}$ be arbitrary real numbers. Define the sequences $u_{0}, \ldots, u_{n}$ and $v_{0}, \ldots, v_{n}$ inductively by $u_{0}=v_{0}=0, u_{1}=v_{1}=1$, and

$$
u_{k+1}=a_{k} u_{k}+u_{k-1}, \quad v_{k+1}=a_{n-k} v_{k}+v_{k-1} \quad \text { for } k=1, \ldots, n-1
$$

Prove that $u_{n}=v_{n}$.

All three solutions above can be reformulated to prove this statement; one may prove

$$
u_{n}=v_{n}=\sum_{\substack{0=i_{0}<i_{1}<\ldots<i_{t}=n, i_{j+1}-i_{j} \text { is odd }}} a_{i_{1}} \ldots a_{i_{t-1}} \quad \text { for } n>0
$$

or observe that

$$
\left(\begin{array}{c}
u_{k+1} \\
u_{k}
\end{array}\right)=\left(\begin{array}{cc}
a_{k} & 1 \\
1 & 0
\end{array}\right)\left(\begin{array}{c}
u_{k} \\
u_{k-1}
\end{array}\right) \quad \text { and } \quad\left(v_{k+1} ; v_{k}\right)=\left(v_{k} ; v_{k-1}\right)\left(\begin{array}{cc}
a_{k} & 1 \\
1 & 0
\end{array}\right) .
$$

Here we have

$$
\frac{u_{k+1}}{u_{k}}=a_{k}+\frac{1}{a_{k-1}+\frac{1}{a_{k-2}+\ldots+\frac{1}{a_{1}}}}=\left[a_{k} ; a_{k-1}, \ldots, a_{1}\right]
$$

and

$$
\frac{v_{k+1}}{v_{k}}=a_{n-k}+\frac{1}{a_{n-k+1}+\frac{1}{a_{n-k+2}+\ldots+\frac{1}{a_{n-1}}}}=\left[a_{n-k} ; a_{n-k+1}, \ldots, a_{n-1}\right]
$$

so this alternative statement is equivalent to the known fact that the continued fractions $\left[a_{n-1} ; a_{n-2}, \ldots, a_{1}\right]$ and $\left[a_{1} ; a_{2}, \ldots, a_{n-1}\right]$ have the same numerator.

A2. Prove that in any set of 2000 distinct real numbers there exist two pairs $a>b$ and $c>d$ with $a \neq c$ or $b \neq d$, such that

$$
\left|\frac{a-b}{c-d}-1\right|<\frac{1}{100000}
$$

(Lithuania)

Solution. For any set $S$ of $n=2000$ distinct real numbers, let $D_{1} \leqslant D_{2} \leqslant \cdots \leqslant D_{m}$ be the distances between them, displayed with their multiplicities. Here $m=n(n-1) / 2$. By rescaling the numbers, we may assume that the smallest distance $D_{1}$ between two elements of $S$ is $D_{1}=1$. Let $D_{1}=1=y-x$ for $x, y \in S$. Evidently $D_{m}=v-u$ is the difference between the largest element $v$ and the smallest element $u$ of $S$.

If $D_{i+1} / D_{i}<1+10^{-5}$ for some $i=1,2, \ldots, m-1$ then the required inequality holds, because $0 \leqslant D_{i+1} / D_{i}-1<10^{-5}$. Otherwise, the reverse inequality

$$
\frac{D_{i+1}}{D_{i}} \geqslant 1+\frac{1}{10^{5}}
$$

holds for each $i=1,2, \ldots, m-1$, and therefore

$$
v-u=D_{m}=\frac{D_{m}}{D_{1}}=\frac{D_{m}}{D_{m-1}} \cdots \frac{D_{3}}{D_{2}} \cdot \frac{D_{2}}{D_{1}} \geqslant\left(1+\frac{1}{10^{5}}\right)^{m-1} .
$$

From $m-1=n(n-1) / 2-1=1000 \cdot 1999-1>19 \cdot 10^{5}$, together with the fact that for all $n \geqslant 1$, $\left(1+\frac{1}{n}\right)^{n} \geqslant 1+\left(\begin{array}{l}n \\ 1\end{array}\right) \cdot \frac{1}{n}=2$, we get

$$
\left(1+\frac{1}{10^{5}}\right)^{19 \cdot 10^{5}}=\left(\left(1+\frac{1}{10^{5}}\right)^{10^{5}}\right)^{19} \geqslant 2^{19}=2^{9} \cdot 2^{10}>500 \cdot 1000>2 \cdot 10^{5},
$$

and so $v-u=D_{m}>2 \cdot 10^{5}$.

Since the distance of $x$ to at least one of the numbers $u, v$ is at least $(u-v) / 2>10^{5}$, we have

$$
|x-z|>10^{5} .
$$

for some $z \in\{u, v\}$. Since $y-x=1$, we have either $z>y>x$ (if $z=v$ ) or $y>x>z$ (if $z=u$ ). If $z>y>x$, selecting $a=z, b=y, c=z$ and $d=x$ (so that $b \neq d$ ), we obtain

$$
\left|\frac{a-b}{c-d}-1\right|=\left|\frac{z-y}{z-x}-1\right|=\left|\frac{x-y}{z-x}\right|=\frac{1}{z-x}<10^{-5} .
$$

Otherwise, if $y>x>z$, we may choose $a=y, b=z, c=x$ and $d=z$ (so that $a \neq c$ ), and obtain

$$
\left|\frac{a-b}{c-d}-1\right|=\left|\frac{y-z}{x-z}-1\right|=\left|\frac{y-x}{x-z}\right|=\frac{1}{x-z}<10^{-5}
$$

The desired result follows.

Comment. As the solution shows, the numbers 2000 and $\frac{1}{100000}$ appearing in the statement of the problem may be replaced by any $n \in \mathbb{Z}_{>0}$ and $\delta>0$ satisfying

$$
\delta(1+\delta)^{n(n-1) / 2-1}>2
$$

A3. Let $\mathbb{Q}_{>0}$ be the set of positive rational numbers. Let $f: \mathbb{Q}_{>0} \rightarrow \mathbb{R}$ be a function satisfying the conditions

$$
\begin{aligned}
& f(x) f(y) \geqslant f(x y) \\
& f(x+y) \geqslant f(x)+f(y)
\end{aligned}
$$

for all $x, y \in \mathbb{Q}_{>0}$. Given that $f(a)=a$ for some rational $a>1$, prove that $f(x)=x$ for all $x \in \mathbb{Q}_{>0}$.

(Bulgaria)

Solution. Denote by $\mathbb{Z}_{>0}$ the set of positive integers.

Plugging $x=1, y=a$ into (1) we get $f(1) \geqslant 1$. Next, by an easy induction on $n$ we get from (2) that

$$
f(n x) \geqslant n f(x) \text { for all } n \in \mathbb{Z}_{>0} \text { and } x \in \mathbb{Q}_{>0}
$$

In particular, we have

$$
f(n) \geqslant n f(1) \geqslant n \quad \text { for all } n \in \mathbb{Z}_{>0}
$$

From (1) again we have $f(m / n) f(n) \geqslant f(m)$, so $f(q)>0$ for all $q \in \mathbb{Q}_{>0}$.

Now, (2) implies that $f$ is strictly increasing; this fact together with (4) yields

$$
f(x) \geqslant f(\lfloor x\rfloor) \geqslant\lfloor x\rfloor>x-1 \quad \text { for all } x \geqslant 1
$$

By an easy induction we get from (1) that $f(x)^{n} \geqslant f\left(x^{n}\right)$, so

$$
f(x)^{n} \geqslant f\left(x^{n}\right)>x^{n}-1 \quad \Longrightarrow \quad f(x) \geqslant \sqrt[n]{x^{n}-1} \text { for all } x>1 \text { and } n \in \mathbb{Z}_{>0}
$$

This yields

$$
f(x) \geqslant x \text { for every } x>1 \text {. }
$$

(Indeed, if $x>y>1$ then $x^{n}-y^{n}=(x-y)\left(x^{n-1}+x^{n-2} y+\cdots+y^{n}\right)>n(x-y)$, so for a large $n$ we have $x^{n}-1>y^{n}$ and thus $f(x)>y$.)

Now, (1) and (5) give $a^{n}=f(a)^{n} \geqslant f\left(a^{n}\right) \geqslant a^{n}$, so $f\left(a^{n}\right)=a^{n}$. Now, for $x>1$ let us choose $n \in \mathbb{Z}_{>0}$ such that $a^{n}-x>1$. Then by (2) and (5) we get

$$
a^{n}=f\left(a^{n}\right) \geqslant f(x)+f\left(a^{n}-x\right) \geqslant x+\left(a^{n}-x\right)=a^{n}
$$

and therefore $f(x)=x$ for $x>1$. Finally, for every $x \in \mathbb{Q}_{>0}$ and every $n \in \mathbb{Z}_{>0}$, from (1) and (3) we get

$$
n f(x)=f(n) f(x) \geqslant f(n x) \geqslant n f(x)
$$

which gives $f(n x)=n f(x)$. Therefore $f(m / n)=f(m) / n=m / n$ for all $m, n \in \mathbb{Z}_{>0}$.

Comment. The condition $f(a)=a>1$ is essential. Indeed, for $b \geqslant 1$ the function $f(x)=b x^{2}$ satisfies (1) and (2) for all $x, y \in \mathbb{Q}_{>0}$, and it has a unique fixed point $1 / b \leqslant 1$.

A4. Let $n$ be a positive integer, and consider a sequence $a_{1}, a_{2}, \ldots, a_{n}$ of positive integers. Extend it periodically to an infinite sequence $a_{1}, a_{2}, \ldots$ by defining $a_{n+i}=a_{i}$ for all $i \geqslant 1$. If

$$
a_{1} \leqslant a_{2} \leqslant \cdots \leqslant a_{n} \leqslant a_{1}+n
$$

and

$$
a_{a_{i}} \leqslant n+i-1 \quad \text { for } i=1,2, \ldots, n
$$

prove that

$$
a_{1}+\cdots+a_{n} \leqslant n^{2} .
$$

(Germany)

Solution 1. First, we claim that

$$
a_{i} \leqslant n+i-1 \quad \text { for } i=1,2, \ldots, n \text {. }
$$

Assume contrariwise that $i$ is the smallest counterexample. From $a_{n} \geqslant a_{n-1} \geqslant \cdots \geqslant a_{i} \geqslant n+i$ and $a_{a_{i}} \leqslant n+i-1$, taking into account the periodicity of our sequence, it follows that

$$
a_{i} \text { cannot be congruent to } i, i+1, \ldots, n-1 \text {, or } n(\bmod n) \text {. }
$$

Thus our assumption that $a_{i} \geqslant n+i$ implies the stronger statement that $a_{i} \geqslant 2 n+1$, which by $a_{1}+n \geqslant a_{n} \geqslant a_{i}$ gives $a_{1} \geqslant n+1$. The minimality of $i$ then yields $i=1$, and (4) becomes contradictory. This establishes our first claim.

In particular we now know that $a_{1} \leqslant n$. If $a_{n} \leqslant n$, then $a_{1} \leqslant \cdots \leqslant \cdots a_{n} \leqslant n$ and the desired inequality holds trivially. Otherwise, consider the number $t$ with $1 \leqslant t \leqslant n-1$ such that

$$
a_{1} \leqslant a_{2} \leqslant \ldots \leqslant a_{t} \leqslant n<a_{t+1} \leqslant \ldots \leqslant a_{n}
$$

Since $1 \leqslant a_{1} \leqslant n$ and $a_{a_{1}} \leqslant n$ by (2), we have $a_{1} \leqslant t$ and hence $a_{n} \leqslant n+t$. Therefore if for each positive integer $i$ we let $b_{i}$ be the number of indices $j \in\{t+1, \ldots, n\}$ satisfying $a_{j} \geqslant n+i$, we have

$$
b_{1} \geqslant b_{2} \geqslant \ldots \geqslant b_{t} \geqslant b_{t+1}=0
$$

Next we claim that $a_{i}+b_{i} \leqslant n$ for $1 \leqslant i \leqslant t$. Indeed, by $n+i-1 \geqslant a_{a_{i}}$ and $a_{i} \leqslant n$, each $j$ with $a_{j} \geqslant n+i$ (thus $a_{j}>a_{a_{i}}$ ) belongs to $\left\{a_{i}+1, \ldots, n\right\}$, and for this reason $b_{i} \leqslant n-a_{i}$.

It follows from the definition of the $b_{i} \mathrm{~s}$ and (5) that

$$
a_{t+1}+\ldots+a_{n} \leqslant n(n-t)+b_{1}+\ldots+b_{t} .
$$

Adding $a_{1}+\ldots+a_{t}$ to both sides and using that $a_{i}+b_{i} \leqslant n$ for $1 \leqslant i \leqslant t$, we get

$$
a_{1}+a_{2}+\cdots+a_{n} \leqslant n(n-t)+n t=n^{2}
$$

as we wished to prove.

Solution 2. In the first quadrant of an infinite grid, consider the increasing "staircase" obtained by shading in dark the bottom $a_{i}$ cells of the $i$ th column for $1 \leqslant i \leqslant n$. We will prove that there are at most $n^{2}$ dark cells.

To do it, consider the $n \times n$ square $S$ in the first quadrant with a vertex at the origin. Also consider the $n \times n$ square directly to the left of $S$. Starting from its lower left corner, shade in light the leftmost $a_{j}$ cells of the $j$ th row for $1 \leqslant j \leqslant n$. Equivalently, the light shading is obtained by reflecting the dark shading across the line $x=y$ and translating it $n$ units to the left. The figure below illustrates this construction for the sequence $6,6,6,7,7,7,8,12,12,14$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-14.jpg?height=650&width=1052&top_left_y=667&top_left_x=534)

We claim that there is no cell in $S$ which is both dark and light. Assume, contrariwise, that there is such a cell in column $i$. Consider the highest dark cell in column $i$ which is inside $S$. Since it is above a light cell and inside $S$, it must be light as well. There are two cases:

Case 1. $a_{i} \leqslant n$

If $a_{i} \leqslant n$ then this dark and light cell is $\left(i, a_{i}\right)$, as highlighted in the figure. However, this is the $(n+i)$-th cell in row $a_{i}$, and we only shaded $a_{a_{i}}<n+i$ light cells in that row, a contradiction.

Case 2. $a_{i} \geqslant n+1$

If $a_{i} \geqslant n+1$, this dark and light cell is $(i, n)$. This is the $(n+i)$-th cell in row $n$ and we shaded $a_{n} \leqslant a_{1}+n$ light cells in this row, so we must have $i \leqslant a_{1}$. But $a_{1} \leqslant a_{a_{1}} \leqslant n$ by (1) and (2), so $i \leqslant a_{1}$ implies $a_{i} \leqslant a_{a_{1}} \leqslant n$, contradicting our assumption.

We conclude that there are no cells in $S$ which are both dark and light. It follows that the number of shaded cells in $S$ is at most $n^{2}$.

Finally, observe that if we had a light cell to the right of $S$, then by symmetry we would have a dark cell above $S$, and then the cell $(n, n)$ would be dark and light. It follows that the number of light cells in $S$ equals the number of dark cells outside of $S$, and therefore the number of shaded cells in $S$ equals $a_{1}+\cdots+a_{n}$. The desired result follows.

Solution 3. As in Solution 1, we first establish that $a_{i} \leqslant n+i-1$ for $1 \leqslant i \leqslant n$. Now define $c_{i}=\max \left(a_{i}, i\right)$ for $1 \leqslant i \leqslant n$ and extend the sequence $c_{1}, c_{2}, \ldots$ periodically modulo $n$. We claim that this sequence also satisfies the conditions of the problem.

For $1 \leqslant i<j \leqslant n$ we have $a_{i} \leqslant a_{j}$ and $i<j$, so $c_{i} \leqslant c_{j}$. Also $a_{n} \leqslant a_{1}+n$ and $n<1+n$ imply $c_{n} \leqslant c_{1}+n$. Finally, the definitions imply that $c_{c_{i}} \in\left\{a_{a_{i}}, a_{i}, a_{i}-n, i\right\}$ so $c_{c_{i}} \leqslant n+i-1$ by (2) and (3). This establishes (1) and (2) for $c_{1}, c_{2}, \ldots$.

Our new sequence has the additional property that

$$
c_{i} \geqslant i \quad \text { for } i=1,2, \ldots, n
$$

which allows us to construct the following visualization: Consider $n$ equally spaced points on a circle, sequentially labelled $1,2, \ldots, n(\bmod n)$, so point $k$ is also labelled $n+k$. We draw arrows from vertex $i$ to vertices $i+1, \ldots, c_{i}$ for $1 \leqslant i \leqslant n$, keeping in mind that $c_{i} \geqslant i$ by (6). Since $c_{i} \leqslant n+i-1$ by (3), no arrow will be drawn twice, and there is no arrow from a vertex to itself. The total number of arrows is

$$
\text { number of arrows }=\sum_{i=1}^{n}\left(c_{i}-i\right)=\sum_{i=1}^{n} c_{i}-\left(\begin{array}{c}
n+1 \\
2
\end{array}\right)
$$

Now we show that we never draw both arrows $i \rightarrow j$ and $j \rightarrow i$ for $1 \leqslant i<j \leqslant n$. Assume contrariwise. This means, respectively, that

$$
i<j \leqslant c_{i} \quad \text { and } \quad j<n+i \leqslant c_{j} \text {. }
$$

We have $n+i \leqslant c_{j} \leqslant c_{1}+n$ by (1), so $i \leqslant c_{1}$. Since $c_{1} \leqslant n$ by (3), this implies that $c_{i} \leqslant c_{c_{1}} \leqslant n$ using (1) and (3). But then, using (1) again, $j \leqslant c_{i} \leqslant n$ implies $c_{j} \leqslant c_{c_{i}}$, which combined with $n+i \leqslant c_{j}$ gives us that $n+i \leqslant c_{c_{i}}$. This contradicts (2).

This means that the number of arrows is at most $\left(\begin{array}{l}n \\ 2\end{array}\right)$, which implies that

$$
\sum_{i=1}^{n} c_{i} \leqslant\left(\begin{array}{l}
n \\
2
\end{array}\right)+\left(\begin{array}{c}
n+1 \\
2
\end{array}\right)=n^{2}
$$

Recalling that $a_{i} \leqslant c_{i}$ for $1 \leqslant i \leqslant n$, the desired inequality follows.

Comment 1. We sketch an alternative proof by induction. Begin by verifying the initial case $n=1$ and the simple cases when $a_{1}=1, a_{1}=n$, or $a_{n} \leqslant n$. Then, as in Solution 1 , consider the index $t$ such that $a_{1} \leqslant \cdots \leqslant a_{t} \leqslant n<a_{t+1} \leqslant \cdots \leqslant a_{n}$. Observe again that $a_{1} \leqslant t$. Define the sequence $d_{1}, \ldots, d_{n-1}$ by

$$
d_{i}= \begin{cases}a_{i+1}-1 & \text { if } i \leqslant t-1 \\ a_{i+1}-2 & \text { if } i \geqslant t\end{cases}
$$

and extend it periodically modulo $n-1$. One may verify that this sequence also satisfies the hypotheses of the problem. The induction hypothesis then gives $d_{1}+\cdots+d_{n-1} \leqslant(n-1)^{2}$, which implies that

$$
\sum_{i=1}^{n} a_{i}=a_{1}+\sum_{i=2}^{t}\left(d_{i-1}+1\right)+\sum_{i=t+1}^{n}\left(d_{i-1}+2\right) \leqslant t+(t-1)+2(n-t)+(n-1)^{2}=n^{2}
$$

Comment 2. One unusual feature of this problem is that there are many different sequences for which equality holds. The discovery of such optimal sequences is not difficult, and it is useful in guiding the steps of a proof.

In fact, Solution 2 gives a complete description of the optimal sequences. Start with any lattice path $P$ from the lower left to the upper right corner of the $n \times n$ square $S$ using only steps up and right, such that the total number of steps along the left and top edges of $S$ is at least $n$. Shade the cells of $S$ below $P$ dark, and the cells of $S$ above $P$ light. Now reflect the light shape across the line $x=y$ and shift it up $n$ units, and shade it dark. As Solution 2 shows, the dark region will then correspond to an optimal sequence, and every optimal sequence arises in this way.

A5. Let $\mathbb{Z}_{\geqslant 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\geqslant 0} \rightarrow \mathbb{Z}_{\geqslant 0}$ satisfying the relation

$$
f(f(f(n)))=f(n+1)+1
$$

for all $n \in \mathbb{Z}_{\geqslant 0}$.

(Serbia)

Answer. There are two such functions: $f(n)=n+1$ for all $n \in \mathbb{Z}_{\geqslant 0}$, and

$$
f(n)=\left\{\begin{array}{ll}
n+1, & n \equiv 0(\bmod 4) \text { or } n \equiv 2(\bmod 4), \\
n+5, & n \equiv 1(\bmod 4), \\
n-3, & n \equiv 3(\bmod 4)
\end{array} \quad \text { for all } n \in \mathbb{Z}_{\geqslant 0}\right.
$$

Throughout all the solutions, we write $h^{k}(x)$ to abbreviate the $k$ th iteration of function $h$, so $h^{0}$ is the identity function, and $h^{k}(x)=\underbrace{h(\ldots h}_{k \text { times }}(x) \ldots))$ for $k \geqslant 1$.

Solution 1. To start, we get from (*) that

$$
f^{4}(n)=f\left(f^{3}(n)\right)=f(f(n+1)+1) \quad \text { and } \quad f^{4}(n+1)=f^{3}(f(n+1))=f(f(n+1)+1)+1
$$

thus

$$
f^{4}(n)+1=f^{4}(n+1) .
$$

I. Let us denote by $R_{i}$ the range of $f^{i}$; note that $R_{0}=\mathbb{Z}_{\geqslant 0}$ since $f^{0}$ is the identity function. Obviously, $R_{0} \supseteq R_{1} \supseteq \ldots$ Next, from (2) we get that if $a \in R_{4}$ then also $a+1 \in R_{4}$. This implies that $\mathbb{Z}_{\geqslant 0} \backslash R_{4}$ - and hence $\mathbb{Z}_{\geqslant 0} \backslash R_{1}$ - is finite. In particular, $R_{1}$ is unbounded.

Assume that $f(m)=f(n)$ for some distinct $m$ and $n$. Then from $(*)$ we obtain $f(m+1)=$ $f(n+1)$; by an easy induction we then get that $f(m+c)=f(n+c)$ for every $c \geqslant 0$. So the function $f(k)$ is periodic with period $|m-n|$ for $k \geqslant m$, and thus $R_{1}$ should be bounded, which is false. So, $f$ is injective.

II. Denote now $S_{i}=R_{i-1} \backslash R_{i}$; all these sets are finite for $i \leqslant 4$. On the other hand, by the injectivity we have $n \in S_{i} \Longleftrightarrow f(n) \in S_{i+1}$. By the injectivity again, $f$ implements a bijection between $S_{i}$ and $S_{i+1}$, thus $\left|S_{1}\right|=\left|S_{2}\right|=\ldots$; denote this common cardinality by $k$. If $0 \in R_{3}$ then $0=f(f(f(n)))$ for some $n$, thus from (*) we get $f(n+1)=-1$ which is impossible. Therefore $0 \in R_{0} \backslash R_{3}=S_{1} \cup S_{2} \cup S_{3}$, thus $k \geqslant 1$.

Next, let us describe the elements $b$ of $R_{0} \backslash R_{3}=S_{1} \cup S_{2} \cup S_{3}$. We claim that each such element satisfies at least one of three conditions $(i) b=0,(i i) b=f(0)+1$, and (iii) $b-1 \in S_{1}$. Otherwise $b-1 \in \mathbb{Z}_{\geqslant 0}$, and there exists some $n>0$ such that $f(n)=b-1$; but then $f^{3}(n-1)=f(n)+1=b$, so $b \in R_{3}$.

This yields

$$
3 k=\left|S_{1} \cup S_{2} \cup S_{3}\right| \leqslant 1+1+\left|S_{1}\right|=k+2,
$$

or $k \leqslant 1$. Therefore $k=1$, and the inequality above comes to equality. So we have $S_{1}=\{a\}$, $S_{2}=\{f(a)\}$, and $S_{3}=\left\{f^{2}(a)\right\}$ for some $a \in \mathbb{Z}_{\geqslant 0}$, and each one of the three options (i), (ii), and (iii) should be realized exactly once, which means that

$$
\left\{a, f(a), f^{2}(a)\right\}=\{0, a+1, f(0)+1\} .
$$

III. From (3), we get $a+1 \in\left\{f(a), f^{2}(a)\right\}$ (the case $a+1=a$ is impossible). If $a+1=f^{2}(a)$ then we have $f(a+1)=f^{3}(a)=f(a+1)+1$ which is absurd. Therefore

$$
f(a)=a+1
$$

Next, again from (3) we have $0 \in\left\{a, f^{2}(a)\right\}$. Let us consider these two cases separately. Case 1. Assume that $a=0$, then $f(0)=f(a)=a+1=1$. Also from (3) we get $f(1)=f^{2}(a)=$ $f(0)+1=2$. Now, let us show that $f(n)=n+1$ by induction on $n$; the base cases $n \leqslant 1$ are established. Next, if $n \geqslant 2$ then the induction hypothesis implies

$$
n+1=f(n-1)+1=f^{3}(n-2)=f^{2}(n-1)=f(n),
$$

establishing the step. In this case we have obtained the first of two answers; checking that is satisfies (*) is straightforward.

Case 2. Assume now that $f^{2}(a)=0$; then by (3) we get $a=f(0)+1$. By (4) we get $f(a+1)=$ $f^{2}(a)=0$, then $f(0)=f^{3}(a)=f(a+1)+1=1$, hence $a=f(0)+1=2$ and $f(2)=3$ by (4). To summarize,

$$
f(0)=1, \quad f(2)=3, \quad f(3)=0 .
$$

Now let us prove by induction on $m$ that (1) holds for all $n=4 k, 4 k+2,4 k+3$ with $k \leqslant m$ and for all $n=4 k+1$ with $k<m$. The base case $m=0$ is established above. For the step, assume that $m \geqslant 1$. From (*) we get $f^{3}(4 m-3)=f(4 m-2)+1=4 m$. Next, by (2) we have

$$
f(4 m)=f^{4}(4 m-3)=f^{4}(4 m-4)+1=f^{3}(4 m-3)+1=4 m+1 .
$$

Then by the induction hypothesis together with (*) we successively obtain

$$
\begin{aligned}
& f(4 m-3)=f^{3}(4 m-1)=f(4 m)+1=4 m+2, \\
& f(4 m+2)=f^{3}(4 m-4)=f(4 m-3)+1=4 m+3, \\
& f(4 m+3)=f^{3}(4 m-3)=f(4 m-2)+1=4 m,
\end{aligned}
$$

thus finishing the induction step.

Finally, it is straightforward to check that the constructed function works:

$$
\begin{aligned}
& f^{3}(4 k)=4 k+7=f(4 k+1)+1, \quad f^{3}(4 k+1)=4 k+4=f(4 k+2)+1, \\
& f^{3}(4 k+2)=4 k+1=f(4 k+3)+1, \quad f^{3}(4 k+3)=4 k+6=f(4 k+4)+1 .
\end{aligned}
$$

Solution 2. I. For convenience, let us introduce the function $g(n)=f(n)+1$. Substituting $f(n)$ instead of $n$ into (*) we obtain

$$
f^{4}(n)=f(f(n)+1)+1, \quad \text { or } \quad f^{4}(n)=g^{2}(n) .
$$

Applying $f$ to both parts of (*) and using (5) we get

$$
f^{4}(n)+1=f(f(n+1)+1)+1=f^{4}(n+1) .
$$

Thus, if $g^{2}(0)=f^{4}(0)=c$ then an easy induction on $n$ shows that

$$
g^{2}(n)=f^{4}(n)=n+c, \quad n \in \mathbb{Z}_{\geqslant 0}
$$

This relation implies that both $f$ and $g$ are injective: if, say, $f(m)=f(n)$ then $m+c=$ $f^{4}(m)=f^{4}(n)=n+c$. Next, since $g(n) \geqslant 1$ for every $n$, we have $c=g^{2}(0) \geqslant 1$. Thus from (7) again we obtain $f(n) \neq n$ and $g(n) \neq n$ for all $n \in \mathbb{Z}_{\geqslant 0}$.

II. Next, application of $f$ and $g$ to (7) yields

$$
f(n+c)=f^{5}(n)=f^{4}(f(n))=f(n)+c \quad \text { and } \quad g(n+c)=g^{3}(n)=g(n)+c \text {. }
$$

In particular, this means that if $m \equiv n(\bmod c)$ then $f(m) \equiv f(n)(\bmod c)$. Conversely, if $f(m) \equiv f(n)(\bmod c)$ then we get $m+c=f^{4}(m) \equiv f^{4}(n)=n+c(\bmod c)$. Thus,

$$
m \equiv n \quad(\bmod c) \Longleftrightarrow f(m) \equiv f(n) \quad(\bmod c) \Longleftrightarrow g(m) \equiv g(n) \quad(\bmod c)
$$

Now, let us introduce the function $\delta(n)=f(n)-n=g(n)-n-1$. Set

$$
S=\sum_{n=0}^{c-1} \delta(n)
$$

Using (8), we get that for every complete residue system $n_{1}, \ldots, n_{c}$ modulo $c$ we also have

$$
S=\sum_{i=1}^{c} \delta\left(n_{i}\right)
$$

By (9), we get that $\left\{f^{k}(n): n=0, \ldots, c-1\right\}$ and $\left\{g^{k}(n): n=0, \ldots, c-1\right\}$ are complete residue systems modulo $c$ for all $k$. Thus we have

$$
c^{2}=\sum_{n=0}^{c-1}\left(f^{4}(n)-n\right)=\sum_{k=0}^{3} \sum_{n=0}^{c-1}\left(f^{k+1}(n)-f^{k}(n)\right)=\sum_{k=0}^{3} \sum_{n=0}^{c-1} \delta\left(f^{k}(n)\right)=4 S
$$

and similarly

$$
c^{2}=\sum_{n=0}^{c-1}\left(g^{2}(n)-n\right)=\sum_{k=0}^{1} \sum_{n=0}^{c-1}\left(g^{k+1}(n)-g^{k}(n)\right)=\sum_{k=0}^{1} \sum_{n=0}^{c-1}\left(\delta\left(g^{k}(n)\right)+1\right)=2 S+2 c .
$$

Therefore $c^{2}=4 S=2 \cdot 2 S=2\left(c^{2}-2 c\right)$, or $c^{2}=4 c$. Since $c \neq 0$, we get $c=4$. Thus, in view of (8) it is sufficient to determine the values of $f$ on the numbers $0,1,2,3$.

III. Let $d=g(0) \geqslant 1$. Then $g(d)=g^{2}(0)=0+c=4$. Now, if $d \geqslant 4$, then we would have $g(d-4)=g(d)-4=0$ which is impossible. Thus $d \in\{1,2,3\}$. If $d=1$ then we have $f(0)=g(0)-1=0$ which is impossible since $f(n) \neq n$ for all $n$. If $d=3$ then $g(3)=g^{2}(0)=4$ and hence $f(3)=3$ which is also impossible. Thus $g(0)=2$ and hence $g(2)=g^{2}(0)=4$.

Next, if $g(1)=1+4 k$ for some integer $k$, then $5=g^{2}(1)=g(1+4 k)=g(1)+4 k=1+8 k$ which is impossible. Thus, since $\{g(n): n=0,1,2,3\}$ is a complete residue system modulo 4 , we get $g(1)=3+4 k$ and hence $g(3)=g^{2}(1)-4 k=5-4 k$, leading to $k=0$ or $k=1$. So, we obtain iether

$$
f(0)=1, f(1)=2, f(2)=3, f(3)=4, \quad \text { or } \quad f(0)=1, f(1)=6, f(2)=3, f(3)=0
$$

thus arriving to the two functions listed in the answer.

Finally, one can check that these two function work as in Solution 1. One may simplify the checking by noticing that (8) allows us to reduce it to $n=0,1,2,3$.

A6. Let $m \neq 0$ be an integer. Find all polynomials $P(x)$ with real coefficients such that

$$
\left(x^{3}-m x^{2}+1\right) P(x+1)+\left(x^{3}+m x^{2}+1\right) P(x-1)=2\left(x^{3}-m x+1\right) P(x)
$$

for all real numbers $x$.

(Serbia)

Answer. $P(x)=t x$ for any real number $t$.

Solution. Let $P(x)=a_{n} x^{n}+\cdots+a_{0} x^{0}$ with $a_{n} \neq 0$. Comparing the coefficients of $x^{n+1}$ on both sides gives $a_{n}(n-2 m)(n-1)=0$, so $n=1$ or $n=2 m$.

If $n=1$, one easily verifies that $P(x)=x$ is a solution, while $P(x)=1$ is not. Since the given condition is linear in $P$, this means that the linear solutions are precisely $P(x)=t x$ for $t \in \mathbb{R}$.

Now assume that $n=2 m$. The polynomial $x P(x+1)-(x+1) P(x)=(n-1) a_{n} x^{n}+\cdots$ has degree $n$, and therefore it has at least one (possibly complex) root $r$. If $r \notin\{0,-1\}$, define $k=P(r) / r=P(r+1) /(r+1)$. If $r=0$, let $k=P(1)$. If $r=-1$, let $k=-P(-1)$. We now consider the polynomial $S(x)=P(x)-k x$. It also satisfies (1) because $P(x)$ and $k x$ satisfy it. Additionally, it has the useful property that $r$ and $r+1$ are roots.

Let $A(x)=x^{3}-m x^{2}+1$ and $B(x)=x^{3}+m x^{2}+1$. Plugging in $x=s$ into (1) implies that:

If $s-1$ and $s$ are roots of $S$ and $s$ is not a root of $A$, then $s+1$ is a root of $S$.

If $s$ and $s+1$ are roots of $S$ and $s$ is not a root of $B$, then $s-1$ is a root of $S$.

Let $a \geqslant 0$ and $b \geqslant 1$ be such that $r-a, r-a+1, \ldots, r, r+1, \ldots, r+b-1, r+b$ are roots of $S$, while $r-a-1$ and $r+b+1$ are not. The two statements above imply that $r-a$ is a root of $B$ and $r+b$ is a root of $A$.

Since $r-a$ is a root of $B(x)$ and of $A(x+a+b)$, it is also a root of their greatest common divisor $C(x)$ as integer polynomials. If $C(x)$ was a non-trivial divisor of $B(x)$, then $B$ would have a rational root $\alpha$. Since the first and last coefficients of $B$ are $1, \alpha$ can only be 1 or -1 ; but $B(-1)=m>0$ and $B(1)=m+2>0$ since $n=2 m$.

Therefore $B(x)=A(x+a+b)$. Writing $c=a+b \geqslant 1$ we compute

$$
0=A(x+c)-B(x)=(3 c-2 m) x^{2}+c(3 c-2 m) x+c^{2}(c-m) .
$$

Then we must have $3 c-2 m=c-m=0$, which gives $m=0$, a contradiction. We conclude that $f(x)=t x$ is the only solution.

Solution 2. Multiplying (1) by $x$, we rewrite it as

$$
x\left(x^{3}-m x^{2}+1\right) P(x+1)+x\left(x^{3}+m x^{2}+1\right) P(x-1)=[(x+1)+(x-1)]\left(x^{3}-m x+1\right) P(x) .
$$

After regrouping, it becomes

$$
\left(x^{3}-m x^{2}+1\right) Q(x)=\left(x^{3}+m x^{2}+1\right) Q(x-1) \text {, }
$$

where $Q(x)=x P(x+1)-(x+1) P(x)$. If $\operatorname{deg} P \geqslant 2$ then $\operatorname{deg} Q=\operatorname{deg} P$, so $Q(x)$ has a finite multiset of complex roots, which we denote $R_{Q}$. Each root is taken with its multiplicity. Then the multiset of complex roots of $Q(x-1)$ is $R_{Q}+1=\left\{z+1: z \in R_{Q}\right\}$.

Let $\left\{x_{1}, x_{2}, x_{3}\right\}$ and $\left\{y_{1}, y_{2}, y_{3}\right\}$ be the multisets of roots of the polynomials $A(x)=x^{3}-m x^{2}+1$ and $B(x)=x^{3}+m x^{2}+1$, respectively. From (2) we get the equality of multisets

$$
\left\{x_{1}, x_{2}, x_{3}\right\} \cup R_{Q}=\left\{y_{1}, y_{2}, y_{3}\right\} \cup\left(R_{Q}+1\right) .
$$

For every $r \in R_{Q}$, since $r+1$ is in the set of the right hand side, we must have $r+1 \in R_{Q}$ or $r+1=x_{i}$ for some $i$. Similarly, since $r$ is in the set of the left hand side, either $r-1 \in R_{Q}$ or $r=y_{i}$ for some $i$. This implies that, possibly after relabelling $y_{1}, y_{2}, y_{3}$, all the roots of (2) may be partitioned into three chains of the form $\left\{y_{i}, y_{i}+1, \ldots, y_{i}+k_{i}=x_{i}\right\}$ for $i=1,2,3$ and some integers $k_{1}, k_{2}, k_{3} \geqslant 0$.

Now we analyze the roots of the polynomial $A_{a}(x)=x^{3}+a x^{2}+1$. Using calculus or elementary methods, we find that the local extrema of $A_{a}(x)$ occur at $x=0$ and $x=-2 a / 3$; their values are $A_{a}(0)=1>0$ and $A_{a}(-2 a / 3)=1+4 a^{3} / 27$, which is positive for integers $a \geqslant-1$ and negative for integers $a \leqslant-2$. So when $a \in \mathbb{Z}, A_{a}$ has three real roots if $a \leqslant-2$ and one if $a \geqslant-1$.

Now, since $y_{i}-x_{i} \in \mathbb{Z}$ for $i=1,2,3$, the cubics $A_{m}$ and $A_{-m}$ must have the same number of real roots. The previous analysis then implies that $m=1$ or $m=-1$. Therefore the real root $\alpha$ of $A_{1}(x)=x^{3}+x^{2}+1$ and the real root $\beta$ of $A_{-1}(x)=x^{3}-x^{2}+1$ must differ by an integer. But this is impossible, because $A_{1}\left(-\frac{3}{2}\right)=-\frac{1}{8}$ and $A_{1}(-1)=1$ so $-1.5<\alpha<-1$, while $A_{-1}(-1)=-1$ and $A_{-1}\left(-\frac{1}{2}\right)=\frac{5}{8}$, so $-1<\beta<-0.5$.

It follows that $\operatorname{deg} P \leqslant 1$. Then, as shown in Solution 1, we conclude that the solutions are $P(x)=t x$ for all real numbers $t$.

## Combinatorics

C1. Let $n$ be a positive integer. Find the smallest integer $k$ with the following property: Given any real numbers $a_{1}, \ldots, a_{d}$ such that $a_{1}+a_{2}+\cdots+a_{d}=n$ and $0 \leqslant a_{i} \leqslant 1$ for $i=1,2, \ldots, d$, it is possible to partition these numbers into $k$ groups (some of which may be empty) such that the sum of the numbers in each group is at most 1 .

(Poland)

Answer. $k=2 n-1$.

Solution 1. If $d=2 n-1$ and $a_{1}=\cdots=a_{2 n-1}=n /(2 n-1)$, then each group in such a partition can contain at most one number, since $2 n /(2 n-1)>1$. Therefore $k \geqslant 2 n-1$. It remains to show that a suitable partition into $2 n-1$ groups always exists.

We proceed by induction on $d$. For $d \leqslant 2 n-1$ the result is trivial. If $d \geqslant 2 n$, then since

$$
\left(a_{1}+a_{2}\right)+\ldots+\left(a_{2 n-1}+a_{2 n}\right) \leqslant n
$$

we may find two numbers $a_{i}, a_{i+1}$ such that $a_{i}+a_{i+1} \leqslant 1$. We "merge" these two numbers into one new number $a_{i}+a_{i+1}$. By the induction hypothesis, a suitable partition exists for the $d-1$ numbers $a_{1}, \ldots, a_{i-1}, a_{i}+a_{i+1}, a_{i+2}, \ldots, a_{d}$. This induces a suitable partition for $a_{1}, \ldots, a_{d}$.

Solution 2. We will show that it is even possible to split the sequence $a_{1}, \ldots, a_{d}$ into $2 n-1$ contiguous groups so that the sum of the numbers in each groups does not exceed 1. Consider a segment $S$ of length $n$, and partition it into segments $S_{1}, \ldots, S_{d}$ of lengths $a_{1}, \ldots, a_{d}$, respectively, as shown below. Consider a second partition of $S$ into $n$ equal parts by $n-1$ "empty dots".

| $a_{1}$ | $a_{2}$ | $a_{3}$ | $a_{4}$ | $a_{5}$ | $a_{6}$ | $a_{7}$ | $a_{8}, a_{9}, a_{10}$ |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|  |  |  |  |  |  |  |  |

Assume that the $n-1$ empty dots are in segments $S_{i_{1}}, \ldots, S_{i_{n-1}}$. (If a dot is on the boundary of two segments, we choose the right segment). These $n-1$ segments are distinct because they have length at most 1. Consider the partition:

$$
\left\{a_{1}, \ldots, a_{i_{1}-1}\right\},\left\{a_{i_{1}}\right\},\left\{a_{i_{1}+1}, \ldots, a_{i_{2}-1}\right\},\left\{a_{i_{2}}\right\}, \ldots\left\{a_{i_{n-1}}\right\},\left\{a_{i_{n-1}+1}, \ldots, a_{d}\right\}
$$

In the example above, this partition is $\left\{a_{1}, a_{2}\right\},\left\{a_{3}\right\},\left\{a_{4}, a_{5}\right\},\left\{a_{6}\right\}, \varnothing,\left\{a_{7}\right\},\left\{a_{8}, a_{9}, a_{10}\right\}$. We claim that in this partition, the sum of the numbers in this group is at most 1 .

For the sets $\left\{a_{i_{t}}\right\}$ this is obvious since $a_{i_{t}} \leqslant 1$. For the sets $\left\{a_{i_{t}}+1, \ldots, a_{i_{t+1}-1}\right\}$ this follows from the fact that the corresponding segments lie between two neighboring empty dots, or between an endpoint of $S$ and its nearest empty dot. Therefore the sum of their lengths cannot exceed 1.

Solution 3. First put all numbers greater than $\frac{1}{2}$ in their own groups. Then, form the remaining groups as follows: For each group, add new $a_{i} \mathrm{~S}$ one at a time until their sum exceeds $\frac{1}{2}$. Since the last summand is at most $\frac{1}{2}$, this group has sum at most 1 . Continue this procedure until we have used all the $a_{i}$ s. Notice that the last group may have sum less than $\frac{1}{2}$. If the sum of the numbers in the last two groups is less than or equal to 1, we merge them into one group. In the end we are left with $m$ groups. If $m=1$ we are done. Otherwise the first $m-2$ have sums greater than $\frac{1}{2}$ and the last two have total sum greater than 1 . Therefore $n>(m-2) / 2+1$ so $m \leqslant 2 n-1$ as desired.

Comment 1. The original proposal asked for the minimal value of $k$ when $n=2$.

Comment 2. More generally, one may ask the same question for real numbers between 0 and 1 whose sum is a real number $r$. In this case the smallest value of $k$ is $k=\lceil 2 r\rceil-1$, as Solution 3 shows.

Solutions 1 and 2 lead to the slightly weaker bound $k \leqslant 2\lceil r\rceil-1$. This is actually the optimal bound for partitions into consecutive groups, which are the ones contemplated in these two solutions. To see this, assume that $r$ is not an integer and let $c=(r+1-\lceil r\rceil) /(1+\lceil r\rceil)$. One easily checks that $0<c<\frac{1}{2}$ and $\lceil r\rceil(2 c)+(\lceil r\rceil-1)(1-c)=r$, so the sequence

$$
2 c, 1-c, 2 c, 1-c, \ldots, 1-c, 2 c
$$

of $2\lceil r\rceil-1$ numbers satisfies the given conditions. For this sequence, the only suitable partition into consecutive groups is the trivial partition, which requires $2\lceil r\rceil-1$ groups.

C2. In the plane, 2013 red points and 2014 blue points are marked so that no three of the marked points are collinear. One needs to draw $k$ lines not passing through the marked points and dividing the plane into several regions. The goal is to do it in such a way that no region contains points of both colors.

Find the minimal value of $k$ such that the goal is attainable for every possible configuration of 4027 points.

(Australia)

Answer. $k=2013$.

Solution 1. Firstly, let us present an example showing that $k \geqslant 2013$. Mark 2013 red and 2013 blue points on some circle alternately, and mark one more blue point somewhere in the plane. The circle is thus split into 4026 arcs, each arc having endpoints of different colors. Thus, if the goal is reached, then each arc should intersect some of the drawn lines. Since any line contains at most two points of the circle, one needs at least 4026/2 $=2013$ lines.

It remains to prove that one can reach the goal using 2013 lines. First of all, let us mention that for every two points $A$ and $B$ having the same color, one can draw two lines separating these points from all other ones. Namely, it suffices to take two lines parallel to $A B$ and lying on different sides of $A B$ sufficiently close to it: the only two points between these lines will be $A$ and $B$.

Now, let $P$ be the convex hull of all marked points. Two cases are possible.

Case 1. Assume that $P$ has a red vertex $A$. Then one may draw a line separating $A$ from all the other points, pair up the other 2012 red points into 1006 pairs, and separate each pair from the other points by two lines. Thus, 2013 lines will be used.

Case 2. Assume now that all the vertices of $P$ are blue. Consider any two consecutive vertices of $P$, say $A$ and $B$. One may separate these two points from the others by a line parallel to $A B$. Then, as in the previous case, one pairs up all the other 2012 blue points into 1006 pairs, and separates each pair from the other points by two lines. Again, 2013 lines will be used.

Comment 1. Instead of considering the convex hull, one may simply take a line containing two marked points $A$ and $B$ such that all the other marked points are on one side of this line. If one of $A$ and $B$ is red, then one may act as in Case 1; otherwise both are blue, and one may act as in Case 2.

Solution 2. Let us present a different proof of the fact that $k=2013$ suffices. In fact, we will prove a more general statement:

If $n$ points in the plane, no three of which are collinear, are colored in red and blue arbitrarily, then it suffices to draw $\lfloor n / 2\rfloor$ lines to reach the goal.

We proceed by induction on $n$. If $n \leqslant 2$ then the statement is obvious. Now assume that $n \geqslant 3$, and consider a line $\ell$ containing two marked points $A$ and $B$ such that all the other marked points are on one side of $\ell$; for instance, any line containing a side of the convex hull works.

Remove for a moment the points $A$ and $B$. By the induction hypothesis, for the remaining configuration it suffices to draw $\lfloor n / 2\rfloor-1$ lines to reach the goal. Now return the points $A$ and $B$ back. Three cases are possible.

Case 1. If $A$ and $B$ have the same color, then one may draw a line parallel to $\ell$ and separating $A$ and $B$ from the other points. Obviously, the obtained configuration of $\lfloor n / 2\rfloor$ lines works.

Case 2. If $A$ and $B$ have different colors, but they are separated by some drawn line, then again the same line parallel to $\ell$ works.

Case 3. Finally, assume that $A$ and $B$ have different colors and lie in one of the regions defined by the drawn lines. By the induction assumption, this region contains no other points of one of the colors - without loss of generality, the only blue point it contains is $A$. Then it suffices to draw a line separating $A$ from all other points.

Thus the step of the induction is proved.

Comment 2. One may ask a more general question, replacing the numbers 2013 and 2014 by any positive integers $m$ and $n$, say with $m \leqslant n$. Denote the answer for this problem by $f(m, n)$.

One may show along the lines of Solution 1 that $m \leqslant f(m, n) \leqslant m+1$; moreover, if $m$ is even then $f(m, n)=m$. On the other hand, for every odd $m$ there exists an $N$ such that $f(m, n)=m$ for all $m \leqslant n \leqslant N$, and $f(m, n)=m+1$ for all $n>N$.

C3. A crazy physicist discovered a new kind of particle which he called an imon, after some of them mysteriously appeared in his lab. Some pairs of imons in the lab can be entangled, and each imon can participate in many entanglement relations. The physicist has found a way to perform the following two kinds of operations with these particles, one operation at a time.

(i) If some imon is entangled with an odd number of other imons in the lab, then the physicist can destroy it.

(ii) At any moment, he may double the whole family of imons in his lab by creating a copy $I^{\prime}$ of each imon $I$. During this procedure, the two copies $I^{\prime}$ and $J^{\prime}$ become entangled if and only if the original imons $I$ and $J$ are entangled, and each copy $I^{\prime}$ becomes entangled with its original imon $I$; no other entanglements occur or disappear at this moment.

Prove that the physicist may apply a sequence of such operations resulting in a family of imons, no two of which are entangled.

(Japan)

Solution 1. Let us consider a graph with the imons as vertices, and two imons being connected if and only if they are entangled. Recall that a proper coloring of a graph $G$ is a coloring of its vertices in several colors so that every two connected vertices have different colors.

Lemma. Assume that a graph $G$ admits a proper coloring in $n$ colors $(n>1)$. Then one may perform a sequence of operations resulting in a graph which admits a proper coloring in $n-1$ colors.

Proof. Let us apply repeatedly operation $(i)$ to any appropriate vertices while it is possible. Since the number of vertices decreases, this process finally results in a graph where all the degrees are even. Surely this graph also admits a proper coloring in $n$ colors $1, \ldots, n$; let us fix this coloring.

Now apply the operation (ii) to this graph. A proper coloring of the resulting graph in $n$ colors still exists: one may preserve the colors of the original vertices and color the vertex $I^{\prime}$ in a color $k+1(\bmod n)$ if the vertex $I$ has color $k$. Then two connected original vertices still have different colors, and so do their two connected copies. On the other hand, the vertices $I$ and $I^{\prime}$ have different colors since $n>1$.

All the degrees of the vertices in the resulting graph are odd, so one may apply operation $(i)$ to delete consecutively all the vertices of color $n$ one by one; no two of them are connected by an edge, so their degrees do not change during the process. Thus, we obtain a graph admitting a proper coloring in $n-1$ colors, as required. The lemma is proved.

Now, assume that a graph $G$ has $n$ vertices; then it admits a proper coloring in $n$ colors. Applying repeatedly the lemma we finally obtain a graph admitting a proper coloring in one color, that is - a graph with no edges, as required.

Solution 2. Again, we will use the graph language.

I. We start with the following observation.

Lemma. Assume that a graph $G$ contains an isolated vertex $A$, and a graph $G^{\circ}$ is obtained from $G$ by deleting this vertex. Then, if one can apply a sequence of operations which makes a graph with no edges from $G^{\circ}$, then such a sequence also exists for $G$.

Proof. Consider any operation applicable to $G^{\circ}$ resulting in a graph $G_{1}^{\circ}$; then there exists a sequence of operations applicable to $G$ and resulting in a graph $G_{1}$ differing from $G_{1}^{\circ}$ by an addition of an isolated vertex $A$. Indeed, if this operation is of type $(i)$, then one may simply repeat it in $G$.

Otherwise, the operation is of type (ii), and one may apply it to $G$ and then delete the vertex $A^{\prime}$ (it will have degree 1 ).

Thus one may change the process for $G^{\circ}$ into a corresponding process for $G$ step by step.

In view of this lemma, if at some moment a graph contains some isolated vertex, then we may simply delete it; let us call this operation (iii).

II. Let $V=\left\{A_{1}^{0}, \ldots, A_{n}^{0}\right\}$ be the vertices of the initial graph. Let us describe which graphs can appear during our operations. Assume that operation (ii) was applied $m$ times. If these were the only operations applied, then the resulting graph $G_{n}^{m}$ has the set of vertices which can be enumerated as

$$
V_{n}^{m}=\left\{A_{i}^{j}: 1 \leqslant i \leqslant n, 0 \leqslant j \leqslant 2^{m}-1\right\}
$$

where $A_{i}^{0}$ is the common "ancestor" of all the vertices $A_{i}^{j}$, and the binary expansion of $j$ (adjoined with some zeroes at the left to have $m$ digits) "keeps the history" of this vertex: the $d$ th digit from the right is 0 if at the $d$ th doubling the ancestor of $A_{i}^{j}$ was in the original part, and this digit is 1 if it was in the copy.

Next, the two vertices $A_{i}^{j}$ and $A_{k}^{\ell}$ in $G_{n}^{m}$ are connected with an edge exactly if either (1) $j=\ell$ and there was an edge between $A_{i}^{0}$ and $A_{k}^{0}$ (so these vertices appeared at the same application of operation (ii)); or (2) $i=k$ and the binary expansions of $j$ and $\ell$ differ in exactly one digit (so their ancestors became connected as a copy and the original vertex at some application of (ii)).

Now, if some operations $(i)$ were applied during the process, then simply some vertices in $G_{n}^{m}$ disappeared. So, in any case the resulting graph is some induced subgraph of $G_{n}^{m}$.

III. Finally, we will show that from each (not necessarily induced) subgraph of $G_{n}^{m}$ one can obtain a graph with no vertices by applying operations $(i),(i i)$ and $(i i i)$. We proceed by induction on $n$; the base case $n=0$ is trivial.

For the induction step, let us show how to apply several operations so as to obtain a graph containing no vertices of the form $A_{n}^{j}$ for $j \in \mathbb{Z}$. We will do this in three steps.

Step 1. We apply repeatedly operation (i) to any appropriate vertices while it is possible. In the resulting graph, all vertices have even degrees.

Step 2. Apply operation (ii) obtaining a subgraph of $G_{n}^{m+1}$ with all degrees being odd. In this graph, we delete one by one all the vertices $A_{n}^{j}$ where the sum of the binary digits of $j$ is even; it is possible since there are no edges between such vertices, so all their degrees remain odd. After that, we delete all isolated vertices.

Step 3. Finally, consider any remaining vertex $A_{n}^{j}$ (then the sum of digits of $j$ is odd). If its degree is odd, then we simply delete it. Otherwise, since $A_{n}^{j}$ is not isolated, we consider any vertex adjacent to it. It has the form $A_{k}^{j}$ for some $k<n$ (otherwise it would have the form $A_{n}^{\ell}$, where $\ell$ has an even digit sum; but any such vertex has already been deleted at Step 2). No neighbor of $A_{k}^{j}$ was deleted at Steps 2 and 3, so it has an odd degree. Then we successively delete $A_{k}^{j}$ and $A_{n}^{j}$.

Notice that this deletion does not affect the applicability of this step to other vertices, since no two vertices $A_{i}^{j}$ and $A_{k}^{\ell}$ for different $j, \ell$ with odd digit sum are connected with an edge. Thus we will delete all the remaining vertices of the form $A_{n}^{j}$, obtaining a subgraph of $G_{n-1}^{m+1}$. The application of the induction hypothesis finishes the proof.

Comment. In fact, the graph $G_{n}^{m}$ is a Cartesian product of $G$ and the graph of an $m$-dimensional hypercube.

C4. Let $n$ be a positive integer, and let $A$ be a subset of $\{1, \ldots, n\}$. An $A$-partition of $n$ into $k$ parts is a representation of $n$ as a sum $n=a_{1}+\cdots+a_{k}$, where the parts $a_{1}, \ldots, a_{k}$ belong to $A$ and are not necessarily distinct. The number of different parts in such a partition is the number of (distinct) elements in the set $\left\{a_{1}, a_{2}, \ldots, a_{k}\right\}$.

We say that an $A$-partition of $n$ into $k$ parts is optimal if there is no $A$-partition of $n$ into $r$ parts with $r<k$. Prove that any optimal $A$-partition of $n$ contains at most $\sqrt[3]{6 n}$ different parts.

(Germany)

Solution 1. If there are no $A$-partitions of $n$, the result is vacuously true. Otherwise, let $k_{\min }$ be the minimum number of parts in an $A$-partition of $n$, and let $n=a_{1}+\cdots+a_{k_{\min }}$ be an optimal partition. Denote by $s$ the number of different parts in this partition, so we can write $S=\left\{a_{1}, \ldots, a_{k_{\min }}\right\}=\left\{b_{1}, \ldots, b_{s}\right\}$ for some pairwise different numbers $b_{1}<\cdots<b_{s}$ in $A$.

If $s>\sqrt[3]{6 n}$, we will prove that there exist subsets $X$ and $Y$ of $S$ such that $|X|<|Y|$ and $\sum_{x \in X} x=\sum_{y \in Y} y$. Then, deleting the elements of $Y$ from our partition and adding the elements of $X$ to it, we obtain an $A$-partition of $n$ into less than $k_{\text {min }}$ parts, which is the desired contradiction.

For each positive integer $k \leqslant s$, we consider the $k$-element subset

$$
S_{1,0}^{k}:=\left\{b_{1}, \ldots, b_{k}\right\}
$$

as well as the following $k$-element subsets $S_{i, j}^{k}$ of $S$ :

$$
S_{i, j}^{k}:=\left\{b_{1}, \ldots, b_{k-i}, b_{k-i+j+1}, b_{s-i+2}, \ldots, b_{s}\right\}, \quad i=1, \ldots, k, \quad j=1, \ldots, s-k
$$

Pictorially, if we represent the elements of $S$ by a sequence of dots in increasing order, and represent a subset of $S$ by shading in the appropriate dots, we have:

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-27.jpg?height=124&width=967&top_left_y=1388&top_left_x=579)

Denote by $\Sigma_{i, j}^{k}$ the sum of elements in $S_{i, j}^{k}$. Clearly, $\Sigma_{1,0}^{k}$ is the minimum sum of a $k$-element subset of $S$. Next, for all appropriate indices $i$ and $j$ we have

$$
\Sigma_{i, j}^{k}=\Sigma_{i, j+1}^{k}+b_{k-i+j+1}-b_{k-i+j+2}<\Sigma_{i, j+1}^{k} \quad \text { and } \quad \sum_{i, s-k}^{k}=\sum_{i+1,1}^{k}+b_{k-i}-b_{k-i+1}<\Sigma_{i+1,1}^{k} \text {. }
$$

Therefore

$$
1 \leqslant \Sigma_{1,0}^{k}<\Sigma_{1,1}^{k}<\Sigma_{1,2}^{k}<\cdots<\Sigma_{1, s-k}^{k}<\Sigma_{2,1}^{k}<\cdots<\Sigma_{2, s-k}^{k}<\Sigma_{3,1}^{k}<\cdots<\Sigma_{k, s-k}^{k} \leqslant n .
$$

To see this in the picture, we start with the $k$ leftmost points marked. At each step, we look for the rightmost point which can move to the right, and move it one unit to the right. We continue until the $k$ rightmost points are marked. As we do this, the corresponding sums clearly increase.

For each $k$ we have found $k(s-k)+1$ different integers of the form $\Sigma_{i, j}^{k}$ between 1 and $n$. As we vary $k$, the total number of integers we are considering is

$$
\sum_{k=1}^{s}(k(s-k)+1)=s \cdot \frac{s(s+1)}{2}-\frac{s(s+1)(2 s+1)}{6}+s=\frac{s\left(s^{2}+5\right)}{6}>\frac{s^{3}}{6}>n .
$$

Since they are between 1 and $n$, at least two of these integers are equal. Consequently, there exist $1 \leqslant k<k^{\prime} \leqslant s$ and $X=S_{i, j}^{k}$ as well as $Y=S_{i^{\prime}, j^{\prime}}^{k^{\prime}}$ such that

$$
\sum_{x \in X} x=\sum_{y \in Y} y, \quad \text { but } \quad|X|=k<k^{\prime}=|Y|
$$

as required. The result follows.

Solution 2. Assume, to the contrary, that the statement is false, and choose the minimum number $n$ for which it fails. So there exists a set $A \subseteq\{1, \ldots, n\}$ together with an optimal $A$ partition $n=a_{1}+\cdots+a_{k_{\min }}$ of $n$ refuting our statement, where, of course, $k_{\min }$ is the minimum number of parts in an $A$-partition of $n$. Again, we define $S=\left\{a_{1}, \ldots, a_{k_{\min }}\right\}=\left\{b_{1}, \ldots, b_{s}\right\}$ with $b_{1}<\cdots<b_{s}$; by our assumption we have $s>\sqrt[3]{6 n}>1$. Without loss of generality we assume that $a_{k_{\min }}=b_{s}$. Let us distinguish two cases.

Case 1. $b_{s} \geqslant \frac{s(s-1)}{2}+1$.

Consider the partition $n-b_{s}=a_{1}+\cdots+a_{k_{\min }-1}$, which is clearly a minimum $A$-partition of $n-b_{s}$ with at least $s-1 \geqslant 1$ different parts. Now, from $n<\frac{s^{3}}{6}$ we obtain

$$
n-b_{s} \leqslant n-\frac{s(s-1)}{2}-1<\frac{s^{3}}{6}-\frac{s(s-1)}{2}-1<\frac{(s-1)^{3}}{6}
$$

so $s-1>\sqrt[3]{6\left(n-b_{s}\right)}$, which contradicts the choice of $n$.

Case 2. $b_{s} \leqslant \frac{s(s-1)}{2}$.

Set $b_{0}=0, \Sigma_{0,0}=0$, and $\Sigma_{i, j}=b_{1}+\cdots+b_{i-1}+b_{j}$ for $1 \leqslant i \leqslant j<s$. There are $\frac{s(s-1)}{2}+1>b_{s}$ such sums; so at least two of them, say $\Sigma_{i, j}$ and $\Sigma_{i^{\prime}, j^{\prime}}$, are congruent modulo $b_{s}$ (where $(i, j) \neq\left(i^{\prime}, j^{\prime}\right)$ ). This means that $\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}=r b_{s}$ for some integer $r$. Notice that for $i \leqslant j<k<s$ we have

$$
0<\Sigma_{i, k}-\Sigma_{i, j}=b_{k}-b_{j}<b_{s}
$$

so the indices $i$ and $i^{\prime}$ are distinct, and we may assume that $i>i^{\prime}$. Next, we observe that $\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}=\left(b_{i^{\prime}}-b_{j^{\prime}}\right)+b_{j}+b_{i^{\prime}+1}+\cdots+b_{i-1}$ and $b_{i^{\prime}} \leqslant b_{j^{\prime}}$ imply

$$
-b_{s}<-b_{j^{\prime}}<\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}<\left(i-i^{\prime}\right) b_{s},
$$

so $0 \leqslant r \leqslant i-i^{\prime}-1$.

Thus, we may remove the $i$ terms of $\Sigma_{i, j}$ in our $A$-partition, and replace them by the $i^{\prime}$ terms of $\Sigma_{i^{\prime}, j^{\prime}}$ and $r$ terms equal to $b_{s}$, for a total of $r+i^{\prime}<i$ terms. The result is an $A$-partition of $n$ into a smaller number of parts, a contradiction.

Comment. The original proposal also contained a second part, showing that the estimate appearing in the problem has the correct order of magnitude:

For every positive integer $n$, there exist a set $A$ and an optimal $A$-partition of $n$ that contains $\lfloor\sqrt[3]{2 n}\rfloor$ different parts.

The Problem Selection Committee removed this statement from the problem, since it seems to be less suitable for the competiton; but for completeness we provide an outline of its proof here.

Let $k=\lfloor\sqrt[3]{2 n}\rfloor-1$. The statement is trivial for $n<4$, so we assume $n \geqslant 4$ and hence $k \geqslant 1$. Let $h=\left\lfloor\frac{n-1}{k}\right\rfloor$. Notice that $h \geqslant \frac{n}{k}-1$.

Now let $A=\{1, \ldots, h\}$, and set $a_{1}=h, a_{2}=h-1, \ldots, a_{k}=h-k+1$, and $a_{k+1}=n-\left(a_{1}+\cdots+a_{k}\right)$. It is not difficult to prove that $a_{k}>a_{k+1} \geqslant 1$, which shows that

$$
n=a_{1}+\ldots+a_{k+1}
$$

is an $A$-partition of $n$ into $k+1$ different parts. Since $k h<n$, any $A$-partition of $n$ has at least $k+1$ parts. Therefore our $A$-partition is optimal, and it has $\lfloor\sqrt[3]{2 n}\rfloor$ distinct parts, as desired.

C5. Let $r$ be a positive integer, and let $a_{0}, a_{1}, \ldots$ be an infinite sequence of real numbers. Assume that for all nonnegative integers $m$ and $s$ there exists a positive integer $n \in[m+1, m+r]$ such that

$$
a_{m}+a_{m+1}+\cdots+a_{m+s}=a_{n}+a_{n+1}+\cdots+a_{n+s}
$$

Prove that the sequence is periodic, i. e. there exists some $p \geqslant 1$ such that $a_{n+p}=a_{n}$ for all $n \geqslant 0$.

(India)

Solution. For every indices $m \leqslant n$ we will denote $S(m, n)=a_{m}+a_{m+1}+\cdots+a_{n-1}$; thus $S(n, n)=0$. Let us start with the following lemma.

Lemma. Let $b_{0}, b_{1}, \ldots$ be an infinite sequence. Assume that for every nonnegative integer $m$ there exists a nonnegative integer $n \in[m+1, m+r]$ such that $b_{m}=b_{n}$. Then for every indices $k \leqslant \ell$ there exists an index $t \in[\ell, \ell+r-1]$ such that $b_{t}=b_{k}$. Moreover, there are at most $r$ distinct numbers among the terms of $\left(b_{i}\right)$.

Proof. To prove the first claim, let us notice that there exists an infinite sequence of indices $k_{1}=k, k_{2}, k_{3}, \ldots$ such that $b_{k_{1}}=b_{k_{2}}=\cdots=b_{k}$ and $k_{i}<k_{i+1} \leqslant k_{i}+r$ for all $i \geqslant 1$. This sequence is unbounded from above, thus it hits each segment of the form $[\ell, \ell+r-1]$ with $\ell \geqslant k$, as required.

To prove the second claim, assume, to the contrary, that there exist $r+1$ distinct numbers $b_{i_{1}}, \ldots, b_{i_{r+1}}$. Let us apply the first claim to $k=i_{1}, \ldots, i_{r+1}$ and $\ell=\max \left\{i_{1}, \ldots, i_{r+1}\right\}$; we obtain that for every $j \in\{1, \ldots, r+1\}$ there exists $t_{j} \in[s, s+r-1]$ such that $b_{t_{j}}=b_{i_{j}}$. Thus the segment $[s, s+r-1]$ should contain $r+1$ distinct integers, which is absurd.

Setting $s=0$ in the problem condition, we see that the sequence $\left(a_{i}\right)$ satisfies the condition of the lemma, thus it attains at most $r$ distinct values. Denote by $A_{i}$ the ordered $r$-tuple $\left(a_{i}, \ldots, a_{i+r-1}\right)$; then among $A_{i}$ 's there are at most $r^{r}$ distinct tuples, so for every $k \geqslant 0$ two of the tuples $A_{k}, A_{k+1}, \ldots, A_{k+r^{r}}$ are identical. This means that there exists a positive integer $p \leqslant r^{r}$ such that the equality $A_{d}=A_{d+p}$ holds infinitely many times. Let $D$ be the set of indices $d$ satisfying this relation.

Now we claim that $D$ coincides with the set of all nonnegative integers. Since $D$ is unbounded, it suffices to show that $d \in D$ whenever $d+1 \in D$. For that, denote $b_{k}=S(k, p+k)$. The sequence $b_{0}, b_{1}, \ldots$ satisfies the lemma conditions, so there exists an index $t \in[d+1, d+r]$ such that $S(t, t+p)=S(d, d+p)$. This last relation rewrites as $S(d, t)=S(d+p, t+p)$. Since $A_{d+1}=A_{d+p+1}$, we have $S(d+1, t)=S(d+p+1, t+p)$, therefore we obtain

$$
a_{d}=S(d, t)-S(d+1, t)=S(d+p, t+p)-S(d+p+1, t+p)=a_{d+p}
$$

and thus $A_{d}=A_{d+p}$, as required.

Finally, we get $A_{d}=A_{d+p}$ for all $d$, so in particular $a_{d}=a_{d+p}$ for all $d$, QED.

Comment 1. In the present proof, the upper bound for the minimal period length is $r^{r}$. This bound is not sharp; for instance, one may improve it to $(r-1)^{r}$ for $r \geqslant 3$..

On the other hand, this minimal length may happen to be greater than $r$. For instance, it is easy to check that the sequence with period $(3,-3,3,-3,3,-1,-1,-1)$ satisfies the problem condition for $r=7$.

Comment 2. The conclusion remains true even if the problem condition only holds for every $s \geqslant N$ for some positive integer $N$. To show that, one can act as follows. Firstly, the sums of the form $S(i, i+N)$ attain at most $r$ values, as well as the sums of the form $S(i, i+N+1)$. Thus the terms $a_{i}=S(i, i+N+1)-$ $S(i+1, i+N+1)$ attain at most $r^{2}$ distinct values. Then, among the tuples $A_{k}, A_{k+N}, \ldots, A_{k+r^{2 r} N}$ two
are identical, so for some $p \leqslant r^{2 r}$ the set $D=\left\{d: A_{d}=A_{d+N p}\right\}$ is infinite. The further arguments apply almost literally, with $p$ being replaced by $N p$.

After having proved that such a sequence is also necessarily periodic, one may reduce the bound for the minimal period length to $r^{r}$ - essentially by verifying that the sequence satisfies the original version of the condition.

C6. In some country several pairs of cities are connected by direct two-way flights. It is possible to go from any city to any other by a sequence of flights. The distance between two cities is defined to be the least possible number of flights required to go from one of them to the other. It is known that for any city there are at most 100 cities at distance exactly three from it. Prove that there is no city such that more than 2550 other cities have distance exactly four from it.

(Russia)

Solution. Let us denote by $d(a, b)$ the distance between the cities $a$ and $b$, and by

$$
S_{i}(a)=\{c: d(a, c)=i\}
$$

the set of cities at distance exactly $i$ from city $a$.

Assume that for some city $x$ the set $D=S_{4}(x)$ has size at least 2551 . Let $A=S_{1}(x)$. A subset $A^{\prime}$ of $A$ is said to be substantial, if every city in $D$ can be reached from $x$ with four flights while passing through some member of $A^{\prime}$; in other terms, every city in $D$ has distance 3 from some member of $A^{\prime}$, or $D \subseteq \bigcup_{a \in A^{\prime}} S_{3}(a)$. For instance, $A$ itself is substantial. Now let us fix some substantial subset $A^{*}$ of $A$ having the minimal cardinality $m=\left|A^{*}\right|$.

Since

$$
m(101-m) \leqslant 50 \cdot 51=2550
$$

there has to be a city $a \in A^{*}$ such that $\left|S_{3}(a) \cap D\right| \geqslant 102-m$. As $\left|S_{3}(a)\right| \leqslant 100$, we obtain that $S_{3}(a)$ may contain at most $100-(102-m)=m-2$ cities $c$ with $d(c, x) \leqslant 3$. Let us denote by $T=\left\{c \in S_{3}(a): d(x, c) \leqslant 3\right\}$ the set of all such cities, so $|T| \leqslant m-2$. Now, to get a contradiction, we will construct $m-1$ distinct elements in $T$, corresponding to $m-1$ elements of the set $A_{a}=A^{*} \backslash\{a\}$.

Firstly, due to the minimality of $A^{*}$, for each $y \in A_{a}$ there exists some city $d_{y} \in D$ which can only be reached with four flights from $x$ by passing through $y$. So, there is a way to get from $x$ to $d_{y}$ along $x-y-b_{y}-c_{y}-d_{y}$ for some cities $b_{y}$ and $c_{y}$; notice that $d\left(x, b_{y}\right)=2$ and $d\left(x, c_{y}\right)=3$ since this path has the minimal possible length.

Now we claim that all $2(m-1)$ cities of the form $b_{y}, c_{y}$ with $y \in A_{a}$ are distinct. Indeed, no $b_{y}$ may coincide with any $c_{z}$ since their distances from $x$ are different. On the other hand, if one had $b_{y}=b_{z}$ for $y \neq z$, then there would exist a path of length 4 from $x$ to $d_{z}$ via $y$, namely $x-y-b_{z}-c_{z}-d_{z}$; this is impossible by the choice of $d_{z}$. Similarly, $c_{y} \neq c_{z}$ for $y \neq z$.

So, it suffices to prove that for every $y \in A_{a}$, one of the cities $b_{y}$ and $c_{y}$ has distance 3 from $a$ (and thus belongs to $T$ ). For that, notice that $d(a, y) \leqslant 2$ due to the path $a-x-y$, while $d\left(a, d_{y}\right) \geqslant d\left(x, d_{y}\right)-d(x, a)=3$. Moreover, $d\left(a, d_{y}\right) \neq 3$ by the choice of $d_{y}$; thus $d\left(a, d_{y}\right)>3$. Finally, in the sequence $d(a, y), d\left(a, b_{y}\right), d\left(a, c_{y}\right), d\left(a, d_{y}\right)$ the neighboring terms differ by at most 1 , the first term is less than 3 , and the last one is greater than 3 ; thus there exists one which is equal to 3 , as required.

Comment 1. The upper bound 2550 is sharp. This can be seen by means of various examples; one of them is the "Roman Empire": it has one capital, called "Rome", that is connected to 51 semicapitals by internally disjoint paths of length 3. Moreover, each of these semicapitals is connected to 50 rural cities by direct flights.

Comment 2. Observe that, under the conditions of the problem, there exists no bound for the size of $S_{1}(x)$ or $S_{2}(x)$.

Comment 3. The numbers 100 and 2550 appearing in the statement of the problem may be replaced by $n$ and $\left\lfloor\frac{(n+1)^{2}}{4}\right\rfloor$ for any positive integer $n$. Still more generally, one can also replace the pair $(3,4)$ of distances under consideration by any pair $(r, s)$ of positive integers satisfying $r<s \leqslant \frac{3}{2} r$.

To adapt the above proof to this situation, one takes $A=S_{s-r}(x)$ and defines the concept of substantiality as before. Then one takes $A^{*}$ to be a minimal substantial subset of $A$, and for each $y \in A^{*}$ one fixes an element $d_{y} \in S_{s}(x)$ which is only reachable from $x$ by a path of length $s$ by passing through $y$. As before, it suffices to show that for distinct $a, y \in A^{*}$ and a path $y=y_{0}-y_{1}-\ldots-y_{r}=d_{y}$, at least one of the cities $y_{0}, \ldots, y_{r-1}$ has distance $r$ from $a$. This can be done as above; the relation $s \leqslant \frac{3}{2} r$ is used here to show that $d\left(a, y_{0}\right) \leqslant r$.

Moreover, the estimate $\left[\frac{(n+1)^{2}}{4}\right\rfloor$ is also sharp for every positive integer $n$ and every positive integers $r, s$ with $r<s \leqslant \frac{3}{2} r$. This may be shown by an example similar to that in the previous comment.

C7. Let $n \geqslant 2$ be an integer. Consider all circular arrangements of the numbers $0,1, \ldots, n$; the $n+1$ rotations of an arrangement are considered to be equal. A circular arrangement is called beautiful if, for any four distinct numbers $0 \leqslant a, b, c, d \leqslant n$ with $a+c=b+d$, the chord joining numbers $a$ and $c$ does not intersect the chord joining numbers $b$ and $d$.

Let $M$ be the number of beautiful arrangements of $0,1, \ldots, n$. Let $N$ be the number of pairs $(x, y)$ of positive integers such that $x+y \leqslant n$ and $\operatorname{gcd}(x, y)=1$. Prove that

$$
M=N+1
$$

(Russia)

Solution 1. Given a circular arrangement of $[0, n]=\{0,1, \ldots, n\}$, we define a $k$-chord to be a (possibly degenerate) chord whose (possibly equal) endpoints add up to $k$. We say that three chords of a circle are aligned if one of them separates the other two. Say that $m \geqslant 3$ chords are aligned if any three of them are aligned. For instance, in Figure 1, $A, B$, and $C$ are aligned, while $B, C$, and $D$ are not.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-33.jpg?height=423&width=420&top_left_y=1035&top_left_x=560)

Figure 1

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-33.jpg?height=436&width=439&top_left_y=1018&top_left_x=1125)

Figure 2

Claim. In a beautiful arrangement, the $k$-chords are aligned for any integer $k$.

Proof. We proceed by induction. For $n \leqslant 3$ the statement is trivial. Now let $n \geqslant 4$, and proceed by contradiction. Consider a beautiful arrangement $S$ where the three $k$-chords $A, B, C$ are not aligned. If $n$ is not among the endpoints of $A, B$, and $C$, then by deleting $n$ from $S$ we obtain a beautiful arrangement $S \backslash\{n\}$ of $[0, n-1]$, where $A, B$, and $C$ are aligned by the induction hypothesis. Similarly, if 0 is not among these endpoints, then deleting 0 and decreasing all the numbers by 1 gives a beautiful arrangement $S \backslash\{0\}$ where $A, B$, and $C$ are aligned. Therefore both 0 and $n$ are among the endpoints of these segments. If $x$ and $y$ are their respective partners, we have $n \geqslant 0+x=k=n+y \geqslant n$. Thus 0 and $n$ are the endpoints of one of the chords; say it is $C$.

Let $D$ be the chord formed by the numbers $u$ and $v$ which are adjacent to 0 and $n$ and on the same side of $C$ as $A$ and $B$, as shown in Figure 2. Set $t=u+v$. If we had $t=n$, the $n-$ chords $A$, $B$, and $D$ would not be aligned in the beautiful arrangement $S \backslash\{0, n\}$, contradicting the induction hypothesis. If $t<n$, then the $t$-chord from 0 to $t$ cannot intersect $D$, so the chord $C$ separates $t$ and $D$. The chord $E$ from $t$ to $n-t$ does not intersect $C$, so $t$ and $n-t$ are on the same side of $C$. But then the chords $A, B$, and $E$ are not aligned in $S \backslash\{0, n\}$, a contradiction. Finally, the case $t>n$ is equivalent to the case $t<n$ via the beauty-preserving relabelling $x \mapsto n-x$ for $0 \leqslant x \leqslant n$, which sends $t$-chords to $(2 n-t)$-chords. This proves the Claim.

Having established the Claim, we prove the desired result by induction. The case $n=2$ is trivial. Now assume that $n \geqslant 3$. Let $S$ be a beautiful arrangement of $[0, n]$ and delete $n$ to obtain
the beautiful arrangement $T$ of $[0, n-1]$. The $n$-chords of $T$ are aligned, and they contain every point except 0 . Say $T$ is of Type 1 if 0 lies between two of these $n$-chords, and it is of Type 2 otherwise; i.e., if 0 is aligned with these $n$-chords. We will show that each Type 1 arrangement of $[0, n-1]$ arises from a unique arrangement of $[0, n]$, and each Type 2 arrangement of $[0, n-1]$ arises from exactly two beautiful arrangements of $[0, n]$.

If $T$ is of Type 1, let 0 lie between chords $A$ and $B$. Since the chord from 0 to $n$ must be aligned with $A$ and $B$ in $S, n$ must be on the other arc between $A$ and $B$. Therefore $S$ can be recovered uniquely from $T$. In the other direction, if $T$ is of Type 1 and we insert $n$ as above, then we claim the resulting arrangement $S$ is beautiful. For $0<k<n$, the $k$-chords of $S$ are also $k$-chords of $T$, so they are aligned. Finally, for $n<k<2 n$, notice that the $n$-chords of $S$ are parallel by construction, so there is an antisymmetry axis $\ell$ such that $x$ is symmetric to $n-x$ with respect to $\ell$ for all $x$. If we had two $k$-chords which intersect, then their reflections across $\ell$ would be two $(2 n-k)$-chords which intersect, where $0<2 n-k<n$, a contradiction.

If $T$ is of Type 2, there are two possible positions for $n$ in $S$, on either side of 0 . As above, we check that both positions lead to beautiful arrangements of $[0, n]$.

Hence if we let $M_{n}$ be the number of beautiful arrangements of $[0, n]$, and let $L_{n}$ be the number of beautiful arrangements of $[0, n-1]$ of Type 2 , we have

$$
M_{n}=\left(M_{n-1}-L_{n-1}\right)+2 L_{n-1}=M_{n-1}+L_{n-1} \text {. }
$$

It then remains to show that $L_{n-1}$ is the number of pairs $(x, y)$ of positive integers with $x+y=n$ and $\operatorname{gcd}(x, y)=1$. Since $n \geqslant 3$, this number equals $\varphi(n)=\#\{x: 1 \leqslant x \leqslant n, \operatorname{gcd}(x, n)=1\}$.

To prove this, consider a Type 2 beautiful arrangement of $[0, n-1]$. Label the positions $0, \ldots, n-1(\bmod n)$ clockwise around the circle, so that number 0 is in position 0 . Let $f(i)$ be the number in position $i$; note that $f$ is a permutation of $[0, n-1]$. Let $a$ be the position such that $f(a)=n-1$.

Since the $n$-chords are aligned with 0 , and every point is in an $n$-chord, these chords are all parallel and

$$
f(i)+f(-i)=n \quad \text { for all } i
$$

Similarly, since the $(n-1)$-chords are aligned and every point is in an $(n-1)$-chord, these chords are also parallel and

$$
f(i)+f(a-i)=n-1 \quad \text { for all } i \text {. }
$$

Therefore $f(a-i)=f(-i)-1$ for all $i$; and since $f(0)=0$, we get

$$
f(-a k)=k \quad \text { for all } k .
$$

Recall that this is an equality modulo $n$. Since $f$ is a permutation, we must have $(a, n)=1$. Hence $L_{n-1} \leqslant \varphi(n)$.

To prove equality, it remains to observe that the labeling (1) is beautiful. To see this, consider four numbers $w, x, y, z$ on the circle with $w+y=x+z$. Their positions around the circle satisfy $(-a w)+(-a y)=(-a x)+(-a z)$, which means that the chord from $w$ to $y$ and the chord from $x$ to $z$ are parallel. Thus (1) is beautiful, and by construction it has Type 2. The desired result follows.

Solution 2. Notice that there are exactly $N$ irreducible fractions $f_{1}<\cdots<f_{N}$ in $(0,1)$ whose denominator is at most $n$, since the pair $(x, y)$ with $x+y \leqslant n$ and $(x, y)=1$ corresponds to the fraction $x /(x+y)$. Write $f_{i}=\frac{a_{i}}{b_{i}}$ for $1 \leqslant i \leqslant N$.

We begin by constructing $N+1$ beautiful arrangements. Take any $\alpha \in(0,1)$ which is not one of the above $N$ fractions. Consider a circle of perimeter 1 . Successively mark points $0,1,2, \ldots, n$ where 0 is arbitrary, and the clockwise distance from $i$ to $i+1$ is $\alpha$. The point $k$ will be at clockwise distance $\{k \alpha\}$ from 0 , where $\{r\}$ denotes the fractional part of $r$. Call such a circular arrangement cyclic and denote it by $A(\alpha)$. If the clockwise order of the points is the same in $A\left(\alpha_{1}\right)$ and $A\left(\alpha_{2}\right)$, we regard them as the same circular arrangement. Figure 3 shows the cyclic arrangement $A(3 / 5+\epsilon)$ of $[0,13]$ where $\epsilon>0$ is very small.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-35.jpg?height=585&width=607&top_left_y=797&top_left_x=756)

Figure 3

If $0 \leqslant a, b, c, d \leqslant n$ satisfy $a+c=b+d$, then $a \alpha+c \alpha=b \alpha+d \alpha$, so the chord from $a$ to $c$ is parallel to the chord from $b$ to $d$ in $A(\alpha)$. Hence in a cyclic arrangement all $k$-chords are parallel. In particular every cyclic arrangement is beautiful.

Next we show that there are exactly $N+1$ distinct cyclic arrangements. To see this, let us see how $A(\alpha)$ changes as we increase $\alpha$ from 0 to 1 . The order of points $p$ and $q$ changes precisely when we cross a value $\alpha=f$ such that $\{p f\}=\{q f\}$; this can only happen if $f$ is one of the $N$ fractions $f_{1}, \ldots, f_{N}$. Therefore there are at most $N+1$ different cyclic arrangements.

To show they are all distinct, recall that $f_{i}=a_{i} / b_{i}$ and let $\epsilon>0$ be a very small number. In the arrangement $A\left(f_{i}+\epsilon\right)$, point $k$ lands at $\frac{k a_{i}\left(\bmod b_{i}\right)}{b_{i}}+k \epsilon$. Therefore the points are grouped into $b_{i}$ clusters next to the points $0, \frac{1}{b_{i}}, \ldots, \frac{b_{i}-1}{b_{i}}$ of the circle. The cluster following $\frac{k}{b_{i}}$ contains the numbers congruent to $k a_{i}^{-1}$ modulo $b_{i}$, listed clockwise in increasing order. It follows that the first number after 0 in $A\left(f_{i}+\epsilon\right)$ is $b_{i}$, and the first number after 0 which is less than $b_{i}$ is $a_{i}^{-1}\left(\bmod b_{i}\right)$, which uniquely determines $a_{i}$. In this way we can recover $f_{i}$ from the cyclic arrangement. Note also that $A\left(f_{i}+\epsilon\right)$ is not the trivial arrangement where we list $0,1, \ldots, n$ in order clockwise. It follows that the $N+1$ cyclic arrangements $A(\epsilon), A\left(f_{1}+\epsilon\right), \ldots, A\left(f_{N}+\epsilon\right)$ are distinct.

Let us record an observation which will be useful later:

$$
\text { if } f_{i}<\alpha<f_{i+1} \text { then } 0 \text { is immediately after } b_{i+1} \text { and before } b_{i} \text { in } A(\alpha) \text {. }
$$

Indeed, we already observed that $b_{i}$ is the first number after 0 in $A\left(f_{i}+\epsilon\right)=A(\alpha)$. Similarly we see that $b_{i+1}$ is the last number before 0 in $A\left(f_{i+1}-\epsilon\right)=A(\alpha)$.

Finally, we show that any beautiful arrangement of $[0, n]$ is cyclic by induction on $n$. For $n \leqslant 2$ the result is clear. Now assume that all beautiful arrangements of $[0, n-1]$ are cyclic, and consider a beautiful arrangement $A$ of $[0, n]$. The subarrangement $A_{n-1}=A \backslash\{n\}$ of $[0, n-1]$ obtained by deleting $n$ is cyclic; say $A_{n-1}=A_{n-1}(\alpha)$.

Let $\alpha$ be between the consecutive fractions $\frac{p_{1}}{q_{1}}<\frac{p_{2}}{q_{2}}$ among the irreducible fractions of denominator at most $n-1$. There is at most one fraction $\frac{i}{n}$ in $\left(\frac{p_{1}}{q_{1}}, \frac{p_{2}}{q_{2}}\right)$, since $\frac{i}{n}<\frac{i}{n-1} \leqslant \frac{i+1}{n}$ for $0<i \leqslant n-1$.

Case 1. There is no fraction with denominator $n$ between $\frac{p_{1}}{q_{1}}$ and $\frac{p_{2}}{q_{2}}$.

In this case the only cyclic arrangement extending $A_{n-1}(\alpha)$ is $A_{n}(\alpha)$. We know that $A$ and $A_{n}(\alpha)$ can only differ in the position of $n$. Assume $n$ is immediately after $x$ and before $y$ in $A_{n}(\alpha)$. Since the neighbors of 0 are $q_{1}$ and $q_{2}$ by (2), we have $x, y \geqslant 1$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-36.jpg?height=239&width=721&top_left_y=908&top_left_x=694)

Figure 4

In $A_{n}(\alpha)$ the chord from $n-1$ to $x$ is parallel and adjacent to the chord from $n$ to $x-1$, so $n-1$ is between $x-1$ and $x$ in clockwise order, as shown in Figure 4. Similarly, $n-1$ is between $y$ and $y-1$. Therefore $x, y, x-1, n-1$, and $y-1$ occur in this order in $A_{n}(\alpha)$ and hence in $A$ (possibly with $y=x-1$ or $x=y-1$ ).

Now, $A$ may only differ from $A_{n}(\alpha)$ in the location of $n$. In $A$, since the chord from $n-1$ to $x$ and the chord from $n$ to $x-1$ do not intersect, $n$ is between $x$ and $n-1$. Similarly, $n$ is between $n-1$ and $y$. Then $n$ must be between $x$ and $y$ and $A=A_{n}(\alpha)$. Therefore $A$ is cyclic as desired.

Case 2. There is exactly one $i$ with $\frac{p_{1}}{q_{1}}<\frac{i}{n}<\frac{p_{2}}{q_{2}}$.

In this case there exist two cyclic arrangements $A_{n}\left(\alpha_{1}\right)$ and $A_{n}\left(\alpha_{2}\right)$ of the numbers $0, \ldots, n$ extending $A_{n-1}(\alpha)$, where $\frac{p_{1}}{q_{1}}<\alpha_{1}<\frac{i}{n}$ and $\frac{i}{n}<\alpha_{2}<\frac{p_{2}}{q_{2}}$. In $A_{n-1}(\alpha), 0$ is the only number between $q_{2}$ and $q_{1}$ by (2). For the same reason, $n$ is between $q_{2}$ and 0 in $A_{n}\left(\alpha_{1}\right)$, and between 0 and $q_{1}$ in $A_{n}\left(\alpha_{2}\right)$.

Letting $x=q_{2}$ and $y=q_{1}$, the argument of Case 1 tells us that $n$ must be between $x$ and $y$ in $A$. Therefore $A$ must equal $A_{n}\left(\alpha_{1}\right)$ or $A_{n}\left(\alpha_{2}\right)$, and therefore it is cyclic.

This concludes the proof that every beautiful arrangement is cyclic. It follows that there are exactly $N+1$ beautiful arrangements of $[0, n]$ as we wished to show.

C8. Players $A$ and $B$ play a paintful game on the real line. Player $A$ has a pot of paint with four units of black ink. A quantity $p$ of this ink suffices to blacken a (closed) real interval of length p. In every round, player $A$ picks some positive integer $m$ and provides $1 / 2^{m}$ units of ink from the pot. Player $B$ then picks an integer $k$ and blackens the interval from $k / 2^{m}$ to $(k+1) / 2^{m}$ (some parts of this interval may have been blackened before). The goal of player $A$ is to reach a situation where the pot is empty and the interval $[0,1]$ is not completely blackened.

Decide whether there exists a strategy for player $A$ to win in a finite number of moves.

(Austria)

Answer. No. Such a strategy for player $A$ does not exist.

Solution. We will present a strategy for player $B$ that guarantees that the interval $[0,1]$ is completely blackened, once the paint pot has become empty.

At the beginning of round $r$, let $x_{r}$ denote the largest real number for which the interval between 0 and $x_{r}$ has already been blackened; for completeness we define $x_{1}=0$. Let $m$ be the integer picked by player $A$ in this round; we define an integer $y_{r}$ by

$$
\frac{y_{r}}{2^{m}} \leqslant x_{r}<\frac{y_{r}+1}{2^{m}}
$$

Note that $I_{0}^{r}=\left[y_{r} / 2^{m},\left(y_{r}+1\right) / 2^{m}\right]$ is the leftmost interval that may be painted in round $r$ and that still contains some uncolored point.

Player $B$ now looks at the next interval $I_{1}^{r}=\left[\left(y_{r}+1\right) / 2^{m},\left(y_{r}+2\right) / 2^{m}\right]$. If $I_{1}^{r}$ still contains an uncolored point, then player $B$ blackens the interval $I_{1}^{r}$; otherwise he blackens the interval $I_{0}^{r}$. We make the convention that, at the beginning of the game, the interval $[1,2]$ is already blackened; thus, if $y_{r}+1=2^{m}$, then $B$ blackens $I_{0}^{r}$.

Our aim is to estimate the amount of ink used after each round. Firstly, we will prove by induction that, if before $r$ th round the segment $[0,1]$ is not completely colored, then, before this move,

(i) the amount of ink used for the segment $\left[0, x_{r}\right]$ is at most $3 x_{r}$; and

(ii) for every $m, B$ has blackened at most one interval of length $1 / 2^{m}$ to the right of $x_{r}$.

Obviously, these conditions are satisfied for $r=0$. Now assume that they were satisfied before the $r$ th move, and consider the situation after this move; let $m$ be the number $A$ has picked at this move.

If $B$ has blackened the interval $I_{1}^{r}$ at this move, then $x_{r+1}=x_{r}$, and $(i)$ holds by the induction hypothesis. Next, had $B$ blackened before the $r$ th move any interval of length $1 / 2^{m}$ to the right of $x_{r}$, this interval would necessarily coincide with $I_{1}^{r}$. By our strategy, this cannot happen. So, condition (ii) also remains valid.

Assume now that $B$ has blackened the interval $I_{0}^{r}$ at the $r$ th move, but the interval $[0,1]$ still contains uncolored parts (which means that $I_{1}^{r}$ is contained in $[0,1]$ ). Then condition (ii) clearly remains true, and we need to check ( $i$ ) only. In our case, the intervals $I_{0}^{r}$ and $I_{1}^{r}$ are completely colored after the $r$ th move, so $x_{r+1}$ either reaches the right endpoint of $I_{1}$ or moves even further to the right. So, $x_{r+1}=x_{r}+\alpha$ for some $\alpha>1 / 2^{m}$.

Next, any interval blackened by $B$ before the $r$ th move which intersects $\left(x_{r}, x_{r+1}\right)$ should be contained in $\left[x_{r}, x_{r+1}\right]$; by (ii), all such intervals have different lengths not exceeding $1 / 2^{m}$, so the total amount of ink used for them is less than $2 / 2^{m}$. Thus, the amount of ink used for the segment $\left[0, x_{r+1}\right]$ does not exceed the sum of $2 / 2^{m}, 3 x_{r}$ (used for $\left[0, x_{r}\right]$ ), and $1 / 2^{m}$ used for the
segment $I_{0}^{r}$. In total it gives at most $3\left(x_{r}+1 / 2^{m}\right)<3\left(x_{r}+\alpha\right)=3 x_{r+1}$. Thus condition $(i)$ is also verified in this case. The claim is proved.

Finally, we can perform the desired estimation. Consider any situation in the game, say after the $(r-1)$ st move; assume that the segment $[0,1]$ is not completely black. By $(i i)$, in the segment $\left[x_{r}, 1\right]$ player $B$ has colored several segments of different lengths; all these lengths are negative powers of 2 not exceeding $1-x_{r}$; thus the total amount of ink used for this interval is at most $2\left(1-x_{r}\right)$. Using $(i)$, we obtain that the total amount of ink used is at most $3 x_{r}+2\left(1-x_{r}\right)<3$. Thus the pot is not empty, and therefore $A$ never wins.

Comment 1. Notice that this strategy works even if the pot contains initially only 3 units of ink.

Comment 2. There exist other strategies for $B$ allowing him to prevent emptying the pot before the whole interval is colored. On the other hand, let us mention some idea which does not work.

Player $B$ could try a strategy in which the set of blackened points in each round is an interval of the type $[0, x]$. Such a strategy cannot work (even if there is more ink available). Indeed, under the assumption that $B$ uses such a strategy, let us prove by induction on $s$ the following statement:

For any positive integer $s$, player $A$ has a strategy picking only positive integers $m \leqslant s$ in which, if player $B$ ever paints a point $x \geqslant 1-1 / 2^{s}$ then after some move, exactly the interval $\left[0,1-1 / 2^{s}\right]$ is blackened, and the amount of ink used up to this moment is at least s/2.

For the base case $s=1$, player $A$ just picks $m=1$ in the first round. If for some positive integer $k$ player $A$ has such a strategy, for $s+1$ he can first rescale his strategy to the interval $[0,1 / 2]$ (sending in each round half of the amount of ink he would give by the original strategy). Thus, after some round, the interval $\left[0,1 / 2-1 / 2^{s+1}\right]$ becomes blackened, and the amount of ink used is at least $s / 4$. Now player $A$ picks $m=1 / 2$, and player $B$ spends $1 / 2$ unit of ink to blacken the interval [0,1/2]. After that, player $A$ again rescales his strategy to the interval $[1 / 2,1]$, and player $B$ spends at least $s / 4$ units of ink to blacken the interval $\left[1 / 2,1-1 / 2^{s+1}\right]$, so he spends in total at least $s / 4+1 / 2+s / 4=(s+1) / 2$ units of ink.

Comment 3. In order to avoid finiteness issues, the statement could be replaced by the following one:

Players $A$ and $B$ play a paintful game on the real numbers. Player $A$ has a paint pot with four units of black ink. A quantity $p$ of this ink suffices to blacken a (closed) real interval of length $p$. In the beginning of the game, player $A$ chooses (and announces) a positive integer $N$. In every round, player $A$ picks some positive integer $m \leqslant N$ and provides $1 / 2^{m}$ units of ink from the pot. The player $B$ picks an integer $k$ and blackens the interval from $k / 2^{m}$ to $(k+1) / 2^{m}$ (some parts of this interval may happen to be blackened before). The goal of player $A$ is to reach a situation where the pot is empty and the interval $[0,1]$ is not completely blackened.

Decide whether there exists a strategy for player A to win.

However, the Problem Selection Committee believes that this version may turn out to be harder than the original one.

## Geometry

G1. Let $A B C$ be an acute-angled triangle with orthocenter $H$, and let $W$ be a point on side $B C$. Denote by $M$ and $N$ the feet of the altitudes from $B$ and $C$, respectively. Denote by $\omega_{1}$ the circumcircle of $B W N$, and let $X$ be the point on $\omega_{1}$ which is diametrically opposite to $W$. Analogously, denote by $\omega_{2}$ the circumcircle of $C W M$, and let $Y$ be the point on $\omega_{2}$ which is diametrically opposite to $W$. Prove that $X, Y$ and $H$ are collinear.

(Thaliand)

Solution. Let $L$ be the foot of the altitude from $A$, and let $Z$ be the second intersection point of circles $\omega_{1}$ and $\omega_{2}$, other than $W$. We show that $X, Y, Z$ and $H$ lie on the same line.

Due to $\angle B N C=\angle B M C=90^{\circ}$, the points $B, C, N$ and $M$ are concyclic; denote their circle by $\omega_{3}$. Observe that the line $W Z$ is the radical axis of $\omega_{1}$ and $\omega_{2}$; similarly, $B N$ is the radical axis of $\omega_{1}$ and $\omega_{3}$, and $C M$ is the radical axis of $\omega_{2}$ and $\omega_{3}$. Hence $A=B N \cap C M$ is the radical center of the three circles, and therefore $W Z$ passes through $A$.

Since $W X$ and $W Y$ are diameters in $\omega_{1}$ and $\omega_{2}$, respectively, we have $\angle W Z X=\angle W Z Y=90^{\circ}$, so the points $X$ and $Y$ lie on the line through $Z$, perpendicular to $W Z$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-39.jpg?height=770&width=1114&top_left_y=1103&top_left_x=511)

The quadrilateral $B L H N$ is cyclic, because it has two opposite right angles. From the power of $A$ with respect to the circles $\omega_{1}$ and $B L H N$ we find $A L \cdot A H=A B \cdot A N=A W \cdot A Z$. If $H$ lies on the line $A W$ then this implies $H=Z$ immediately. Otherwise, by $\frac{A Z}{A H}=\frac{A L}{A W}$ the triangles $A H Z$ and $A W L$ are similar. Then $\angle H Z A=\angle W L A=90^{\circ}$, so the point $H$ also lies on the line $X Y Z$.

Comment. The original proposal also included a second statement:

Let $P$ be the point on $\omega_{1}$ such that $W P$ is parallel to $C N$, and let $Q$ be the point on $\omega_{2}$ such that $W Q$ is parallel to $B M$. Prove that $P, Q$ and $H$ are collinear if and only if $B W=C W$ or $A W \perp B C$.

The Problem Selection Committee considered the first part more suitable for the competition.

G2. Let $\omega$ be the circumcircle of a triangle $A B C$. Denote by $M$ and $N$ the midpoints of the sides $A B$ and $A C$, respectively, and denote by $T$ the midpoint of the $\operatorname{arc} B C$ of $\omega$ not containing $A$. The circumcircles of the triangles $A M T$ and $A N T$ intersect the perpendicular bisectors of $A C$ and $A B$ at points $X$ and $Y$, respectively; assume that $X$ and $Y$ lie inside the triangle $A B C$. The lines $M N$ and $X Y$ intersect at $K$. Prove that $K A=K T$.

(Iran)

Solution 1. Let $O$ be the center of $\omega$, thus $O=M Y \cap N X$. Let $\ell$ be the perpendicular bisector of $A T$ (it also passes through $O$ ). Denote by $r$ the operation of reflection about $\ell$. Since $A T$ is the angle bisector of $\angle B A C$, the line $r(A B)$ is parallel to $A C$. Since $O M \perp A B$ and $O N \perp A C$, this means that the line $r(O M)$ is parallel to the line $O N$ and passes through $O$, so $r(O M)=O N$. Finally, the circumcircle $\gamma$ of the triangle $A M T$ is symmetric about $\ell$, so $r(\gamma)=\gamma$. Thus the point $M$ maps to the common point of $O N$ with the arc $A M T$ of $\gamma$ - that is, $r(M)=X$.

Similarly, $r(N)=Y$. Thus, we get $r(M N)=X Y$, and the common point $K$ of $M N$ nd $X Y$ lies on $\ell$. This means exactly that $K A=K T$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-40.jpg?height=748&width=707&top_left_y=981&top_left_x=709)

Solution 2. Let $L$ be the second common point of the line $A C$ with the circumcircle $\gamma$ of the triangle $A M T$. From the cyclic quadrilaterals $A B T C$ and $A M T L$ we get $\angle B T C=180^{\circ}-$ $\angle B A C=\angle M T L$, which implies $\angle B T M=\angle C T L$. Since $A T$ is an angle bisector in these quadrilaterals, we have $B T=T C$ and $M T=T L$. Thus the triangles $B T M$ and $C T L$ are congruent, so $C L=B M=A M$.

Let $X^{\prime}$ be the common point of the line $N X$ with the external bisector of $\angle B A C$; notice that it lies outside the triangle $A B C$. Then we have $\angle T A X^{\prime}=90^{\circ}$ and $X^{\prime} A=X^{\prime} C$, so we get $\angle X^{\prime} A M=90^{\circ}+\angle B A C / 2=180^{\circ}-\angle X^{\prime} A C=180^{\circ}-\angle X^{\prime} C A=\angle X^{\prime} C L$. Thus the triangles $X^{\prime} A M$ and $X^{\prime} C L$ are congruent, and therefore

$$
\angle M X^{\prime} L=\angle A X^{\prime} C+\left(\angle C X^{\prime} L-\angle A X^{\prime} M\right)=\angle A X^{\prime} C=180^{\circ}-2 \angle X^{\prime} A C=\angle B A C=\angle M A L .
$$

This means that $X^{\prime}$ lies on $\gamma$.

Thus we have $\angle T X N=\angle T X X^{\prime}=\angle T A X^{\prime}=90^{\circ}$, so $T X \| A C$. Then $\angle X T A=\angle T A C=$ $\angle T A M$, so the cyclic quadrilateral MATX is an isosceles trapezoid. Similarly, $N A T Y$ is an isosceles trapezoid, so again the lines $M N$ and $X Y$ are the reflections of each other about the perpendicular bisector of $A T$. Thus $K$ belongs to this perpendicular bisector.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-41.jpg?height=797&width=1001&top_left_y=214&top_left_x=562)

Comment. There are several different ways of showing that the points $X$ and $M$ are symmetrical with respect to $\ell$. For instance, one can show that the quadrilaterals $A M O N$ and $T X O Y$ are congruent. We chose Solution 1 as a simple way of doing it. On the other hand, Solution 2 shows some other interesting properties of the configuration.

Let us define $Y^{\prime}$, analogously to $X^{\prime}$, as the common point of $M Y$ and the external bisector of $\angle B A C$. One may easily see that in general the lines $M N$ and $X^{\prime} Y^{\prime}$ (which is the external bisector of $\angle B A C$ ) do not intersect on the perpendicular bisector of $A T$. Thus, any solution should involve some argument using the choice of the intersection points $X$ and $Y$.

G3. In a triangle $A B C$, let $D$ and $E$ be the feet of the angle bisectors of angles $A$ and $B$, respectively. A rhombus is inscribed into the quadrilateral $A E D B$ (all vertices of the rhombus lie on different sides of $A E D B$ ). Let $\varphi$ be the non-obtuse angle of the rhombus. Prove that $\varphi \leqslant \max \{\angle B A C, \angle A B C\}$.

(Serbia)

Solution 1. Let $K, L, M$, and $N$ be the vertices of the rhombus lying on the sides $A E, E D, D B$, and $B A$, respectively. Denote by $d(X, Y Z)$ the distance from a point $X$ to a line $Y Z$. Since $D$ and $E$ are the feet of the bisectors, we have $d(D, A B)=d(D, A C), d(E, A B)=d(E, B C)$, and $d(D, B C)=d(E, A C)=0$, which implies

$$
d(D, A C)+d(D, B C)=d(D, A B) \quad \text { and } \quad d(E, A C)+d(E, B C)=d(E, A B)
$$

Since $L$ lies on the segment $D E$ and the relation $d(X, A C)+d(X, B C)=d(X, A B)$ is linear in $X$ inside the triangle, these two relations imply

$$
d(L, A C)+d(L, B C)=d(L, A B) .
$$

Denote the angles as in the figure below, and denote $a=K L$. Then we have $d(L, A C)=a \sin \mu$ and $d(L, B C)=a \sin \nu$. Since $K L M N$ is a parallelogram lying on one side of $A B$, we get

$$
d(L, A B)=d(L, A B)+d(N, A B)=d(K, A B)+d(M, A B)=a(\sin \delta+\sin \varepsilon)
$$

Thus the condition (1) reads

$$
\sin \mu+\sin \nu=\sin \delta+\sin \varepsilon
$$

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-42.jpg?height=593&width=653&top_left_y=1384&top_left_x=736)

If one of the angles $\alpha$ and $\beta$ is non-acute, then the desired inequality is trivial. So we assume that $\alpha, \beta<\pi / 2$. It suffices to show then that $\psi=\angle N K L \leqslant \max \{\alpha, \beta\}$.

Assume, to the contrary, that $\psi>\max \{\alpha, \beta\}$. Since $\mu+\psi=\angle C K N=\alpha+\delta$, by our assumption we obtain $\mu=(\alpha-\psi)+\delta<\delta$. Similarly, $\nu<\varepsilon$. Next, since $K N \| M L$, we have $\beta=\delta+\nu$, so $\delta<\beta<\pi / 2$. Similarly, $\varepsilon<\pi / 2$. Finally, by $\mu<\delta<\pi / 2$ and $\nu<\varepsilon<\pi / 2$, we obtain

$$
\sin \mu<\sin \delta \quad \text { and } \quad \sin \nu<\sin \varepsilon
$$

This contradicts (2).

Comment. One can see that the equality is achieved if $\alpha=\beta$ for every rhombus inscribed into the quadrilateral $A E D B$.

G4. Let $A B C$ be a triangle with $\angle B>\angle C$. Let $P$ and $Q$ be two different points on line $A C$ such that $\angle P B A=\angle Q B A=\angle A C B$ and $A$ is located between $P$ and $C$. Suppose that there exists an interior point $D$ of segment $B Q$ for which $P D=P B$. Let the ray $A D$ intersect the circle $A B C$ at $R \neq A$. Prove that $Q B=Q R$.

(Georgia)

Solution 1. Denote by $\omega$ the circumcircle of the triangle $A B C$, and let $\angle A C B=\gamma$. Note that the condition $\gamma<\angle C B A$ implies $\gamma<90^{\circ}$. Since $\angle P B A=\gamma$, the line $P B$ is tangent to $\omega$, so $P A \cdot P C=P B^{2}=P D^{2}$. By $\frac{P A}{P D}=\frac{P D}{P C}$ the triangles $P A D$ and $P D C$ are similar, and $\angle A D P=\angle D C P$.

Next, since $\angle A B Q=\angle A C B$, the triangles $A B C$ and $A Q B$ are also similar. Then $\angle A Q B=$ $\angle A B C=\angle A R C$, which means that the points $D, R, C$, and $Q$ are concyclic. Therefore $\angle D R Q=$ $\angle D C Q=\angle A D P$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-43.jpg?height=594&width=959&top_left_y=923&top_left_x=583)

Figure 1

Now from $\angle A R B=\angle A C B=\gamma$ and $\angle P D B=\angle P B D=2 \gamma$ we get

$$
\angle Q B R=\angle A D B-\angle A R B=\angle A D P+\angle P D B-\angle A R B=\angle D R Q+\gamma=\angle Q R B
$$

so the triangle $Q R B$ is isosceles, which yields $Q B=Q R$.

Solution 2. Again, denote by $\omega$ the circumcircle of the triangle $A B C$. Denote $\angle A C B=\gamma$. Since $\angle P B A=\gamma$, the line $P B$ is tangent to $\omega$.

Let $E$ be the second intersection point of $B Q$ with $\omega$. If $V^{\prime}$ is any point on the ray $C E$ beyond $E$, then $\angle B E V^{\prime}=180^{\circ}-\angle B E C=180^{\circ}-\angle B A C=\angle P A B$; together with $\angle A B Q=$ $\angle P B A$ this shows firstly, that the rays $B A$ and $C E$ intersect at some point $V$, and secondly that the triangle $V E B$ is similar to the triangle $P A B$. Thus we have $\angle B V E=\angle B P A$. Next, $\angle A E V=\angle B E V-\gamma=\angle P A B-\angle A B Q=\angle A Q B$; so the triangles $P B Q$ and $V A E$ are also similar.

Let $P H$ be an altitude in the isosceles triangle $P B D$; then $B H=H D$. Let $G$ be the intersection point of $P H$ and $A B$. By the symmetry with respect to $P H$, we have $\angle B D G=\angle D B G=\gamma=$ $\angle B E A$; thus $D G \| A E$ and hence $\frac{B G}{G A}=\frac{B D}{D E}$. Thus the points $G$ and $D$ correspond to each other in the similar triangles $P A B$ and $V E B$, so $\angle D V B=\angle G P B=90^{\circ}-\angle P B Q=90^{\circ}-\angle V A E$. Thus $V D \perp A E$.

Let $T$ be the common point of $V D$ and $A E$, and let $D S$ be an altitude in the triangle $B D R$. The points $S$ and $T$ are the feet of corresponding altitudes in the similar triangles $A D E$ and $B D R$, so $\frac{B S}{S R}=\frac{A T}{T E}$. On the other hand, the points $T$ and $H$ are feet of corresponding altitudes in the similar triangles $V A E$ and $P B Q$, so $\frac{A T}{T E}=\frac{B H}{H Q}$. Thus $\frac{B S}{S R}=\frac{A T}{T E}=\frac{B H}{H Q}$, and the triangles $B H S$ and $B Q R$ are similar.

Finally, $S H$ is a median in the right-angled triangle $S B D$; so $B H=H S$, and hence $B Q=Q R$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-44.jpg?height=848&width=875&top_left_y=584&top_left_x=625)

Figure 2

Solution 3. Denote by $\omega$ and $O$ the circumcircle of the triangle $A B C$ and its center, respectively. From the condition $\angle P B A=\angle B C A$ we know that $B P$ is tangent to $\omega$.

Let $E$ be the second point of intersection of $\omega$ and $B D$. Due to the isosceles triangle $B D P$, the tangent of $\omega$ at $E$ is parallel to $D P$ and consequently it intersects $B P$ at some point $L$. Of course, $P D \| L E$. Let $M$ be the midpoint of $B E$, and let $H$ be the midpoint of $B R$. Notice that $\angle A E B=\angle A C B=\angle A B Q=\angle A B E$, so $A$ lies on the perpendicular bisector of $B E$; thus the points $L, A, M$, and $O$ are collinear. Let $\omega_{1}$ be the circle with diameter $B O$. Let $Q^{\prime}=H O \cap B E$; since $H O$ is the perpendicular bisector of $B R$, the statement of the problem is equivalent to $Q^{\prime}=Q$.

Consider the following sequence of projections (see Fig. 3).

1. Project the line $B E$ to the line $L B$ through the center $A$. (This maps $Q$ to $P$.)
2. Project the line $L B$ to $B E$ in parallel direction with $L E$. $(P \mapsto D$.)
3. Project the line $B E$ to the circle $\omega$ through its point $A .(D \mapsto R$.)
4. Scale $\omega$ by the ratio $\frac{1}{2}$ from the point $B$ to the circle $\omega_{1} .(R \mapsto H$.
5. Project $\omega_{1}$ to the line $B E$ through its point $O$. $\left(H \mapsto Q^{\prime}\right.$.)

We prove that the composition of these transforms, which maps the line $B E$ to itself, is the identity. To achieve this, it suffices to show three fixed points. An obvious fixed point is $B$ which is fixed by all the transformations above. Another fixed point is $M$, its path being $M \mapsto L \mapsto$ $E \mapsto E \mapsto M \mapsto M$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-45.jpg?height=800&width=786&top_left_y=218&top_left_x=279)

Figure 3

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-45.jpg?height=786&width=759&top_left_y=233&top_left_x=1125)

Figure 4

In order to show a third fixed point, draw a line parallel with $L E$ through $A$; let that line intersect $B E, L B$ and $\omega$ at $X, Y$ and $Z \neq A$, respectively (see Fig. 4). We show that $X$ is a fixed point. The images of $X$ at the first three transformations are $X \mapsto Y \mapsto X \mapsto Z$. From $\angle X B Z=\angle E A Z=\angle A E L=\angle L B A=\angle B Z X$ we can see that the triangle $X B Z$ is isosceles. Let $U$ be the midpoint of $B Z$; then the last two transformations do $Z \mapsto U \mapsto X$, and the point $X$ is fixed.

Comment. Verifying that the point $E$ is fixed seems more natural at first, but it appears to be less straightforward. Here we outline a possible proof.

Let the images of $E$ at the first three transforms above be $F, G$ and $I$. After comparing the angles depicted in Fig. 5 (noticing that the quadrilateral $A F B G$ is cyclic) we can observe that the tangent $L E$ of $\omega$ is parallel to $B I$. Then, similarly to the above reasons, the point $E$ is also fixed.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-45.jpg?height=789&width=751&top_left_y=1687&top_left_x=687)

Figure 5

G5. Let $A B C D E F$ be a convex hexagon with $A B=D E, B C=E F, C D=F A$, and $\angle A-\angle D=\angle C-\angle F=\angle E-\angle B$. Prove that the diagonals $A D, B E$, and $C F$ are concurrent.

(Ukraine)

In all three solutions, we denote $\theta=\angle A-\angle D=\angle C-\angle F=\angle E-\angle B$ and assume without loss of generality that $\theta \geqslant 0$.

Solution 1. Let $x=A B=D E, y=C D=F A, z=E F=B C$. Consider the points $P, Q$, and $R$ such that the quadrilaterals $C D E P, E F A Q$, and $A B C R$ are parallelograms. We compute

$$
\begin{aligned}
\angle P E Q & =\angle F E Q+\angle D E P-\angle E=\left(180^{\circ}-\angle F\right)+\left(180^{\circ}-\angle D\right)-\angle E \\
& =360^{\circ}-\angle D-\angle E-\angle F=\frac{1}{2}(\angle A+\angle B+\angle C-\angle D-\angle E-\angle F)=\theta / 2
\end{aligned}
$$

Similarly, $\angle Q A R=\angle R C P=\theta / 2$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-46.jpg?height=491&width=827&top_left_y=947&top_left_x=649)

If $\theta=0$, since $\triangle R C P$ is isosceles, $R=P$. Therefore $A B\|R C=P C\| E D$, so $A B D E$ is a parallelogram. Similarly, $B C E F$ and $C D F A$ are parallelograms. It follows that $A D, B E$ and $C F$ meet at their common midpoint.

Now assume $\theta>0$. Since $\triangle P E Q, \triangle Q A R$, and $\triangle R C P$ are isosceles and have the same angle at the apex, we have $\triangle P E Q \sim \triangle Q A R \sim \triangle R C P$ with ratios of similarity $y: z: x$. Thus

$\triangle P Q R$ is similar to the triangle with sidelengths $y, z$, and $x$.

Next, notice that

$$
\frac{R Q}{Q P}=\frac{z}{y}=\frac{R A}{A F}
$$

and, using directed angles between rays,

$$
\begin{aligned}
\not(R Q, Q P) & =\Varangle(R Q, Q E)+\Varangle(Q E, Q P) \\
& =\Varangle(R Q, Q E)+\Varangle(R A, R Q)=\Varangle(R A, Q E)=\Varangle(R A, A F) .
\end{aligned}
$$

Thus $\triangle P Q R \sim \triangle F A R$. Since $F A=y$ and $A R=z$, (1) then implies that $F R=x$. Similarly $F P=x$. Therefore $C R F P$ is a rhombus.

We conclude that $C F$ is the perpendicular bisector of $P R$. Similarly, $B E$ is the perpendicular bisector of $P Q$ and $A D$ is the perpendicular bisector of $Q R$. It follows that $A D, B E$, and $C F$ are concurrent at the circumcenter of $P Q R$.

Solution 2. Let $X=C D \cap E F, Y=E F \cap A B, Z=A B \cap C D, X^{\prime}=F A \cap B C, Y^{\prime}=$ $B C \cap D E$, and $Z^{\prime}=D E \cap F A$. From $\angle A+\angle B+\angle C=360^{\circ}+\theta / 2$ we get $\angle A+\angle B>180^{\circ}$ and $\angle B+\angle C>180^{\circ}$, so $Z$ and $X^{\prime}$ are respectively on the opposite sides of $B C$ and $A B$ from the hexagon. Similar conclusions hold for $X, Y, Y^{\prime}$, and $Z^{\prime}$. Then

$$
\angle Y Z X=\angle B+\angle C-180^{\circ}=\angle E+\angle F-180^{\circ}=\angle Y^{\prime} Z^{\prime} X^{\prime},
$$

and similarly $\angle Z X Y=\angle Z^{\prime} X^{\prime} Y^{\prime}$ and $\angle X Y Z=\angle X^{\prime} Y^{\prime} Z^{\prime}$, so $\triangle X Y Z \sim \triangle X^{\prime} Y^{\prime} Z^{\prime}$. Thus there is a rotation $R$ which sends $\triangle X Y Z$ to a triangle with sides parallel to $\triangle X^{\prime} Y^{\prime} Z^{\prime}$. Since $A B=D E$ we have $R(\overrightarrow{A B})=\overrightarrow{D E}$. Similarly, $R(\overrightarrow{C D})=\overrightarrow{F A}$ and $R(\overrightarrow{E F})=\overrightarrow{B C}$. Therefore

$$
\overrightarrow{0}=\overrightarrow{A B}+\overrightarrow{B C}+\overrightarrow{C D}+\overrightarrow{D E}+\overrightarrow{E F}+\overrightarrow{F A}=(\overrightarrow{A B}+\overrightarrow{C D}+\overrightarrow{E F})+R(\overrightarrow{A B}+\overrightarrow{C D}+\overrightarrow{E F})
$$

If $R$ is a rotation by $180^{\circ}$, then any two opposite sides of our hexagon are equal and parallel, so the three diagonals meet at their common midpoint. Otherwise, we must have

$$
\overrightarrow{A B}+\overrightarrow{C D}+\overrightarrow{E F}=\overrightarrow{0}
$$

or else we would have two vectors with different directions whose sum is $\overrightarrow{0}$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-47.jpg?height=689&width=1333&top_left_y=1057&top_left_x=388)

This allows us to consider a triangle $L M N$ with $\overrightarrow{L M}=\overrightarrow{E F}, \overrightarrow{M N}=\overrightarrow{A B}$, and $\overrightarrow{N L}=\overrightarrow{C D}$. Let $O$ be the circumcenter of $\triangle L M N$ and consider the points $O_{1}, O_{2}, O_{3}$ such that $\triangle A O_{1} B, \triangle C O_{2} D$, and $\triangle E O_{3} F$ are translations of $\triangle M O N, \triangle N O L$, and $\triangle L O M$, respectively. Since $F O_{3}$ and $A O_{1}$ are translations of $M O$, quadrilateral $A F O_{3} O_{1}$ is a parallelogram and $O_{3} O_{1}=F A=C D=N L$. Similarly, $O_{1} O_{2}=L M$ and $O_{2} O_{3}=M N$. Therefore $\triangle O_{1} O_{2} O_{3} \cong \triangle L M N$. Moreover, by means of the rotation $R$ one may check that these triangles have the same orientation.

Let $T$ be the circumcenter of $\triangle O_{1} O_{2} O_{3}$. We claim that $A D, B E$, and $C F$ meet at $T$. Let us show that $C, T$, and $F$ are collinear. Notice that $C O_{2}=O_{2} T=T O_{3}=O_{3} F$ since they are all equal to the circumradius of $\triangle L M N$. Therefore $\triangle T O_{3} F$ and $\triangle C O_{2} T$ are isosceles. Using directed angles between rays again, we get

$$
\Varangle\left(T F, T O_{3}\right)=\Varangle\left(F O_{3}, F T\right) \quad \text { and } \quad \Varangle\left(T O_{2}, T C\right)=\Varangle\left(C T, C O_{2}\right) \text {. }
$$

Also, $T$ and $O$ are the circumcenters of the congruent triangles $\triangle O_{1} O_{2} O_{3}$ and $\triangle L M N$ so we have $\Varangle\left(T O_{3}, T O_{2}\right)=\Varangle(O N, O M)$. Since $C_{2}$ and $F O_{3}$ are translations of $N O$ and $M O$ respectively, this implies

$$
\Varangle\left(T O_{3}, T O_{2}\right)=\Varangle\left(C O_{2}, F O_{3}\right) .
$$

Adding the three equations in (2) and (3) gives

$$
\Varangle(T F, T C)=\Varangle(C T, F T)=-\not(T F, T C)
$$

which implies that $T$ is on $C F$. Analogous arguments show that it is on $A D$ and $B E$ also. The desired result follows.

Solution 3. Place the hexagon on the complex plane, with $A$ at the origin and vertices labelled clockwise. Now $A, B, C, D, E, F$ represent the corresponding complex numbers. Also consider the complex numbers $a, b, c, a^{\prime}, b^{\prime}, c^{\prime}$ given by $B-A=a, D-C=b, F-E=c, E-D=a^{\prime}$, $A-F=b^{\prime}$, and $C-B=c^{\prime}$. Let $k=|a| /|b|$. From $a / b^{\prime}=-k e^{i \angle A}$ and $a^{\prime} / b=-k e^{i \angle D}$ we get that $\left(a^{\prime} / a\right)\left(b^{\prime} / b\right)=e^{-i \theta}$ and similarly $\left(b^{\prime} / b\right)\left(c^{\prime} / c\right)=e^{-i \theta}$ and $\left(c^{\prime} / c\right)\left(a^{\prime} / a\right)=e^{-i \theta}$. It follows that $a^{\prime}=a r$, $b^{\prime}=b r$, and $c^{\prime}=c r$ for a complex number $r$ with $|r|=1$, as shown below.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-48.jpg?height=512&width=1052&top_left_y=823&top_left_x=534)

We have

$$
0=a+c r+b+a r+c+b r=(a+b+c)(1+r) .
$$

If $r=-1$, then the hexagon is centrally symmetric and its diagonals intersect at its center of symmetry. Otherwise

$$
a+b+c=0 \text {. }
$$

Therefore

$$
A=0, \quad B=a, \quad C=a+c r, \quad D=c(r-1), \quad E=-b r-c, \quad F=-b r .
$$

Now consider a point $W$ on $A D$ given by the complex number $c(r-1) \lambda$, where $\lambda$ is a real number with $0<\lambda<1$. Since $D \neq A$, we have $r \neq 1$, so we can define $s=1 /(r-1)$. From $r \bar{r}=|r|^{2}=1$ we get

$$
1+s=\frac{r}{r-1}=\frac{r}{r-r \bar{r}}=\frac{1}{1-\bar{r}}=-\bar{s} .
$$

Now,

$$
\begin{aligned}
W \text { is on } B E & \Longleftrightarrow c(r-1) \lambda-a\|a-(-b r-c)=b(r-1) \Longleftrightarrow c \lambda-a s\| b \\
& \Longleftrightarrow-a \lambda-b \lambda-a s\|b \Longleftrightarrow a(\lambda+s)\| b .
\end{aligned}
$$

One easily checks that $r \neq \pm 1$ implies that $\lambda+s \neq 0$ since $s$ is not real. On the other hand,

$$
\begin{aligned}
W \text { on } C F & \Longleftrightarrow c(r-1) \lambda+b r\|-b r-(a+c r)=a(r-1) \Longleftrightarrow c \lambda+b(1+s)\| a \\
& \Longleftrightarrow-a \lambda-b \lambda-b \bar{s}\|a \Longleftrightarrow b(\lambda+\bar{s})\| a \Longleftrightarrow b \| a(\lambda+s),
\end{aligned}
$$

where in the last step we use that $(\lambda+s)(\lambda+\bar{s})=|\lambda+s|^{2} \in \mathbb{R}_{>0}$. We conclude that $A D \cap B E=$ $C F \cap B E$, and the desired result follows.

G6. Let the excircle of the triangle $A B C$ lying opposite to $A$ touch its side $B C$ at the point $A_{1}$. Define the points $B_{1}$ and $C_{1}$ analogously. Suppose that the circumcentre of the triangle $A_{1} B_{1} C_{1}$ lies on the circumcircle of the triangle $A B C$. Prove that the triangle $A B C$ is right-angled.

(Russia)

Solution 1. Denote the circumcircles of the triangles $A B C$ and $A_{1} B_{1} C_{1}$ by $\Omega$ and $\Gamma$, respectively. Denote the midpoint of the arc $C B$ of $\Omega$ containing $A$ by $A_{0}$, and define $B_{0}$ as well as $C_{0}$ analogously. By our hypothesis the centre $Q$ of $\Gamma$ lies on $\Omega$.

Lemma. One has $A_{0} B_{1}=A_{0} C_{1}$. Moreover, the points $A, A_{0}, B_{1}$, and $C_{1}$ are concyclic. Finally, the points $A$ and $A_{0}$ lie on the same side of $B_{1} C_{1}$. Similar statements hold for $B$ and $C$.

Proof. Let us consider the case $A=A_{0}$ first. Then the triangle $A B C$ is isosceles at $A$, which implies $A B_{1}=A C_{1}$ while the remaining assertions of the Lemma are obvious. So let us suppose $A \neq A_{0}$ from now on.

By the definition of $A_{0}$, we have $A_{0} B=A_{0} C$. It is also well known and easy to show that $B C_{1}=$ $C B_{1}$. Next, we have $\angle C_{1} B A_{0}=\angle A B A_{0}=\angle A C A_{0}=\angle B_{1} C A_{0}$. Hence the triangles $A_{0} B C_{1}$ and $A_{0} C B_{1}$ are congruent. This implies $A_{0} C_{1}=A_{0} B_{1}$, establishing the first part of the Lemma. It also follows that $\angle A_{0} C_{1} A=\angle A_{0} B_{1} A$, as these are exterior angles at the corresponding vertices $C_{1}$ and $B_{1}$ of the congruent triangles $A_{0} B C_{1}$ and $A_{0} C B_{1}$. For that reason the points $A, A_{0}, B_{1}$, and $C_{1}$ are indeed the vertices of some cyclic quadrilateral two opposite sides of which are $A A_{0}$ and $B_{1} C_{1}$.

Now we turn to the solution. Evidently the points $A_{1}, B_{1}$, and $C_{1}$ lie interior to some semicircle arc of $\Gamma$, so the triangle $A_{1} B_{1} C_{1}$ is obtuse-angled. Without loss of generality, we will assume that its angle at $B_{1}$ is obtuse. Thus $Q$ and $B_{1}$ lie on different sides of $A_{1} C_{1}$; obviously, the same holds for the points $B$ and $B_{1}$. So, the points $Q$ and $B$ are on the same side of $A_{1} C_{1}$.

Notice that the perpendicular bisector of $A_{1} C_{1}$ intersects $\Omega$ at two points lying on different sides of $A_{1} C_{1}$. By the first statement from the Lemma, both points $B_{0}$ and $Q$ are among these points of intersection; since they share the same side of $A_{1} C_{1}$, they coincide (see Figure 1).

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-49.jpg?height=781&width=827&top_left_y=1667&top_left_x=649)

Figure 1

Now, by the first part of the Lemma again, the lines $Q A_{0}$ and $Q C_{0}$ are the perpendicular bisectors of $B_{1} C_{1}$ and $A_{1} B_{1}$, respectively. Thus

$$
\angle C_{1} B_{0} A_{1}=\angle C_{1} B_{0} B_{1}+\angle B_{1} B_{0} A_{1}=2 \angle A_{0} B_{0} B_{1}+2 \angle B_{1} B_{0} C_{0}=2 \angle A_{0} B_{0} C_{0}=180^{\circ}-\angle A B C
$$

recalling that $A_{0}$ and $C_{0}$ are the midpoints of the arcs $C B$ and $B A$, respectively.

On the other hand, by the second part of the Lemma we have

$$
\angle C_{1} B_{0} A_{1}=\angle C_{1} B A_{1}=\angle A B C .
$$

From the last two equalities, we get $\angle A B C=90^{\circ}$, whereby the problem is solved.

Solution 2. Let $Q$ again denote the centre of the circumcircle of the triangle $A_{1} B_{1} C_{1}$, that lies on the circumcircle $\Omega$ of the triangle $A B C$. We first consider the case where $Q$ coincides with one of the vertices of $A B C$, say $Q=B$. Then $B C_{1}=B A_{1}$ and consequently the triangle $A B C$ is isosceles at $B$. Moreover we have $B C_{1}=B_{1} C$ in any triangle, and hence $B B_{1}=B C_{1}=B_{1} C$; similarly, $B B_{1}=B_{1} A$. It follows that $B_{1}$ is the centre of $\Omega$ and that the triangle $A B C$ has a right angle at $B$.

So from now on we may suppose $Q \notin\{A, B, C\}$. We start with the following well known fact. Lemma. Let $X Y Z$ and $X^{\prime} Y^{\prime} Z^{\prime}$ be two triangles with $X Y=X^{\prime} Y^{\prime}$ and $Y Z=Y^{\prime} Z^{\prime}$.

(i) If $X Z \neq X^{\prime} Z^{\prime}$ and $\angle Y Z X=\angle Y^{\prime} Z^{\prime} X^{\prime}$, then $\angle Z X Y+\angle Z^{\prime} X^{\prime} Y^{\prime}=180^{\circ}$.

(ii) If $\angle Y Z X+\angle X^{\prime} Z^{\prime} Y^{\prime}=180^{\circ}$, then $\angle Z X Y=\angle Y^{\prime} X^{\prime} Z^{\prime}$.

Proof. For both parts, we may move the triangle $X Y Z$ through the plane until $Y=Y^{\prime}$ and $Z=Z^{\prime}$. Possibly after reflecting one of the two triangles about $Y Z$, we may also suppose that $X$ and $X^{\prime}$ lie on the same side of $Y Z$ if we are in case (i) and on different sides if we are in case (ii). In both cases, the points $X, Z$, and $X^{\prime}$ are collinear due to the angle condition (see Fig. 2). Moreover we have $X \neq X^{\prime}$, because in case (i) we assumed $X Z \neq X^{\prime} Z^{\prime}$ and in case (ii) these points even lie on different sides of $Y Z$. Thus the triangle $X X^{\prime} Y$ is isosceles at $Y$. The claim now follows by considering the equal angles at its base.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-50.jpg?height=304&width=460&top_left_y=1732&top_left_x=518)

Figure 2(i)

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-50.jpg?height=304&width=464&top_left_y=1732&top_left_x=1123)

Figure 2(ii)

Relabeling the vertices of the triangle $A B C$ if necessary we may suppose that $Q$ lies in the interior of the arc $A B$ of $\Omega$ not containing $C$. We will sometimes use tacitly that the six triangles $Q B A_{1}, Q A_{1} C, Q C B_{1}, Q B_{1} A, Q C_{1} A$, and $Q B C_{1}$ have the same orientation.

As $Q$ cannot be the circumcentre of the triangle $A B C$, it is impossible that $Q A=Q B=Q C$ and thus we may also suppose that $Q C \neq Q B$. Now the above Lemma $(i)$ is applicable to the triangles $Q B_{1} C$ and $Q C_{1} B$, since $Q B_{1}=Q C_{1}$ and $B_{1} C=C_{1} B$, while $\angle B_{1} C Q=\angle C_{1} B Q$ holds as both angles appear over the same side of the chord $Q A$ in $\Omega$ (see Fig. 3). So we get

$$
\angle C Q B_{1}+\angle B Q C_{1}=180^{\circ} .
$$

We claim that $Q C=Q A$. To see this, let us assume for the sake of a contradiction that $Q C \neq Q A$. Then arguing similarly as before but now with the triangles $Q A_{1} C$ and $Q C_{1} A$ we get

$$
\angle A_{1} Q C+\angle C_{1} Q A=180^{\circ} \text {. }
$$

Adding this equation to (1), we get $\angle A_{1} Q B_{1}+\angle B Q A=360^{\circ}$, which is absurd as both summands lie in the interval $\left(0^{\circ}, 180^{\circ}\right)$.

This proves $Q C=Q A$; so the triangles $Q A_{1} C$ and $Q C_{1} A$ are congruent their sides being equal, which in turn yields

$$
\angle A_{1} Q C=\angle C_{1} Q A \text {. }
$$

Finally our Lemma (ii) is applicable to the triangles $Q A_{1} B$ and $Q B_{1} A$. Indeed we have $Q A_{1}=Q B_{1}$ and $A_{1} B=B_{1} A$ as usual, and the angle condition $\angle A_{1} B Q+\angle Q A B_{1}=180^{\circ}$ holds as $A$ and $B$ lie on different sides of the chord $Q C$ in $\Omega$. Consequently we have

$$
\angle B Q A_{1}=\angle B_{1} Q A \text {. }
$$

From (1) and (3) we get

$$
\left(\angle B_{1} Q C+\angle B_{1} Q A\right)+\left(\angle C_{1} Q B-\angle B Q A_{1}\right)=180^{\circ} \text {, }
$$

i.e. $\angle C Q A+\angle A_{1} Q C_{1}=180^{\circ}$. In light of (2) this may be rewritten as $2 \angle C Q A=180^{\circ}$ and as $Q$ lies on $\Omega$ this implies that the triangle $A B C$ has a right angle at $B$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-51.jpg?height=569&width=908&top_left_y=1404&top_left_x=606)

Figure 3

Comment 1. One may also check that $Q$ is in the interior of $\Omega$ if and only if the triangle $A B C$ is acute-angled.

Comment 2. The original proposal asked to prove the converse statement as well: if the triangle $A B C$ is right-angled, then the point $Q$ lies on its circumcircle. The Problem Selection Committee thinks that the above simplified version is more suitable for the competition.

## Number Theory

N1. Let $\mathbb{Z}_{>0}$ be the set of positive integers. Find all functions $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ such that

$$
m^{2}+f(n) \mid m f(m)+n
$$

for all positive integers $m$ and $n$.

(Malaysia)

Answer. $f(n)=n$.

Solution 1. Setting $m=n=2$ tells us that $4+f(2) \mid 2 f(2)+2$. Since $2 f(2)+2<2(4+f(2))$, we must have $2 f(2)+2=4+f(2)$, so $f(2)=2$. Plugging in $m=2$ then tells us that $4+f(n) \mid 4+n$, which implies that $f(n) \leqslant n$ for all $n$.

Setting $m=n$ gives $n^{2}+f(n) \mid n f(n)+n$, so $n f(n)+n \geqslant n^{2}+f(n)$ which we rewrite as $(n-1)(f(n)-n) \geqslant 0$. Therefore $f(n) \geqslant n$ for all $n \geqslant 2$. This is trivially true for $n=1$ also.

It follows that $f(n)=n$ for all $n$. This function obviously satisfies the desired property.

Solution 2. Setting $m=f(n)$ we get $f(n)(f(n)+1) \mid f(n) f(f(n))+n$. This implies that $f(n) \mid n$ for all $n$.

Now let $m$ be any positive integer, and let $p>2 m^{2}$ be a prime number. Note that $p>m f(m)$ also. Plugging in $n=p-m f(m)$ we learn that $m^{2}+f(n)$ divides $p$. Since $m^{2}+f(n)$ cannot equal 1, it must equal $p$. Therefore $p-m^{2}=f(n) \mid n=p-m f(m)$. But $p-m f(m)<p<2\left(p-m^{2}\right)$, so we must have $p-m f(m)=p-m^{2}$, i.e., $f(m)=m$.

Solution 3. Plugging $m=1$ we obtain $1+f(n) \leqslant f(1)+n$, so $f(n) \leqslant n+c$ for the constant $c=$ $f(1)-1$. Assume that $f(n) \neq n$ for some fixed $n$. When $m$ is large enough (e.g. $m \geqslant \max (n, c+1)$ ) we have

$$
m f(m)+n \leqslant m(m+c)+n \leqslant 2 m^{2}<2\left(m^{2}+f(n)\right),
$$

so we must have $m f(m)+n=m^{2}+f(n)$. This implies that

$$
0 \neq f(n)-n=m(f(m)-m)
$$

which is impossible for $m>|f(n)-n|$. It follows that $f$ is the identity function.

N2. Prove that for any pair of positive integers $k$ and $n$ there exist $k$ positive integers $m_{1}, m_{2}, \ldots, m_{k}$ such that

$$
1+\frac{2^{k}-1}{n}=\left(1+\frac{1}{m_{1}}\right)\left(1+\frac{1}{m_{2}}\right) \cdots\left(1+\frac{1}{m_{k}}\right) .
$$

(Japan)

Solution 1. We proceed by induction on $k$. For $k=1$ the statement is trivial. Assuming we have proved it for $k=j-1$, we now prove it for $k=j$.

Case 1. $n=2 t-1$ for some positive integer $t$.

Observe that

$$
1+\frac{2^{j}-1}{2 t-1}=\frac{2\left(t+2^{j-1}-1\right)}{2 t} \cdot \frac{2 t}{2 t-1}=\left(1+\frac{2^{j-1}-1}{t}\right)\left(1+\frac{1}{2 t-1}\right) .
$$

By the induction hypothesis we can find $m_{1}, \ldots, m_{j-1}$ such that

$$
1+\frac{2^{j-1}-1}{t}=\left(1+\frac{1}{m_{1}}\right)\left(1+\frac{1}{m_{2}}\right) \cdots\left(1+\frac{1}{m_{j-1}}\right)
$$

so setting $m_{j}=2 t-1$ gives the desired expression.

Case 2. $n=2 t$ for some positive integer $t$.

Now we have

$$
1+\frac{2^{j}-1}{2 t}=\frac{2 t+2^{j}-1}{2 t+2^{j}-2} \cdot \frac{2 t+2^{j}-2}{2 t}=\left(1+\frac{1}{2 t+2^{j}-2}\right)\left(1+\frac{2^{j-1}-1}{t}\right)
$$

noting that $2 t+2^{j}-2>0$. Again, we use that

$$
1+\frac{2^{j-1}-1}{t}=\left(1+\frac{1}{m_{1}}\right)\left(1+\frac{1}{m_{2}}\right) \cdots\left(1+\frac{1}{m_{j-1}}\right) .
$$

Setting $m_{j}=2 t+2^{j}-2$ then gives the desired expression.

Solution 2. Consider the base 2 expansions of the residues of $n-1$ and $-n$ modulo $2^{k}$ :

$$
\begin{aligned}
n-1 & \equiv 2^{a_{1}}+2^{a_{2}}+\cdots+2^{a_{r}}\left(\bmod 2^{k}\right) & & \text { where } 0 \leqslant a_{1}<a_{2}<\ldots<a_{r} \leqslant k-1 \\
-n & \equiv 2^{b_{1}}+2^{b_{2}}+\cdots+2^{b_{s}}\left(\bmod 2^{k}\right) & & \text { where } 0 \leqslant b_{1}<b_{2}<\ldots<b_{s} \leqslant k-1 .
\end{aligned}
$$

Since $-1 \equiv 2^{0}+2^{1}+\cdots+2^{k-1}\left(\bmod 2^{k}\right)$, we have $\left\{a_{1}, \ldots, a_{r}\right\} \cup\left\{b_{1} \ldots, b_{s}\right\}=\{0,1, \ldots, k-1\}$ and $r+s=k$. Write

$$
\begin{aligned}
& S_{p}=2^{a_{p}}+2^{a_{p+1}}+\cdots+2^{a_{r}} \quad \text { for } 1 \leqslant p \leqslant r, \\
& T_{q}=2^{b_{1}}+2^{b_{2}}+\cdots+2^{b_{q}} \quad \text { for } 1 \leqslant q \leqslant s .
\end{aligned}
$$

Also set $S_{r+1}=T_{0}=0$. Notice that $S_{1}+T_{s}=2^{k}-1$ and $n+T_{s} \equiv 0\left(\bmod 2^{k}\right)$. We have

$$
\begin{aligned}
1+\frac{2^{k}-1}{n} & =\frac{n+S_{1}+T_{s}}{n}=\frac{n+S_{1}+T_{s}}{n+T_{s}} \cdot \frac{n+T_{s}}{n} \\
& =\prod_{p=1}^{r} \frac{n+S_{p}+T_{s}}{n+S_{p+1}+T_{s}} \cdot \prod_{q=1}^{s} \frac{n+T_{q}}{n+T_{q-1}} \\
& =\prod_{p=1}^{r}\left(1+\frac{2^{a_{p}}}{n+S_{p+1}+T_{s}}\right) \cdot \prod_{q=1}^{s}\left(1+\frac{2^{b_{q}}}{n+T_{q-1}}\right),
\end{aligned}
$$

so if we define

$$
m_{p}=\frac{n+S_{p+1}+T_{s}}{2^{a_{p}}} \quad \text { for } 1 \leqslant p \leqslant r \quad \text { and } \quad m_{r+q}=\frac{n+T_{q-1}}{2^{b_{q}}} \quad \text { for } 1 \leqslant q \leqslant s
$$

the desired equality holds. It remains to check that every $m_{i}$ is an integer. For $1 \leqslant p \leqslant r$ we have

$$
n+S_{p+1}+T_{s} \equiv n+T_{s} \equiv 0 \quad\left(\bmod 2^{a_{p}}\right)
$$

and for $1 \leqslant q \leqslant r$ we have

$$
n+T_{q-1} \equiv n+T_{s} \equiv 0 \quad\left(\bmod 2^{b_{q}}\right) .
$$

The desired result follows.

N3. Prove that there exist infinitely many positive integers $n$ such that the largest prime divisor of $n^{4}+n^{2}+1$ is equal to the largest prime divisor of $(n+1)^{4}+(n+1)^{2}+1$.

(Belgium)

Solution. Let $p_{n}$ be the largest prime divisor of $n^{4}+n^{2}+1$ and let $q_{n}$ be the largest prime divisor of $n^{2}+n+1$. Then $p_{n}=q_{n^{2}}$, and from

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

it follows that $p_{n}=\max \left\{q_{n}, q_{n-1}\right\}$ for $n \geqslant 2$. Keeping in mind that $n^{2}-n+1$ is odd, we have

$$
\operatorname{gcd}\left(n^{2}+n+1, n^{2}-n+1\right)=\operatorname{gcd}\left(2 n, n^{2}-n+1\right)=\operatorname{gcd}\left(n, n^{2}-n+1\right)=1 .
$$

Therefore $q_{n} \neq q_{n-1}$.

To prove the result, it suffices to show that the set

$$
S=\left\{n \in \mathbb{Z}_{\geqslant 2} \mid q_{n}>q_{n-1} \text { and } q_{n}>q_{n+1}\right\}
$$

is infinite, since for each $n \in S$ one has

$$
p_{n}=\max \left\{q_{n}, q_{n-1}\right\}=q_{n}=\max \left\{q_{n}, q_{n+1}\right\}=p_{n+1} .
$$

Suppose on the contrary that $S$ is finite. Since $q_{2}=7<13=q_{3}$ and $q_{3}=13>7=q_{4}$, the set $S$ is non-empty. Since it is finite, we can consider its largest element, say $m$.

Note that it is impossible that $q_{m}>q_{m+1}>q_{m+2}>\ldots$ because all these numbers are positive integers, so there exists a $k \geqslant m$ such that $q_{k}<q_{k+1}$ (recall that $q_{k} \neq q_{k+1}$ ). Next observe that it is impossible to have $q_{k}<q_{k+1}<q_{k+2}<\ldots$, because $q_{(k+1)^{2}}=p_{k+1}=\max \left\{q_{k}, q_{k+1}\right\}=q_{k+1}$, so let us take the smallest $\ell \geqslant k+1$ such that $q_{\ell}>q_{\ell+1}$. By the minimality of $\ell$ we have $q_{\ell-1}<q_{\ell}$, so $\ell \in S$. Since $\ell \geqslant k+1>k \geqslant m$, this contradicts the maximality of $m$, and hence $S$ is indeed infinite.

Comment. Once the factorization of $n^{4}+n^{2}+1$ is found and the set $S$ is introduced, the problem is mainly about ruling out the case that

$$
q_{k}<q_{k+1}<q_{k+2}<\ldots
$$

might hold for some $k \in \mathbb{Z}_{>0}$. In the above solution, this is done by observing $q_{(k+1)^{2}}=\max \left(q_{k}, q_{k+1}\right)$. Alternatively one may notice that (1) implies that $q_{j+2}-q_{j} \geqslant 6$ for $j \geqslant k+1$, since every prime greater than 3 is congruent to -1 or 1 modulo 6 . Then there is some integer $C \geqslant 0$ such that $q_{n} \geqslant 3 n-C$ for all $n \geqslant k$.

Now let the integer $t$ be sufficiently large (e.g. $t=\max \{k+1, C+3\}$ ) and set $p=q_{t-1} \geqslant 2 t$. Then $p \mid(t-1)^{2}+(t-1)+1$ implies that $p \mid(p-t)^{2}+(p-t)+1$, so $p$ and $q_{p-t}$ are prime divisors of $(p-t)^{2}+(p-t)+1$. But $p-t>t-1 \geqslant k$, so $q_{p-t}>q_{t-1}=p$ and $p \cdot q_{p-t}>p^{2}>(p-t)^{2}+(p-t)+1$, a contradiction.

N4. Determine whether there exists an infinite sequence of nonzero digits $a_{1}, a_{2}, a_{3}, \ldots$ and a positive integer $N$ such that for every integer $k>N$, the number $\overline{a_{k} a_{k-1} \ldots a_{1}}$ is a perfect square.

(Iran)

Answer. No.

Solution. Assume that $a_{1}, a_{2}, a_{3}, \ldots$ is such a sequence. For each positive integer $k$, let $y_{k}=$ $\overline{a_{k} a_{k-1} \ldots a_{1}}$. By the assumption, for each $k>N$ there exists a positive integer $x_{k}$ such that $y_{k}=x_{k}^{2}$.

I. For every $n$, let $5^{\gamma_{n}}$ be the greatest power of 5 dividing $x_{n}$. Let us show first that $2 \gamma_{n} \geqslant n$ for every positive integer $n>N$.

Assume, to the contrary, that there exists a positive integer $n>N$ such that $2 \gamma_{n}<n$, which yields

$$
y_{n+1}=\overline{a_{n+1} a_{n} \ldots a_{1}}=10^{n} a_{n+1}+\overline{a_{n} a_{n-1} \ldots a_{1}}=10^{n} a_{n+1}+y_{n}=5^{2 \gamma_{n}}\left(2^{n} 5^{n-2 \gamma_{n}} a_{n+1}+\frac{y_{n}}{5^{2 \gamma_{n}}}\right) .
$$

Since $5 \nmid y_{n} / 5^{2 \gamma_{n}}$, we obtain $\gamma_{n+1}=\gamma_{n}<n<n+1$. By the same arguments we obtain that $\gamma_{n}=\gamma_{n+1}=\gamma_{n+2}=\ldots$. Denote this common value by $\gamma$.

Now, for each $k \geqslant n$ we have

$$
\left(x_{k+1}-x_{k}\right)\left(x_{k+1}+x_{k}\right)=x_{k+1}^{2}-x_{k}^{2}=y_{k+1}-y_{k}=a_{k+1} \cdot 10^{k} .
$$

One of the numbers $x_{k+1}-x_{k}$ and $x_{k+1}+x_{k}$ is not divisible by $5^{\gamma+1}$ since otherwise one would have $5^{\gamma+1} \mid\left(\left(x_{k+1}-x_{k}\right)+\left(x_{k+1}+x_{k}\right)\right)=2 x_{k+1}$. On the other hand, we have $5^{k} \mid\left(x_{k+1}-x_{k}\right)\left(x_{k+1}+x_{k}\right)$, so $5^{k-\gamma}$ divides one of these two factors. Thus we get

$$
5^{k-\gamma} \leqslant \max \left\{x_{k+1}-x_{k}, x_{k+1}+x_{k}\right\}<2 x_{k+1}=2 \sqrt{y_{k+1}}<2 \cdot 10^{(k+1) / 2}
$$

which implies $5^{2 k}<4 \cdot 5^{2 \gamma} \cdot 10^{k+1}$, or $(5 / 2)^{k}<40 \cdot 5^{2 \gamma}$. The last inequality is clearly false for sufficiently large values of $k$. This contradiction shows that $2 \gamma_{n} \geqslant n$ for all $n>N$.

II. Consider now any integer $k>\max \{N / 2,2\}$. Since $2 \gamma_{2 k+1} \geqslant 2 k+1$ and $2 \gamma_{2 k+2} \geqslant 2 k+2$, we have $\gamma_{2 k+1} \geqslant k+1$ and $\gamma_{2 k+2} \geqslant k+1$. So, from $y_{2 k+2}=a_{2 k+2} \cdot 10^{2 k+1}+y_{2 k+1}$ we obtain $5^{2 k+2} \mid y_{2 k+2}-y_{2 k+1}=a_{2 k+2} \cdot 10^{2 k+1}$ and thus $5 \mid a_{2 k+2}$, which implies $a_{2 k+2}=5$. Therefore,

$$
\left(x_{2 k+2}-x_{2 k+1}\right)\left(x_{2 k+2}+x_{2 k+1}\right)=x_{2 k+2}^{2}-x_{2 k+1}^{2}=y_{2 k+2}-y_{2 k+1}=5 \cdot 10^{2 k+1}=2^{2 k+1} \cdot 5^{2 k+2} .
$$

Setting $A_{k}=x_{2 k+2} / 5^{k+1}$ and $B_{k}=x_{2 k+1} / 5^{k+1}$, which are integers, we obtain

$$
\left(A_{k}-B_{k}\right)\left(A_{k}+B_{k}\right)=2^{2 k+1} .
$$

Both $A_{k}$ and $B_{k}$ are odd, since otherwise $y_{2 k+2}$ or $y_{2 k+1}$ would be a multiple of 10 which is false by $a_{1} \neq 0$; so one of the numbers $A_{k}-B_{k}$ and $A_{k}+B_{k}$ is not divisible by 4 . Therefore (1) yields $A_{k}-B_{k}=2$ and $A_{k}+B_{k}=2^{2 k}$, hence $A_{k}=2^{2 k-1}+1$ and thus

$$
x_{2 k+2}=5^{k+1} A_{k}=10^{k+1} \cdot 2^{k-2}+5^{k+1}>10^{k+1},
$$

since $k \geqslant 2$. This implies that $y_{2 k+2}>10^{2 k+2}$ which contradicts the fact that $y_{2 k+2}$ contains $2 k+2$ digits. The desired result follows.

Solution 2. Again, we assume that a sequence $a_{1}, a_{2}, a_{3}, \ldots$ satisfies the problem conditions, introduce the numbers $x_{k}$ and $y_{k}$ as in the previous solution, and notice that

$$
y_{k+1}-y_{k}=\left(x_{k+1}-x_{k}\right)\left(x_{k+1}+x_{k}\right)=10^{k} a_{k+1}
$$

for all $k>N$. Consider any such $k$. Since $a_{1} \neq 0$, the numbers $x_{k}$ and $x_{k+1}$ are not multiples of 10 , and therefore the numbers $p_{k}=x_{k+1}-x_{k}$ and $q_{k}=x_{k+1}+x_{k}$ cannot be simultaneously multiples of 20 , and hence one of them is not divisible either by 4 or by 5 . In view of (2), this means that the other one is divisible by either $5^{k}$ or by $2^{k-1}$. Notice also that $p_{k}$ and $q_{k}$ have the same parity, so both are even.

On the other hand, we have $x_{k+1}^{2}=x_{k}^{2}+10^{k} a_{k+1} \geqslant x_{k}^{2}+10^{k}>2 x_{k}^{2}$, so $x_{k+1} / x_{k}>\sqrt{2}$, which implies that

$$
1<\frac{q_{k}}{p_{k}}=1+\frac{2}{x_{k+1} / x_{k}-1}<1+\frac{2}{\sqrt{2}-1}<6 .
$$

Thus, if one of the numbers $p_{k}$ and $q_{k}$ is divisible by $5^{k}$, then we have

$$
10^{k+1}>10^{k} a_{k+1}=p_{k} q_{k} \geqslant \frac{\left(5^{k}\right)^{2}}{6}
$$

and hence $(5 / 2)^{k}<60$ which is false for sufficiently large $k$. So, assuming that $k$ is large, we get that $2^{k-1}$ divides one of the numbers $p_{k}$ and $q_{k}$. Hence

$$
\left\{p_{k}, q_{k}\right\}=\left\{2^{k-1} \cdot 5^{r_{k}} b_{k}, 2 \cdot 5^{k-r_{k}} c_{k}\right\} \quad \text { with nonnegative integers } b_{k}, c_{k}, r_{k} \text { such that } b_{k} c_{k}=a_{k+1} \text {. }
$$

Moreover, from (3) we get

$$
6>\frac{2^{k-1} \cdot 5^{r_{k}} b_{k}}{2 \cdot 5^{k-r_{k}} c_{k}} \geqslant \frac{1}{36} \cdot\left(\frac{2}{5}\right)^{k} \cdot 5^{2 r_{k}} \quad \text { and } \quad 6>\frac{2 \cdot 5^{k-r_{k}} c_{k}}{2^{k-1} \cdot 5^{r_{k}} b_{k}} \geqslant \frac{4}{9} \cdot\left(\frac{5}{2}\right)^{k} \cdot 5^{-2 r_{k}}
$$

SO

$$
\alpha k+c_{1}<r_{k}<\alpha k+c_{2} \quad \text { for } \alpha=\frac{1}{2} \log _{5}\left(\frac{5}{2}\right)<1 \text { and some constants } c_{2}>c_{1} \text {. }
$$

Consequently, for $C=c_{2}-c_{1}+1-\alpha>0$ we have

$$
(k+1)-r_{k+1} \leqslant k-r_{k}+C .
$$

Next, we will use the following easy lemma.

Lemma. Let $s$ be a positive integer. Then $5^{s+2^{s}} \equiv 5^{s}\left(\bmod 10^{s}\right)$.

Proof. Euler's theorem gives $5^{2^{s}} \equiv 1\left(\bmod 2^{s}\right)$, so $5^{s+2^{s}}-5^{s}=5^{s}\left(5^{2^{s}}-1\right)$ is divisible by $2^{s}$ and $5^{s}$.

Now, for every large $k$ we have

$$
x_{k+1}=\frac{p_{k}+q_{k}}{2}=5^{r_{k}} \cdot 2^{k-2} b_{k}+5^{k-r_{k}} c_{k} \equiv 5^{k-r_{k}} c_{k} \quad\left(\bmod 10^{r_{k}}\right)
$$

since $r_{k} \leqslant k-2$ by $(4)$; hence $y_{k+1} \equiv 5^{2\left(k-r_{k}\right)} c_{k}^{2}\left(\bmod 10^{r_{k}}\right)$. Let us consider some large integer $s$, and choose the minimal $k$ such that $2\left(k-r_{k}\right) \geqslant s+2^{s}$; it exists by (4). Set $d=2\left(k-r_{k}\right)-\left(s+2^{s}\right)$. By (4) we have $2^{s}<2\left(k-r_{k}\right)<\left(\frac{2}{\alpha}-2\right) r_{k}-\frac{2 c_{1}}{\alpha}$; if $s$ is large this implies $r_{k}>s$, so (6) also holds modulo $10^{s}$. Then (6) and the lemma give

$$
y_{k+1} \equiv 5^{2\left(k-r_{k}\right)} c_{k}^{2}=5^{s+2^{s}} \cdot 5^{d} c_{k}^{2} \equiv 5^{s} \cdot 5^{d} c_{k}^{2} \quad\left(\bmod 10^{s}\right) .
$$

By (5) and the minimality of $k$ we have $d \leqslant 2 C$, so $5^{d} c_{k}^{2} \leqslant 5^{2 C} \cdot 81=D$. Using $5^{4}<10^{3}$ we obtain

$$
5^{s} \cdot 5^{d} c_{k}^{2}<10^{3 s / 4} D<10^{s-1}
$$

for sufficiently large $s$. This, together with (7), shows that the sth digit from the right in $y_{k+1}$, which is $a_{s}$, is zero. This contradicts the problem condition.

N5. Fix an integer $k \geqslant 2$. Two players, called Ana and Banana, play the following game of numbers: Initially, some integer $n \geqslant k$ gets written on the blackboard. Then they take moves in turn, with Ana beginning. A player making a move erases the number $m$ just written on the blackboard and replaces it by some number $m^{\prime}$ with $k \leqslant m^{\prime}<m$ that is coprime to $m$. The first player who cannot move anymore loses.

An integer $n \geqslant k$ is called good if Banana has a winning strategy when the initial number is $n$, and bad otherwise.

Consider two integers $n, n^{\prime} \geqslant k$ with the property that each prime number $p \leqslant k$ divides $n$ if and only if it divides $n^{\prime}$. Prove that either both $n$ and $n^{\prime}$ are good or both are bad.

(Italy)

Solution 1. Let us first observe that the number appearing on the blackboard decreases after every move; so the game necessarily ends after at most $n$ steps, and consequently there always has to be some player possessing a winning strategy. So if some $n \geqslant k$ is bad, then Ana has a winning strategy in the game with starting number $n$.

More precisely, if $n \geqslant k$ is such that there is a good integer $m$ with $n>m \geqslant k$ and $\operatorname{gcd}(m, n)=1$, then $n$ itself is bad, for Ana has the following winning strategy in the game with initial number $n$ : She proceeds by first playing $m$ and then using Banana's strategy for the game with starting number $m$.

Otherwise, if some integer $n \geqslant k$ has the property that every integer $m$ with $n>m \geqslant k$ and $\operatorname{gcd}(m, n)=1$ is bad, then $n$ is good. Indeed, if Ana can make a first move at all in the game with initial number $n$, then she leaves it in a position where the first player has a winning strategy, so that Banana can defeat her.

In particular, this implies that any two good numbers have a non-trivial common divisor. Also, $k$ itself is good.

For brevity, we say that $n \longrightarrow x$ is a move if $n$ and $x$ are two coprime integers with $n>x \geqslant k$.

Claim 1. If $n$ is good and $n^{\prime}$ is a multiple of $n$, then $n^{\prime}$ is also good.

Proof. If $n^{\prime}$ were bad, there would have to be some move $n^{\prime} \longrightarrow x$, where $x$ is good. As $n^{\prime}$ is a multiple of $n$ this implies that the two good numbers $n$ and $x$ are coprime, which is absurd.

Claim 2. If $r$ and $s$ denote two positive integers for which $r s \geqslant k$ is bad, then $r^{2} s$ is also bad.

Proof. Since $r s$ is bad, there is a move $r s \longrightarrow x$ for some good $x$. Evidently $x$ is coprime to $r^{2} s$ as well, and hence the move $r^{2} s \longrightarrow x$ shows that $r^{2} s$ is indeed bad.

Claim 3. If $p>k$ is prime and $n \geqslant k$ is bad, then $n p$ is also bad.

Proof. Otherwise we choose a counterexample with $n$ being as small as possible. In particular, $n p$ is good. Since $n$ is bad, there is a move $n \longrightarrow x$ for some good $x$. Now $n p \longrightarrow x$ cannot be a valid move, which tells us that $x$ has to be divisible by $p$. So we can write $x=p^{r} y$, where $r$ and $y$ denote some positive integers, the latter of which is not divisible by $p$.

Note that $y=1$ is impossible, for then we would have $x=p^{r}$ and the move $x \longrightarrow k$ would establish that $x$ is bad. In view of this, there is a least power $y^{\alpha}$ of $y$ that is at least as large as $k$. Since the numbers $n p$ and $y^{\alpha}$ are coprime and the former is good, the latter has to be bad. Moreover, the minimality of $\alpha$ implies $y^{\alpha}<k y<p y=\frac{x}{p^{r-1}}<\frac{n}{p^{r-1}}$. So $p^{r-1} \cdot y^{\alpha}<n$ and consequently all the numbers $y^{\alpha}, p y^{\alpha}, \ldots, p^{r} \cdot y^{\alpha}=p\left(p^{r-1} \cdot y^{\alpha}\right)$ are bad due to the minimal choice of $n$. But now by Claim 1 the divisor $x$ of $p^{r} \cdot y^{\alpha}$ cannot be good, whereby we have reached a contradiction that proves Claim 3.

We now deduce the statement of the problem from these three claims. To this end, we call two integers $a, b \geqslant k$ similar if they are divisible by the same prime numbers not exceeding $k$. We are to prove that if $a$ and $b$ are similar, then either both of them are good or both are bad. As in this case the product $a b$ is similar to both $a$ and $b$, it suffices to show the following: if $c \geqslant k$ is similar to some of its multiples $d$, then either both $c$ and $d$ are good or both are bad.

Assuming that this is not true in general, we choose a counterexample $\left(c_{0}, d_{0}\right)$ with $d_{0}$ being as small as possible. By Claim 1, $c_{0}$ is bad whilst $d_{0}$ is good. Plainly $d_{0}$ is strictly greater than $c_{0}$ and hence the quotient $\frac{d_{0}}{c_{0}}$ has some prime factor $p$. Clearly $p$ divides $d_{0}$. If $p \leqslant k$, then $p$ divides $c_{0}$ as well due to the similarity, and hence $d_{0}$ is actually divisible by $p^{2}$. So $\frac{d_{0}}{p}$ is good by the contrapositive of Claim 2. Since $c_{0} \left\lvert\, \frac{d_{0}}{p}\right.$, the pair $\left(c_{0}, \frac{d_{0}}{p}\right)$ contradicts the supposed minimality of $d_{0}$. This proves $p>k$, but now we get the same contradiction using Claim 3 instead of Claim 2 . Thereby the problem is solved.

Solution 2. We use the same analysis of the game of numbers as in the first five paragraphs of the first solution. Let us call a prime number $p$ small in case $p \leqslant k$ and big otherwise. We again call two integers similar if their sets of small prime factors coincide.

Claim 4. For each integer $b \geqslant k$ having some small prime factor, there exists an integer $x$ similar to it with $b \geqslant x \geqslant k$ and having no big prime factors.

Proof. Unless $b$ has a big prime factor we may simply choose $x=b$. Now let $p$ and $q$ denote a small and a big prime factor of $b$, respectively. Let $a$ be the product of all small prime factors of $b$. Further define $n$ to be the least non-negative integer for which the number $x=p^{n} a$ is at least as large as $k$. It suffices to show that $b>x$. This is clear in case $n=0$, so let us assume $n>0$ from now on. Then we have $x<p k$ due to the minimality of $n, p \leqslant a$ because $p$ divides $a$ by construction, and $k<q$. Therefore $x<a q$ and, as the right hand side is a product of distinct prime factors of $b$, this implies indeed $x<b$.

Let us now assume that there is a pair $(a, b)$ of similar numbers such that $a$ is bad and $b$ is good. Take such a pair with $\max (a, b)$ being as small as possible. Since $a$ is bad, there exists a move $a \longrightarrow r$ for some good $r$. Since the numbers $k$ and $r$ are both good, they have a common prime factor, which necessarily has to be small. Thus Claim 4 is applicable to $r$, which yields an integer $r^{\prime}$ similar to $r$ containing small prime factors only and satisfying $r \geqslant r^{\prime} \geqslant k$. Since $\max \left(r, r^{\prime}\right)=r<a \leqslant \max (a, b)$ the number $r^{\prime}$ is also good. Now let $p$ denote a common prime factor of the good numbers $r^{\prime}$ and $b$. By our construction of $r^{\prime}$, this prime is small and due to the similarities it consequently divides $a$ and $r$, contrary to $a \longrightarrow r$ being a move. Thereby the problem is solved.

Comment 1. Having reached Claim 4 of Solution 2, there are various other ways to proceed. For instance, one may directly obtain the following fact, which seems to be interesting in its own right:

Claim 5. Any two good numbers have a common small prime factor.

Proof. Otherwise there exists a pair $\left(b, b^{\prime}\right)$ of good numbers with $b^{\prime} \geqslant b \geqslant k$ all of whose common prime factors are big. Choose such a pair with $b^{\prime}$ being as small as possible. Since $b$ and $k$ are both good, there has to be a common prime factor $p$ of $b$ and $k$. Evidently $p$ is small and thus it cannot divide $b^{\prime}$, which in turn tells us $b^{\prime}>b$. Applying Claim 4 to $b$ we get an integer $x$ with $b \geqslant x \geqslant k$ that is similar to $b$ and has no big prime divisors at all. By our assumption, $b^{\prime}$ and $x$ are coprime, and as $b^{\prime}$ is good this implies that $x$ is bad. Consequently there has to be some move $x \longrightarrow b^{*}$ such that $b^{*}$ is good. But now all the small prime factors of $b$ also appear in $x$ and thus they cannot divide $b^{*}$. Therefore the pair $\left(b^{*}, b\right)$ contradicts the supposed minimality of $b^{\prime}$.

From that point, it is easy to complete the solution: assume that there are two similar integers $a$ and $b$ such that $a$ is bad and $b$ is good. Since $a$ is bad, there is a move $a \longrightarrow b^{\prime}$ for some good $b^{\prime}$. By Claim 5, there is a small prime $p$ dividing $b$ and $b^{\prime}$. Due to the similarity of $a$ and $b$, the prime $p$ has to divide $a$ as well, but this contradicts the fact that $a \longrightarrow b^{\prime}$ is a valid move. Thereby the problem is solved.

Comment 2. There are infinitely many good numbers, e.g. all multiples of $k$. The increasing sequence $b_{0}, b_{1}, \ldots$, of all good numbers may be constructed recursively as follows:

- Start with $b_{0}=k$.
- If $b_{n}$ has just been defined for some $n \geqslant 0$, then $b_{n+1}$ is the smallest number $b>b_{n}$ that is coprime to none of $b_{0}, \ldots, b_{n}$.

This construction can be used to determine the set of good numbers for any specific $k$ as explained in the next comment. It is already clear that if $k=p^{\alpha}$ is a prime power, then a number $b \geqslant k$ is good if and only if it is divisible by $p$.

Comment 3. Let $P>1$ denote the product of all small prime numbers. Then any two integers $a, b \geqslant k$ that are congruent modulo $P$ are similar. Thus the infinite word $W_{k}=\left(X_{k}, X_{k+1}, \ldots\right)$ defined by

$$
X_{i}= \begin{cases}A & \text { if } i \text { is bad } \\ B & \text { if } i \text { is good }\end{cases}
$$

for all $i \geqslant k$ is periodic and the length of its period divides $P$. As the prime power example shows, the true period can sometimes be much smaller than $P$. On the other hand, there are cases where the period is rather large; e.g., if $k=15$, the sequence of good numbers begins with 15,18,20,24,30,36,40,42, 45 and the period of $W_{15}$ is 30 .

Comment 4. The original proposal contained two questions about the game of numbers, namely $(a)$ to show that if two numbers have the same prime factors then either both are good or both are bad, and (b) to show that the word $W_{k}$ introduced in the previous comment is indeed periodic. The Problem Selection Committee thinks that the above version of the problem is somewhat easier, even though it demands to prove a stronger result.

N6. Determine all functions $f: \mathbb{Q} \longrightarrow \mathbb{Z}$ satisfying

$$
f\left(\frac{f(x)+a}{b}\right)=f\left(\frac{x+a}{b}\right)
$$

for all $x \in \mathbb{Q}, a \in \mathbb{Z}$, and $b \in \mathbb{Z}_{>0}$. (Here, $\mathbb{Z}_{>0}$ denotes the set of positive integers.)

(Israel)

Answer. There are three kinds of such functions, which are: all constant functions, the floor function, and the ceiling function.

Solution 1. I. We start by verifying that these functions do indeed satisfy (1). This is clear for all constant functions. Now consider any triple $(x, a, b) \in \mathbb{Q} \times \mathbb{Z} \times \mathbb{Z}_{>0}$ and set

$$
q=\left\lfloor\frac{x+a}{b}\right\rfloor .
$$

This means that $q$ is an integer and $b q \leqslant x+a<b(q+1)$. It follows that $b q \leqslant\lfloor x\rfloor+a<b(q+1)$ holds as well, and thus we have

$$
\left\lfloor\frac{\lfloor x\rfloor+a}{b}\right\rfloor=\left\lfloor\frac{x+a}{b}\right\rfloor,
$$

meaning that the floor function does indeed satisfy (1). One can check similarly that the ceiling function has the same property.

II. Let us now suppose conversely that the function $f: \mathbb{Q} \longrightarrow \mathbb{Z}$ satisfies (1) for all $(x, a, b) \in$ $\mathbb{Q} \times \mathbb{Z} \times \mathbb{Z}_{>0}$. According to the behaviour of the restriction of $f$ to the integers we distinguish two cases.

Case 1: There is some $m \in \mathbb{Z}$ such that $f(m) \neq m$.

Write $f(m)=C$ and let $\eta \in\{-1,+1\}$ and $b$ denote the sign and absolute value of $f(m)-m$, respectively. Given any integer $r$, we may plug the triple $(m, r b-C, b)$ into (1), thus getting $f(r)=f(r-\eta)$. Starting with $m$ and using induction in both directions, we deduce from this that the equation $f(r)=C$ holds for all integers $r$. Now any rational number $y$ can be written in the form $y=\frac{p}{q}$ with $(p, q) \in \mathbb{Z} \times \mathbb{Z}_{>0}$, and substituting $(C-p, p-C, q)$ into (1) we get $f(y)=f(0)=C$. Thus $f$ is the constant function whose value is always $C$.

Case 2: One has $f(m)=m$ for all integers $m$.

Note that now the special case $b=1$ of (1) takes a particularly simple form, namely

$$
f(x)+a=f(x+a) \quad \text { for all }(x, a) \in \mathbb{Q} \times \mathbb{Z}
$$

Defining $f\left(\frac{1}{2}\right)=\omega$ we proceed in three steps.

Step $A$. We show that $\omega \in\{0,1\}$.

If $\omega \leqslant 0$, we may plug $\left(\frac{1}{2},-\omega, 1-2 \omega\right)$ into (1), obtaining $0=f(0)=f\left(\frac{1}{2}\right)=\omega$. In the contrary case $\omega \geqslant 1$ we argue similarly using the triple $\left(\frac{1}{2}, \omega-1,2 \omega-1\right)$.

Step B. We show that $f(x)=\omega$ for all rational numbers $x$ with $0<x<1$.

Assume that this fails and pick some rational number $\frac{a}{b} \in(0,1)$ with minimal $b$ such that $f\left(\frac{a}{b}\right) \neq \omega$. Obviously, $\operatorname{gcd}(a, b)=1$ and $b \geqslant 2$. If $b$ is even, then $a$ has to be odd and we can substitute $\left(\frac{1}{2}, \frac{a-1}{2}, \frac{b}{2}\right)$ into (1), which yields

$$
f\left(\frac{\omega+(a-1) / 2}{b / 2}\right)=f\left(\frac{a}{b}\right) \neq \omega .
$$

Recall that $0 \leqslant(a-1) / 2<b / 2$. Thus, in both cases $\omega=0$ and $\omega=1$, the left-hand part of (3) equals $\omega$ either by the minimality of $b$, or by $f(\omega)=\omega$. A contradiction.

Thus $b$ has to be odd, so $b=2 k+1$ for some $k \geqslant 1$. Applying $(1)$ to $\left(\frac{1}{2}, k, b\right)$ we get

$$
f\left(\frac{\omega+k}{b}\right)=f\left(\frac{1}{2}\right)=\omega .
$$

Since $a$ and $b$ are coprime, there exist integers $r \in\{1,2, \ldots, b\}$ and $m$ such that $r a-m b=k+\omega$. Note that we actually have $1 \leqslant r<b$, since the right hand side is not a multiple of $b$. If $m$ is negative, then we have $r a-m b>b \geqslant k+\omega$, which is absurd. Similarly, $m \geqslant r$ leads to $r a-m b<b r-b r=0$, which is likewise impossible; so we must have $0 \leqslant m \leqslant r-1$.

We finally substitute $\left(\frac{k+\omega}{b}, m, r\right)$ into (1) and use (4) to learn

$$
f\left(\frac{\omega+m}{r}\right)=f\left(\frac{a}{b}\right) \neq \omega
$$

But as above one may see that the left hand side has to equal $\omega$ due to the minimality of $b$. This contradiction concludes our step B.

Step C. Now notice that if $\omega=0$, then $f(x)=\lfloor x\rfloor$ holds for all rational $x$ with $0 \leqslant x<1$ and hence by (2) this even holds for all rational numbers $x$. Similarly, if $\omega=1$, then $f(x)=\lceil x\rceil$ holds for all $x \in \mathbb{Q}$. Thereby the problem is solved.

Comment 1. An alternative treatment of Steps B and C from the second case, due to the proposer, proceeds as follows. Let square brackets indicate the floor function in case $\omega=0$ and the ceiling function if $\omega=1$. We are to prove that $f(x)=[x]$ holds for all $x \in \mathbb{Q}$, and because of Step A and (2) we already know this in case $2 x \in \mathbb{Z}$. Applying (1) to $(2 x, 0,2)$ we get

$$
f(x)=f\left(\frac{f(2 x)}{2}\right)
$$

and by the previous observation this yields

$$
f(x)=\left[\frac{f(2 x)}{2}\right] \quad \text { for all } x \in \mathbb{Q}
$$

An easy induction now shows

$$
f(x)=\left[\frac{f\left(2^{n} x\right)}{2^{n}}\right] \quad \text { for all }(x, n) \in \mathbb{Q} \times \mathbb{Z}_{>0}
$$

Now suppose first that $x$ is not an integer but can be written in the form $\frac{p}{q}$ with $p \in \mathbb{Z}$ and $q \in \mathbb{Z}_{>0}$ both being odd. Let $d$ denote the multiplicative order of 2 modulo $q$ and let $m$ be any large integer. Plugging $n=d m$ into (6) and using (2) we get

$$
f(x)=\left[\frac{f\left(2^{d m} x\right)}{2^{d m}}\right]=\left[\frac{f(x)+\left(2^{d m}-1\right) x}{2^{d m}}\right]=\left[x+\frac{f(x)-x}{2^{d m}}\right] .
$$

Since $x$ is not an integer, the square bracket function is continuous at $x$; hence as $m$ tends to infinity the above fomula gives $f(x)=[x]$. To complete the argument we just need to observe that if some $y \in \mathbb{Q}$ satisfies $f(y)=[y]$, then (5) yields $f\left(\frac{y}{2}\right)=f\left(\frac{[y]}{2}\right)=\left[\frac{[y]}{2}\right]=\left[\frac{y}{2}\right]$.

Solution 2. Here we just give another argument for the second case of the above solution. Again we use equation (2). It follows that the set $S$ of all zeros of $f$ contains for each $x \in \mathbb{Q}$ exactly one term from the infinite sequence $\ldots, x-2, x-1, x, x+1, x+2, \ldots$.

Next we claim that

$$
\text { if }(p, q) \in \mathbb{Z} \times \mathbb{Z}_{>0} \text { and } \frac{p}{q} \in S \text {, then } \frac{p}{q+1} \in S \text { holds as well. }
$$

To see this we just plug $\left(\frac{p}{q}, p, q+1\right)$ into (1), thus getting $f\left(\frac{p}{q+1}\right)=f\left(\frac{p}{q}\right)=0$.

From this we get that

$$
\text { if } x, y \in \mathbb{Q}, x>y>0 \text {, and } x \in S \text {, then } y \in S \text {. }
$$

Indeed, if we write $x=\frac{p}{q}$ and $y=\frac{r}{s}$ with $p, q, r, s \in \mathbb{Z}_{>0}$, then $p s>q r$ and (7) tells us

$$
0=f\left(\frac{p}{q}\right)=f\left(\frac{p r}{q r}\right)=f\left(\frac{p r}{q r+1}\right)=\ldots=f\left(\frac{p r}{p s}\right)=f\left(\frac{r}{s}\right)
$$

Essentially the same argument also establishes that

$$
\text { if } x, y \in \mathbb{Q}, x<y<0 \text {, and } x \in S \text {, then } y \in S \text {. }
$$

From (8) and (9) we get $0 \in S \subseteq(-1,+1)$ and hence the real number $\alpha=\sup (S)$ exists and satisfies $0 \leqslant \alpha \leqslant 1$.

Let us assume that we actually had $0<\alpha<1$. Note that $f(x)=0$ if $x \in(0, \alpha) \cap \mathbb{Q}$ by (8), and $f(x)=1$ if $x \in(\alpha, 1) \cap \mathbb{Q}$ by (9) and (2). Let $K$ denote the unique positive integer satisfying $K \alpha<1 \leqslant(K+1) \alpha$. The first of these two inequalities entails $\alpha<\frac{1+\alpha}{K+1}$, and thus there is a rational number $x \in\left(\alpha, \frac{1+\alpha}{K+1}\right)$. Setting $y=(K+1) x-1$ and substituting $(y, 1, K+1)$ into (1) we learn

$$
f\left(\frac{f(y)+1}{K+1}\right)=f\left(\frac{y+1}{K+1}\right)=f(x) .
$$

Since $\alpha<x<1$ and $0<y<\alpha$, this simplifies to

$$
f\left(\frac{1}{K+1}\right)=1
$$

But, as $0<\frac{1}{K+1} \leqslant \alpha$, this is only possible if $\alpha=\frac{1}{K+1}$ and $f(\alpha)=1$. From this, however, we get the contradiction

$$
0=f\left(\frac{1}{(K+1)^{2}}\right)=f\left(\frac{\alpha+0}{K+1}\right)=f\left(\frac{f(\alpha)+0}{K+1}\right)=f(\alpha)=1
$$

Thus our assumption $0<\alpha<1$ has turned out to be wrong and it follows that $\alpha \in\{0,1\}$. If $\alpha=0$, then we have $S \subseteq(-1,0]$, whence $S=(-1,0] \cap \mathbb{Q}$, which in turn yields $f(x)=\lceil x\rceil$ for all $x \in \mathbb{Q}$ due to (2). Similarly, $\alpha=1$ entails $S=[0,1) \cap \mathbb{Q}$ and $f(x)=\lfloor x\rfloor$ for all $x \in \mathbb{Q}$. Thereby the solution is complete.

Comment 2. It seems that all solutions to this problems involve some case distinction separating the constant solutions from the unbounded ones, though the "descriptions" of the cases may be different depending on the work that has been done at the beginning of the solution. For instance, these two cases can also be " $f$ is periodic on the integers" and " $f$ is not periodic on the integers". The case leading to the unbounded solutions appears to be the harder one.

In most approaches, the cases leading to the two functions $x \longmapsto\lfloor x\rfloor$ and $x \longmapsto\lceil x\rceil$ can easily be treated parallelly, but sometimes it may be useful to know that there is some symmetry in the problem interchanging these two functions. Namely, if a function $f: \mathbb{Q} \longrightarrow \mathbb{Z}$ satisfies (1), then so does the function $g: \mathbb{Q} \longrightarrow \mathbb{Z}$ defined by $g(x)=-f(-x)$ for all $x \in \mathbb{Q}$. For that reason, we could have restricted our attention to the case $\omega=0$ in the first solution and, once $\alpha \in\{0,1\}$ had been obtained, to the case $\alpha=0$ in the second solution.

N7. Let $\nu$ be an irrational positive number, and let $m$ be a positive integer. A pair $(a, b)$ of positive integers is called good if

$$
a\lceil b \nu\rceil-b\lfloor a \nu\rfloor=m
$$

A good pair $(a, b)$ is called excellent if neither of the pairs $(a-b, b)$ and $(a, b-a)$ is good. (As usual, by $\lfloor x\rfloor$ and $\lceil x\rceil$ we denote the integer numbers such that $x-1<\lfloor x\rfloor \leqslant x$ and $x \leqslant\lceil x\rceil<x+1$.)

Prove that the number of excellent pairs is equal to the sum of the positive divisors of $m$.

Solution. For positive integers $a$ and $b$, let us denote

$$
f(a, b)=a\lceil b \nu\rceil-b\lfloor a \nu\rfloor .
$$

We will deal with various values of $m$; thus it is convenient to say that a pair $(a, b)$ is $m$-good or $m$-excellent if the corresponding conditions are satisfied.

To start, let us investigate how the values $f(a+b, b)$ and $f(a, b+a)$ are related to $f(a, b)$. If $\{a \nu\}+\{b \nu\}<1$, then we have $\lfloor(a+b) \nu\rfloor=\lfloor a \nu\rfloor+\lfloor b \nu\rfloor$ and $\lceil(a+b) \nu\rceil=\lceil a \nu\rceil+\lceil b \nu\rceil-1$, so

$$
f(a+b, b)=(a+b)\lceil b \nu\rceil-b(\lfloor a \nu\rfloor+\lfloor b \nu\rfloor)=f(a, b)+b(\lceil b \nu\rceil-\lfloor b \nu\rfloor)=f(a, b)+b
$$

and

$$
f(a, b+a)=a(\lceil b \nu\rceil+\lceil a \nu\rceil-1)-(b+a)\lfloor a \nu\rfloor=f(a, b)+a(\lceil a \nu\rceil-1-\lfloor a \nu\rfloor)=f(a, b) .
$$

Similarly, if $\{a \nu\}+\{b \nu\} \geqslant 1$ then one obtains

$$
f(a+b, b)=f(a, b) \text { and } f(a, b+a)=f(a, b)+a \text {. }
$$

So, in both cases one of the numbers $f(a+b, a)$ and $f(a, b+a)$ is equal to $f(a, b)$ while the other is greater than $f(a, b)$ by one of $a$ and $b$. Thus, exactly one of the pairs $(a+b, b)$ and $(a, b+a)$ is excellent (for an appropriate value of $m$ ).

Now let us say that the pairs $(a+b, b)$ and $(a, b+a)$ are the children of the pair $(a, b)$, while this pair is their parent. Next, if a pair $(c, d)$ can be obtained from $(a, b)$ by several passings from a parent to a child, we will say that $(c, d)$ is a descendant of $(a, b)$, while $(a, b)$ is an ancestor of $(c, d)$ (a pair is neither an ancestor nor a descendant of itself). Thus each pair $(a, b)$ has two children, it has a unique parent if $a \neq b$, and no parents otherwise. Therefore, each pair of distinct positive integers has a unique ancestor of the form $(a, a)$; our aim is now to find how many $m$-excellent descendants each such pair has.

Notice now that if a pair $(a, b)$ is $m$-excellent then $\min \{a, b\} \leqslant m$. Indeed, if $a=b$ then $f(a, a)=a=m$, so the statement is valid. Otherwise, the pair $(a, b)$ is a child of some pair $\left(a^{\prime}, b^{\prime}\right)$. If $b=b^{\prime}$ and $a=a^{\prime}+b^{\prime}$, then we should have $m=f(a, b)=f\left(a^{\prime}, b^{\prime}\right)+b^{\prime}$, so $b=b^{\prime}=m-f\left(a^{\prime}, b^{\prime}\right)<m$. Similarly, if $a=a^{\prime}$ and $b=b^{\prime}+a^{\prime}$ then $a<m$.

Let us consider the set $S_{m}$ of all pairs $(a, b)$ such that $f(a, b) \leqslant m$ and $\min \{a, b\} \leqslant m$. Then all the ancestors of the elements in $S_{m}$ are again in $S_{m}$, and each element in $S_{m}$ either is of the form $(a, a)$ with $a \leqslant m$, or has a unique ancestor of this form. From the arguments above we see that all $m$-excellent pairs lie in $S_{m}$.

We claim now that the set $S_{m}$ is finite. Indeed, assume, for instance, that it contains infinitely many pairs $(c, d)$ with $d>2 m$. Such a pair is necessarily a child of $(c, d-c)$, and thus a descendant of some pair $\left(c, d^{\prime}\right)$ with $m<d^{\prime} \leqslant 2 m$. Therefore, one of the pairs $(a, b) \in S_{m}$ with $m<b \leqslant 2 m$
has infinitely many descendants in $S_{m}$, and all these descendants have the form $(a, b+k a)$ with $k$ a positive integer. Since $f(a, b+k a)$ does not decrease as $k$ grows, it becomes constant for $k \geqslant k_{0}$, where $k_{0}$ is some positive integer. This means that $\{a \nu\}+\{(b+k a) \nu\}<1$ for all $k \geqslant k_{0}$. But this yields $1>\{(b+k a) \nu\}=\left\{\left(b+k_{0} a\right) \nu\right\}+\left(k-k_{0}\right)\{a \nu\}$ for all $k>k_{0}$, which is absurd.

Similarly, one can prove that $S_{m}$ contains finitely many pairs $(c, d)$ with $c>2 m$, thus finitely many elements at all.

We are now prepared for proving the following crucial lemma.

Lemma. Consider any pair $(a, b)$ with $f(a, b) \neq m$. Then the number $g(a, b)$ of its $m$-excellent descendants is equal to the number $h(a, b)$ of ways to represent the number $t=m-f(a, b)$ as $t=k a+\ell b$ with $k$ and $\ell$ being some nonnegative integers.

Proof. We proceed by induction on the number $N$ of descendants of $(a, b)$ in $S_{m}$. If $N=0$ then clearly $g(a, b)=0$. Assume that $h(a, b)>0$; without loss of generality, we have $a \leqslant b$. Then, clearly, $m-f(a, b) \geqslant a$, so $f(a, b+a) \leqslant f(a, b)+a \leqslant m$ and $a \leqslant m$, hence $(a, b+a) \in S_{m}$ which is impossible. Thus in the base case we have $g(a, b)=h(a, b)=0$, as desired.

Now let $N>0$. Assume that $f(a+b, b)=f(a, b)+b$ and $f(a, b+a)=f(a, b)$ (the other case is similar). If $f(a, b)+b \neq m$, then by the induction hypothesis we have

$$
g(a, b)=g(a+b, b)+g(a, b+a)=h(a+b, b)+h(a, b+a)
$$

Notice that both pairs $(a+b, b)$ and $(a, b+a)$ are descendants of $(a, b)$ and thus each of them has strictly less descendants in $S_{m}$ than $(a, b)$ does.

Next, each one of the $h(a+b, b)$ representations of $m-f(a+b, b)=m-b-f(a, b)$ as the sum $k^{\prime}(a+b)+\ell^{\prime} b$ provides the representation $m-f(a, b)=k a+\ell b$ with $k=k^{\prime}<k^{\prime}+\ell^{\prime}+1=\ell$. Similarly, each one of the $h(a, b+a)$ representations of $m-f(a, b+a)=m-f(a, b)$ as the sum $k^{\prime} a+\ell^{\prime}(b+a)$ provides the representation $m-f(a, b)=k a+\ell b$ with $k=k^{\prime}+\ell^{\prime} \geqslant \ell^{\prime}=\ell$. This correspondence is obviously bijective, so

$$
h(a, b)=h(a+b, b)+h(a, b+a)=g(a, b)
$$

as required.

Finally, if $f(a, b)+b=m$ then $(a+b, b)$ is $m$-excellent, so $g(a, b)=1+g(a, b+a)=1+h(a, b+a)$ by the induction hypothesis. On the other hand, the number $m-f(a, b)=b$ has a representation $0 \cdot a+1 \cdot b$ and sometimes one more representation as $k a+0 \cdot b$; this last representation exists simultaneously with the representation $m-f(a, b+a)=k a+0 \cdot(b+a)$, so $h(a, b)=1+h(a, b+a)$ as well. Thus in this case the step is also proved.

Now it is easy to finish the solution. There exists a unique $m$-excellent pair of the form $(a, a)$, and each other $m$-excellent pair $(a, b)$ has a unique ancestor of the form $(x, x)$ with $x<m$. By the lemma, for every $x<m$ the number of its $m$-excellent descendants is $h(x, x)$, which is the number of ways to represent $m-f(x, x)=m-x$ as $k x+\ell x$ (with nonnegative integer $k$ and $\ell$ ). This number is 0 if $x \nmid m$, and $m / x$ otherwise. So the total number of excellent pairs is

$$
1+\sum_{x \mid m, x<m} \frac{m}{x}=1+\sum_{d \mid m, d>1} d=\sum_{d \mid m} d
$$

as required.

Comment. Let us present a sketch of an outline of a different solution. The plan is to check that the number of excellent pairs does not depend on the (irrational) number $\nu$, and to find this number for some appropriate value of $\nu$. For that, we first introduce some geometrical language. We deal only with the excellent pairs $(a, b)$ with $a \neq b$.

Part I. Given an irrational positive $\nu$, for every positive integer $n$ we introduce two integral points $F_{\nu}(n)=$ $(n,\lfloor n \nu\rfloor)$ and $C_{\nu}(n)=(n,\lceil n \nu\rceil)$ on the coordinate plane $O x y$. Then $(*)$ reads as $\left[O F_{\nu}(a) C_{\nu}(b)\right]=m / 2$; here $[\cdot]$ stands for the signed area. Next, we rewrite in these terms the condition on a pair $(a, b)$ to be excellent. Let $\ell_{\nu}, \ell_{\nu}^{+}$, and $\ell_{\nu}^{-}$be the lines determined by the equations $y=\nu x, y=\nu x+1$, and $y=\nu x-1$, respectively.

a). Firstly, we deal with all excellent pairs $(a, b)$ with $a<b$. Given some value of $a$, all the points $C$ such that $\left[O F_{\nu}(a) C\right]=m / 2$ lie on some line $f_{\nu}(a)$; if there exist any good pairs $(a, b)$ at all, this line has to contain at least one integral point, which happens exactly when $\operatorname{gcd}(a,\lfloor a \nu\rfloor) \mid m$.

Let $P_{\nu}(a)$ be the point of intersection of $\ell_{\nu}^{+}$and $f_{\nu}(a)$, and let $p_{\nu}(a)$ be its abscissa; notice that $p_{\nu}(a)$ is irrational if it is nonzero. Now, if $(a, b)$ is good, then the point $C_{\nu}(b)$ lies on $f_{\nu}(a)$, which means that the point of $f_{\nu}(a)$ with abscissa $b$ lies between $\ell_{\nu}$ and $\ell_{\nu}^{+}$and is integral. If in addition the pair $(a, b-a)$ is not good, then the point of $f_{\nu}(a)$ with abscissa $b-a$ lies above $\ell_{\nu}^{+}$(see Fig. 1). Thus, the pair $(a, b)$ with $b>a$ is excellent exactly when $p_{\nu}(a)$ lies between $b-a$ and $b$, and the point of $f_{\nu}(a)$ with abscissa $b$ is integral (which means that this point is $C_{\nu}(b)$ ).

Notice now that, if $p_{\nu}(a)>a$, then the number of excellent pairs of the form $(a, b)$ (with $b>a$ ) is $\operatorname{gcd}(a,\lfloor a \nu\rfloor)$.

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-67.jpg?height=396&width=422&top_left_y=1274&top_left_x=556)

Figure 1

![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-67.jpg?height=431&width=442&top_left_y=1254&top_left_x=1123)

Figure 2

b). Analogously, considering the pairs $(a, b)$ with $a>b$, we fix the value of $b$, introduce the line $c_{\nu}(b)$ containing all the points $F$ with $\left[O F C_{\nu}(b)\right]=m / 2$, assume that this line contains an integral point (which means $\operatorname{gcd}(b,\lceil b \nu\rceil) \mid m$ ), and denote the common point of $c_{\nu}(b)$ and $\ell_{\nu}^{-}$by $Q_{\nu}(b)$, its abscissa being $q_{\nu}(b)$. Similarly to the previous case, we obtain that the pair $(a, b)$ is excellent exactly when $q_{\nu}(a)$ lies between $a-b$ and $a$, and the point of $c_{\nu}(b)$ with abscissa $a$ is integral (see Fig. 2). Again, if $q_{\nu}(b)>b$, then the number of excellent pairs of the form $(a, b)$ (with $a>b)$ is $\operatorname{gcd}(b,\lceil b \nu\rceil)$.

Part II, sketchy. Having obtained such a description, one may check how the number of excellent pairs changes as $\nu$ grows. (Having done that, one may find this number for one appropriate value of $\nu$; for instance, it is relatively easy to make this calculation for $\nu \in\left(1,1+\frac{1}{m}\right)$.)

Consider, for the initial value of $\nu$, some excellent pair $(a, t)$ with $a>t$. As $\nu$ grows, this pair eventually stops being excellent; this happens when the point $Q_{\nu}(t)$ passes through $F_{\nu}(a)$. At the same moment, the pair $(a+t, t)$ becomes excellent instead.

This process halts when the point $Q_{\nu}(t)$ eventually disappears, i.e. when $\nu$ passes through the ratio of the coordinates of the point $T=C_{\nu}(t)$. Hence, the point $T$ afterwards is regarded as $F_{\nu}(t)$. Thus, all the old excellent pairs of the form $(a, t)$ with $a>t$ disappear; on the other hand, the same number of excellent pairs with the first element being $t$ just appear.

Similarly, if some pair $(t, b)$ with $t<b$ is initially $\nu$-excellent, then at some moment it stops being excellent when $P_{\nu}(t)$ passes through $C_{\nu}(b)$; at the same moment, the pair $(t, b-t)$ becomes excellent. This process eventually stops when $b-t<t$. At this moment, again the second element of the pair becomes fixed, and the first one starts to increase.

These ideas can be made precise enough to show that the number of excellent pairs remains unchanged, as required.

We should warn the reader that the rigorous elaboration of Part II is technically quite involved, mostly by the reason that the set of moments when the collection of excellent pairs changes is infinite. Especially much care should be applied to the limit points of this set, which are exactly the points when the line $\ell_{\nu}$ passes through some point of the form $C_{\nu}(b)$.

The same ideas may be explained in an algebraic language instead of a geometrical one; the same technicalities remain in this way as well.