File size: 184,955 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 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 | 
Bremen
# International Mathematical Olympiad
Germany
## 10 to 22 July 2009
## Problem Shortlist with solutions

## Problem Shortlist with Solutions
We insistently ask everybody to consider the following IMO Regulations rule:
## These Shortlist Problems <br> have to be kept strictly confidential until IMO 2010.
## The Problem Selection Committee
Konrad Engel, Karl Fegert, Andreas Felgenhauer, Hans-Dietrich Gronau, Roger Labahn, Bernd Mulansky, Jürgen Prestin, Christian Reiher, Peter Scholze, Eckard Specht, Robert Strich, Martin Welk
gratefully received
132 problem proposals submitted by 39 countries:
Algeria, Australia, Austria, Belarus, Belgium, Bulgaria, Colombia, Croatia, Czech Republic, El Salvador, Estonia, Finland, France, Greece, Hong Kong, Hungary, India, Ireland, Islamic Republic of Iran, Japan, Democratic People's Republic of Korea, Lithuania, Luxembourg, The former Yugoslav Republic of Macedonia, Mongolia, Netherlands, New Zealand, Pakistan, Peru, Poland, Romania, Russian Federation, Slovenia, South Africa, Taiwan, Turkey, Ukraine, United Kingdom, United States of America.
Layout: Roger Labahn with $\mathrm{LATE}_{\mathrm{E}} \mathrm{X}$ \& $\mathrm{T}_{\mathrm{E}} \mathrm{X}$
Drawings: Eckard Specht with nicefig 2.0

The Problem Selection Committee
## Contents
Problem Shortlist 4
Algebra 12
Combinatorics 26
Geometry 47
Number Theory 69
## Algebra
## A1 CZE (Czech Republic)
Find the largest possible integer $k$, such that the following statement is true:
Let 2009 arbitrary non-degenerated triangles be given. In every triangle the three sides are colored, such that one is blue, one is red and one is white. Now, for every color separately, let us sort the lengths of the sides. We obtain
$$
\begin{aligned}
& b_{1} \leq b_{2} \\
& \leq \ldots \leq b_{2009} \quad \text { the lengths of the blue sides, } \\
r_{1} & \leq r_{2} \leq \ldots \leq r_{2009} \quad \text { the lengths of the red sides, } \\
\text { and } \quad w_{1} & \leq w_{2} \leq \ldots \leq w_{2009} \quad \text { the lengths of the white sides. }
\end{aligned}
$$
Then there exist $k$ indices $j$ such that we can form a non-degenerated triangle with side lengths $b_{j}, r_{j}, w_{j}$ 。
## A2 EST (Estonia)
Let $a, b, c$ be positive real numbers such that $\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=a+b+c$. Prove that
$$
\frac{1}{(2 a+b+c)^{2}}+\frac{1}{(2 b+c+a)^{2}}+\frac{1}{(2 c+a+b)^{2}} \leq \frac{3}{16}
$$
## A3 FRA (France)
Determine all functions $f$ from the set of positive integers into the set of positive integers such that for all $x$ and $y$ there exists a non degenerated triangle with sides of lengths
$$
x, \quad f(y) \quad \text { and } \quad f(y+f(x)-1)
$$
## A4 BLR (Belarus)
Let $a, b, c$ be positive real numbers such that $a b+b c+c a \leq 3 a b c$. Prove that
$$
\sqrt{\frac{a^{2}+b^{2}}{a+b}}+\sqrt{\frac{b^{2}+c^{2}}{b+c}}+\sqrt{\frac{c^{2}+a^{2}}{c+a}}+3 \leq \sqrt{2}(\sqrt{a+b}+\sqrt{b+c}+\sqrt{c+a}) .
$$
## A5 BLR (Belarus)
Let $f$ be any function that maps the set of real numbers into the set of real numbers. Prove that there exist real numbers $x$ and $y$ such that
$$
f(x-f(y))>y f(x)+x
$$
## A6 USA (United States of America)
Suppose that $s_{1}, s_{2}, s_{3}, \ldots$ is a strictly increasing sequence of positive integers such that the subsequences
$$
s_{s_{1}}, s_{s_{2}}, s_{s_{3}}, \ldots \quad \text { and } \quad s_{s_{1}+1}, s_{s_{2}+1}, s_{s_{3}+1}, \ldots
$$
are both arithmetic progressions. Prove that $s_{1}, s_{2}, s_{3}, \ldots$ is itself an arithmetic progression.
## A7 JPN (Japan)
Find all functions $f$ from the set of real numbers into the set of real numbers which satisfy for all real $x, y$ the identity
$$
f(x f(x+y))=f(y f(x))+x^{2}
$$
## Combinatorics
## C1 NZL (New Zealand)
Consider 2009 cards, each having one gold side and one black side, lying in parallel on a long table. Initially all cards show their gold sides. Two players, standing by the same long side of the table, play a game with alternating moves. Each move consists of choosing a block of 50 consecutive cards, the leftmost of which is showing gold, and turning them all over, so those which showed gold now show black and vice versa. The last player who can make a legal move wins.
(a) Does the game necessarily end?
(b) Does there exist a winning strategy for the starting player?
## C2 ROU (Romania)
For any integer $n \geq 2$, let $N(n)$ be the maximal number of triples $\left(a_{i}, b_{i}, c_{i}\right), i=1, \ldots, N(n)$, consisting of nonnegative integers $a_{i}, b_{i}$ and $c_{i}$ such that the following two conditions are satisfied:
(1) $a_{i}+b_{i}+c_{i}=n$ for all $i=1, \ldots, N(n)$,
(2) If $i \neq j$, then $a_{i} \neq a_{j}, b_{i} \neq b_{j}$ and $c_{i} \neq c_{j}$.
Determine $N(n)$ for all $n \geq 2$.
Comment. The original problem was formulated for $m$-tuples instead for triples. The numbers $N(m, n)$ are then defined similarly to $N(n)$ in the case $m=3$. The numbers $N(3, n)$ and $N(n, n)$ should be determined. The case $m=3$ is the same as in the present problem. The upper bound for $N(n, n)$ can be proved by a simple generalization. The construction of a set of triples attaining the bound can be easily done by induction from $n$ to $n+2$.
## C3 RUS (Russian Federation)
Let $n$ be a positive integer. Given a sequence $\varepsilon_{1}, \ldots, \varepsilon_{n-1}$ with $\varepsilon_{i}=0$ or $\varepsilon_{i}=1$ for each $i=1, \ldots, n-1$, the sequences $a_{0}, \ldots, a_{n}$ and $b_{0}, \ldots, b_{n}$ are constructed by the following rules:
$$
\begin{gathered}
a_{0}=b_{0}=1, \quad a_{1}=b_{1}=7, \\
a_{i+1}=\left\{\begin{array}{ll}
2 a_{i-1}+3 a_{i}, & \text { if } \varepsilon_{i}=0, \\
3 a_{i-1}+a_{i}, & \text { if } \varepsilon_{i}=1,
\end{array} \text { for each } i=1, \ldots, n-1,\right. \\
b_{i+1}=\left\{\begin{array}{ll}
2 b_{i-1}+3 b_{i}, & \text { if } \varepsilon_{n-i}=0, \\
3 b_{i-1}+b_{i}, & \text { if } \varepsilon_{n-i}=1,
\end{array} \text { for each } i=1, \ldots, n-1 .\right.
\end{gathered}
$$
Prove that $a_{n}=b_{n}$.
## C4 NLD (Netherlands)
For an integer $m \geq 1$, we consider partitions of a $2^{m} \times 2^{m}$ chessboard into rectangles consisting of cells of the chessboard, in which each of the $2^{m}$ cells along one diagonal forms a separate rectangle of side length 1 . Determine the smallest possible sum of rectangle perimeters in such a partition.
## C5 NLD (Netherlands)
Five identical empty buckets of 2-liter capacity stand at the vertices of a regular pentagon. Cinderella and her wicked Stepmother go through a sequence of rounds: At the beginning of every round, the Stepmother takes one liter of water from the nearby river and distributes it arbitrarily over the five buckets. Then Cinderella chooses a pair of neighboring buckets, empties them into the river, and puts them back. Then the next round begins. The Stepmother's goal is to make one of these buckets overflow. Cinderella's goal is to prevent this. Can the wicked Stepmother enforce a bucket overflow?
## C6 BGR (Bulgaria)
On a $999 \times 999$ board a limp rook can move in the following way: From any square it can move to any of its adjacent squares, i.e. a square having a common side with it, and every move must be a turn, i.e. the directions of any two consecutive moves must be perpendicular. A nonintersecting route of the limp rook consists of a sequence of pairwise different squares that the limp rook can visit in that order by an admissible sequence of moves. Such a non-intersecting route is called cyclic, if the limp rook can, after reaching the last square of the route, move directly to the first square of the route and start over.
How many squares does the longest possible cyclic, non-intersecting route of a limp rook visit?
## C7 RUS (Russian Federation)
Variant 1. A grasshopper jumps along the real axis. He starts at point 0 and makes 2009 jumps to the right with lengths $1,2, \ldots, 2009$ in an arbitrary order. Let $M$ be a set of 2008 positive integers less than 1005 - 2009. Prove that the grasshopper can arrange his jumps in such a way that he never lands on a point from $M$.
Variant 2. Let $n$ be a nonnegative integer. A grasshopper jumps along the real axis. He starts at point 0 and makes $n+1$ jumps to the right with pairwise different positive integral lengths $a_{1}, a_{2}, \ldots, a_{n+1}$ in an arbitrary order. Let $M$ be a set of $n$ positive integers in the interval $(0, s)$, where $s=a_{1}+a_{2}+\cdots+a_{n+1}$. Prove that the grasshopper can arrange his jumps in such a way that he never lands on a point from $M$.
## C8 AUT (Austria)
For any integer $n \geq 2$, we compute the integer $h(n)$ by applying the following procedure to its decimal representation. Let $r$ be the rightmost digit of $n$.
(1) If $r=0$, then the decimal representation of $h(n)$ results from the decimal representation of $n$ by removing this rightmost digit 0 .
(2) If $1 \leq r \leq 9$ we split the decimal representation of $n$ into a maximal right part $R$ that solely consists of digits not less than $r$ and into a left part $L$ that either is empty or ends with a digit strictly smaller than $r$. Then the decimal representation of $h(n)$ consists of the decimal representation of $L$, followed by two copies of the decimal representation of $R-1$. For instance, for the number $n=17,151,345,543$, we will have $L=17,151, R=345,543$ and $h(n)=17,151,345,542,345,542$.
Prove that, starting with an arbitrary integer $n \geq 2$, iterated application of $h$ produces the integer 1 after finitely many steps.
## Geometry
## G1 BEL (Belgium)
Let $A B C$ be a triangle with $A B=A C$. The angle bisectors of $A$ and $B$ meet the sides $B C$ and $A C$ in $D$ and $E$, respectively. Let $K$ be the incenter of triangle $A D C$. Suppose that $\angle B E K=45^{\circ}$. Find all possible values of $\angle B A C$.
## G2 RUS (Russian Federation)
Let $A B C$ be a triangle with circumcenter $O$. The points $P$ and $Q$ are interior points of the sides $C A$ and $A B$, respectively. The circle $k$ passes through the midpoints of the segments $B P$, $C Q$, and $P Q$. Prove that if the line $P Q$ is tangent to circle $k$ then $O P=O Q$.
## G3 IRN (Islamic Republic of Iran)
Let $A B C$ be a triangle. The incircle of $A B C$ touches the sides $A B$ and $A C$ at the points $Z$ and $Y$, respectively. Let $G$ be the point where the lines $B Y$ and $C Z$ meet, and let $R$ and $S$ be points such that the two quadrilaterals $B C Y R$ and $B C S Z$ are parallelograms.
Prove that $G R=G S$.
## G4 UNK (United Kingdom)
Given a cyclic quadrilateral $A B C D$, let the diagonals $A C$ and $B D$ meet at $E$ and the lines $A D$ and $B C$ meet at $F$. The midpoints of $A B$ and $C D$ are $G$ and $H$, respectively. Show that $E F$ is tangent at $E$ to the circle through the points $E, G$, and $H$.
## G5 POL (Poland)
Let $P$ be a polygon that is convex and symmetric to some point $O$. Prove that for some parallelogram $R$ satisfying $P \subset R$ we have
$$
\frac{|R|}{|P|} \leq \sqrt{2}
$$
where $|R|$ and $|P|$ denote the area of the sets $R$ and $P$, respectively.
## G6 UKR (Ukraine)
Let the sides $A D$ and $B C$ of the quadrilateral $A B C D$ (such that $A B$ is not parallel to $C D$ ) intersect at point $P$. Points $O_{1}$ and $O_{2}$ are the circumcenters and points $H_{1}$ and $H_{2}$ are the orthocenters of triangles $A B P$ and $D C P$, respectively. Denote the midpoints of segments $O_{1} H_{1}$ and $O_{2} H_{2}$ by $E_{1}$ and $E_{2}$, respectively. Prove that the perpendicular from $E_{1}$ on $C D$, the perpendicular from $E_{2}$ on $A B$ and the line $H_{1} H_{2}$ are concurrent.
## G7 IRN (Islamic Republic of Iran)
Let $A B C$ be a triangle with incenter $I$ and let $X, Y$ and $Z$ be the incenters of the triangles $B I C, C I A$ and $A I B$, respectively. Let the triangle $X Y Z$ be equilateral. Prove that $A B C$ is equilateral too.
## G8 BGR (Bulgaria)
Let $A B C D$ be a circumscribed quadrilateral. Let $g$ be a line through $A$ which meets the segment $B C$ in $M$ and the line $C D$ in $N$. Denote by $I_{1}, I_{2}$, and $I_{3}$ the incenters of $\triangle A B M$, $\triangle M N C$, and $\triangle N D A$, respectively. Show that the orthocenter of $\triangle I_{1} I_{2} I_{3}$ lies on $g$.
## Number Theory
## N1 AUS (Australia)
A social club has $n$ members. They have the membership numbers $1,2, \ldots, n$, respectively. From time to time members send presents to other members, including items they have already received as presents from other members. In order to avoid the embarrassing situation that a member might receive a present that he or she has sent to other members, the club adds the following rule to its statutes at one of its annual general meetings:
"A member with membership number $a$ is permitted to send a present to a member with membership number $b$ if and only if $a(b-1)$ is a multiple of $n$."
Prove that, if each member follows this rule, none will receive a present from another member that he or she has already sent to other members.
Alternative formulation: Let $G$ be a directed graph with $n$ vertices $v_{1}, v_{2}, \ldots, v_{n}$, such that there is an edge going from $v_{a}$ to $v_{b}$ if and only if $a$ and $b$ are distinct and $a(b-1)$ is a multiple of $n$. Prove that this graph does not contain a directed cycle.
## N2 PER (Peru)
A positive integer $N$ is called balanced, if $N=1$ or if $N$ can be written as a product of an even number of not necessarily distinct primes. Given positive integers $a$ and $b$, consider the polynomial $P$ defined by $P(x)=(x+a)(x+b)$.
(a) Prove that there exist distinct positive integers $a$ and $b$ such that all the numbers $P(1), P(2)$, $\ldots, P(50)$ are balanced.
(b) Prove that if $P(n)$ is balanced for all positive integers $n$, then $a=b$.
## N3 EST (Estonia)
Let $f$ be a non-constant function from the set of positive integers into the set of positive integers, such that $a-b$ divides $f(a)-f(b)$ for all distinct positive integers $a, b$. Prove that there exist infinitely many primes $p$ such that $p$ divides $f(c)$ for some positive integer $c$.
## N4 PRK (Democratic People's Republic of Korea)
Find all positive integers $n$ such that there exists a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{n}$ satisfying
$$
a_{k+1}=\frac{a_{k}^{2}+1}{a_{k-1}+1}-1
$$
for every $k$ with $2 \leq k \leq n-1$.
## N5 HUN (Hungary)
Let $P(x)$ be a non-constant polynomial with integer coefficients. Prove that there is no function $T$ from the set of integers into the set of integers such that the number of integers $x$ with $T^{n}(x)=x$ is equal to $P(n)$ for every $n \geq 1$, where $T^{n}$ denotes the $n$-fold application of $T$.
## N6 TUR (Turkey)
Let $k$ be a positive integer. Show that if there exists a sequence $a_{0}, a_{1}, \ldots$ of integers satisfying the condition
$$
a_{n}=\frac{a_{n-1}+n^{k}}{n} \quad \text { for all } n \geq 1
$$
then $k-2$ is divisible by 3 .
## N7 MNG (Mongolia)
Let $a$ and $b$ be distinct integers greater than 1 . Prove that there exists a positive integer $n$ such that $\left(a^{n}-1\right)\left(b^{n}-1\right)$ is not a perfect square.
## Algebra
## A1 CZE (Czech Republic)
Find the largest possible integer $k$, such that the following statement is true:
Let 2009 arbitrary non-degenerated triangles be given. In every triangle the three sides are colored, such that one is blue, one is red and one is white. Now, for every color separately, let us sort the lengths of the sides. We obtain
$$
\begin{array}{rlrl}
b_{1} & \leq b_{2} & \leq \ldots \leq b_{2009} \quad & \\
& & \text { the lengths of the blue sides, } \\
r_{1} & \leq r_{2} & \leq \ldots \leq r_{2009} \quad \text { the lengths of the red sides, } \\
w_{1} & \leq w_{2} & \leq \ldots \leq w_{2009} \quad \text { the lengths of the white sides. }
\end{array}
$$
Then there exist $k$ indices $j$ such that we can form a non-degenerated triangle with side lengths $b_{j}, r_{j}, w_{j}$ 。
Solution. We will prove that the largest possible number $k$ of indices satisfying the given condition is one.
Firstly we prove that $b_{2009}, r_{2009}, w_{2009}$ are always lengths of the sides of a triangle. Without loss of generality we may assume that $w_{2009} \geq r_{2009} \geq b_{2009}$. We show that the inequality $b_{2009}+r_{2009}>w_{2009}$ holds. Evidently, there exists a triangle with side lengths $w, b, r$ for the white, blue and red side, respectively, such that $w_{2009}=w$. By the conditions of the problem we have $b+r>w, b_{2009} \geq b$ and $r_{2009} \geq r$. From these inequalities it follows
$$
b_{2009}+r_{2009} \geq b+r>w=w_{2009}
$$
Secondly we will describe a sequence of triangles for which $w_{j}, b_{j}, r_{j}$ with $j<2009$ are not the lengths of the sides of a triangle. Let us define the sequence $\Delta_{j}, j=1,2, \ldots, 2009$, of triangles, where $\Delta_{j}$ has
a blue side of length $2 j$,
a red side of length $j$ for all $j \leq 2008$ and 4018 for $j=2009$,
and a white side of length $j+1$ for all $j \leq 2007$, 4018 for $j=2008$ and 1 for $j=2009$.
Since
$$
\begin{array}{rrrl}
(j+1)+j>2 j & \geq j+1>j, & \text { if } & j \leq 2007 \\
2 j+j>4018>2 j \quad>j, & \text { if } & j=2008 \\
4018+1>2 j & =4018>1, & \text { if } & j=2009
\end{array}
$$
such a sequence of triangles exists. Moreover, $w_{j}=j, r_{j}=j$ and $b_{j}=2 j$ for $1 \leq j \leq 2008$. Then
$$
w_{j}+r_{j}=j+j=2 j=b_{j}
$$
i.e., $b_{j}, r_{j}$ and $w_{j}$ are not the lengths of the sides of a triangle for $1 \leq j \leq 2008$.
## A2 EST (Estonia)
Let $a, b, c$ be positive real numbers such that $\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=a+b+c$. Prove that
$$
\frac{1}{(2 a+b+c)^{2}}+\frac{1}{(2 b+c+a)^{2}}+\frac{1}{(2 c+a+b)^{2}} \leq \frac{3}{16}
$$
Solution 1. For positive real numbers $x, y, z$, from the arithmetic-geometric-mean inequality,
$$
2 x+y+z=(x+y)+(x+z) \geq 2 \sqrt{(x+y)(x+z)}
$$
we obtain
$$
\frac{1}{(2 x+y+z)^{2}} \leq \frac{1}{4(x+y)(x+z)}
$$
Applying this to the left-hand side terms of the inequality to prove, we get
$$
\begin{aligned}
\frac{1}{(2 a+b+c)^{2}} & +\frac{1}{(2 b+c+a)^{2}}+\frac{1}{(2 c+a+b)^{2}} \\
& \leq \frac{1}{4(a+b)(a+c)}+\frac{1}{4(b+c)(b+a)}+\frac{1}{4(c+a)(c+b)} \\
& =\frac{(b+c)+(c+a)+(a+b)}{4(a+b)(b+c)(c+a)}=\frac{a+b+c}{2(a+b)(b+c)(c+a)} .
\end{aligned}
$$
A second application of the inequality of the arithmetic-geometric mean yields
$$
a^{2} b+a^{2} c+b^{2} a+b^{2} c+c^{2} a+c^{2} b \geq 6 a b c
$$
or, equivalently,
$$
9(a+b)(b+c)(c+a) \geq 8(a+b+c)(a b+b c+c a)
$$
The supposition $\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=a+b+c$ can be written as
$$
a b+b c+c a=a b c(a+b+c) .
$$
Applying the arithmetic-geometric-mean inequality $x^{2} y^{2}+x^{2} z^{2} \geq 2 x^{2} y z$ thrice, we get
$$
a^{2} b^{2}+b^{2} c^{2}+c^{2} a^{2} \geq a^{2} b c+a b^{2} c+a b c^{2}
$$
which is equivalent to
$$
(a b+b c+c a)^{2} \geq 3 a b c(a+b+c)
$$
Combining (1), (2), (3), and (4), we will finish the proof:
$$
\begin{aligned}
\frac{a+b+c}{2(a+b)(b+c)(c+a)} & =\frac{(a+b+c)(a b+b c+c a)}{2(a+b)(b+c)(c+a)} \cdot \frac{a b+b c+c a}{a b c(a+b+c)} \cdot \frac{a b c(a+b+c)}{(a b+b c+c a)^{2}} \\
& \leq \frac{9}{2 \cdot 8} \cdot 1 \cdot \frac{1}{3}=\frac{3}{16}
\end{aligned}
$$
Solution 2. Equivalently, we prove the homogenized inequality
$$
\frac{(a+b+c)^{2}}{(2 a+b+c)^{2}}+\frac{(a+b+c)^{2}}{(a+2 b+c)^{2}}+\frac{(a+b+c)^{2}}{(a+b+2 c)^{2}} \leq \frac{3}{16}(a+b+c)\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right)
$$
for all positive real numbers $a, b, c$. Without loss of generality we choose $a+b+c=1$. Thus, the problem is equivalent to prove for all $a, b, c>0$, fulfilling this condition, the inequality
$$
\frac{1}{(1+a)^{2}}+\frac{1}{(1+b)^{2}}+\frac{1}{(1+c)^{2}} \leq \frac{3}{16}\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right) .
$$
Applying Jensen's inequality to the function $f(x)=\frac{x}{(1+x)^{2}}$, which is concave for $0 \leq x \leq 2$ and increasing for $0 \leq x \leq 1$, we obtain
$$
\alpha \frac{a}{(1+a)^{2}}+\beta \frac{b}{(1+b)^{2}}+\gamma \frac{c}{(1+c)^{2}} \leq(\alpha+\beta+\gamma) \frac{A}{(1+A)^{2}}, \quad \text { where } \quad A=\frac{\alpha a+\beta b+\gamma c}{\alpha+\beta+\gamma}
$$
Choosing $\alpha=\frac{1}{a}, \beta=\frac{1}{b}$, and $\gamma=\frac{1}{c}$, we can apply the harmonic-arithmetic-mean inequality
$$
A=\frac{3}{\frac{1}{a}+\frac{1}{b}+\frac{1}{c}} \leq \frac{a+b+c}{3}=\frac{1}{3}<1
$$
Finally we prove (5):
$$
\begin{aligned}
\frac{1}{(1+a)^{2}}+\frac{1}{(1+b)^{2}}+\frac{1}{(1+c)^{2}} & \leq\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right) \frac{A}{(1+A)^{2}} \\
& \leq\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right) \frac{\frac{1}{3}}{\left(1+\frac{1}{3}\right)^{2}}=\frac{3}{16}\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right) .
\end{aligned}
$$
## A3 FRA (France)
Determine all functions $f$ from the set of positive integers into the set of positive integers such that for all $x$ and $y$ there exists a non degenerated triangle with sides of lengths
$$
x, \quad f(y) \quad \text { and } \quad f(y+f(x)-1) .
$$
Solution. The identity function $f(x)=x$ is the only solution of the problem.
If $f(x)=x$ for all positive integers $x$, the given three lengths are $x, y=f(y)$ and $z=$ $f(y+f(x)-1)=x+y-1$. Because of $x \geq 1, y \geq 1$ we have $z \geq \max \{x, y\}>|x-y|$ and $z<x+y$. From this it follows that a triangle with these side lengths exists and does not degenerate. We prove in several steps that there is no other solution.
Step 1. We show $f(1)=1$.
If we had $f(1)=1+m>1$ we would conclude $f(y)=f(y+m)$ for all $y$ considering the triangle with the side lengths $1, f(y)$ and $f(y+m)$. Thus, $f$ would be $m$-periodic and, consequently, bounded. Let $B$ be a bound, $f(x) \leq B$. If we choose $x>2 B$ we obtain the contradiction $x>2 B \geq f(y)+f(y+f(x)-1)$.
Step 2. For all positive integers $z$, we have $f(f(z))=z$.
Setting $x=z$ and $y=1$ this follows immediately from Step 1.
Step 3. For all integers $z \geq 1$, we have $f(z) \leq z$.
Let us show, that the contrary leads to a contradiction. Assume $w+1=f(z)>z$ for some $z$. From Step 1 we know that $w \geq z \geq 2$. Let $M=\max \{f(1), f(2), \ldots, f(w)\}$ be the largest value of $f$ for the first $w$ integers. First we show, that no positive integer $t$ exists with
$$
f(t)>\frac{z-1}{w} \cdot t+M
$$
otherwise we decompose the smallest value $t$ as $t=w r+s$ where $r$ is an integer and $1 \leq s \leq w$. Because of the definition of $M$, we have $t>w$. Setting $x=z$ and $y=t-w$ we get from the triangle inequality
$$
z+f(t-w)>f((t-w)+f(z)-1)=f(t-w+w)=f(t)
$$
Hence,
$$
f(t-w) \geq f(t)-(z-1)>\frac{z-1}{w}(t-w)+M
$$
a contradiction to the minimality of $t$.
Therefore the inequality (1) fails for all $t \geq 1$, we have proven
$$
f(t) \leq \frac{z-1}{w} \cdot t+M
$$
instead.
Now, using (2), we finish the proof of Step 3. Because of $z \leq w$ we have $\frac{z-1}{w}<1$ and we can choose an integer $t$ sufficiently large to fulfill the condition
$$
\left(\frac{z-1}{w}\right)^{2} t+\left(\frac{z-1}{w}+1\right) M<t .
$$
Applying (2) twice we get
$$
f(f(t)) \leq \frac{z-1}{w} f(t)+M \leq \frac{z-1}{w}\left(\frac{z-1}{w} t+M\right)+M<t
$$
in contradiction to Step 2, which proves Step 3.
Final step. Thus, following Step 2 and Step 3, we obtain
$$
z=f(f(z)) \leq f(z) \leq z
$$
and $f(z)=z$ for all positive integers $z$ is proven.
## A4 BLR (Belarus)
Let $a, b, c$ be positive real numbers such that $a b+b c+c a \leq 3 a b c$. Prove that
$$
\sqrt{\frac{a^{2}+b^{2}}{a+b}}+\sqrt{\frac{b^{2}+c^{2}}{b+c}}+\sqrt{\frac{c^{2}+a^{2}}{c+a}}+3 \leq \sqrt{2}(\sqrt{a+b}+\sqrt{b+c}+\sqrt{c+a}) .
$$
Solution. Starting with the terms of the right-hand side, the quadratic-arithmetic-mean inequality yields
$$
\begin{aligned}
\sqrt{2} \sqrt{a+b} & =2 \sqrt{\frac{a b}{a+b}} \sqrt{\frac{1}{2}\left(2+\frac{a^{2}+b^{2}}{a b}\right)} \\
& \geq 2 \sqrt{\frac{a b}{a+b}} \cdot \frac{1}{2}\left(\sqrt{2}+\sqrt{\frac{a^{2}+b^{2}}{a b}}\right)=\sqrt{\frac{2 a b}{a+b}}+\sqrt{\frac{a^{2}+b^{2}}{a+b}}
\end{aligned}
$$
and, analogously,
$$
\sqrt{2} \sqrt{b+c} \geq \sqrt{\frac{2 b c}{b+c}}+\sqrt{\frac{b^{2}+c^{2}}{b+c}}, \quad \sqrt{2} \sqrt{c+a} \geq \sqrt{\frac{2 c a}{c+a}}+\sqrt{\frac{c^{2}+a^{2}}{c+a}} .
$$
Applying the inequality between the arithmetic mean and the squared harmonic mean will finish the proof:
$$
\sqrt{\frac{2 a b}{a+b}}+\sqrt{\frac{2 b c}{b+c}}+\sqrt{\frac{2 c a}{c+a}} \geq 3 \cdot \sqrt{\frac{3}{\sqrt{\frac{a+b}{2 a b}}^{2}+\sqrt{\frac{b+c}{2 b c}}^{2}+\sqrt{\frac{c+a}{2 c a}}}}{ }^{2}=3 \cdot \sqrt{\frac{3 a b c}{a b+b c+c a}} \geq 3 .
$$
## A5 BLR (Belarus)
Let $f$ be any function that maps the set of real numbers into the set of real numbers. Prove that there exist real numbers $x$ and $y$ such that
$$
f(x-f(y))>y f(x)+x
$$
Solution 1. Assume that
$$
f(x-f(y)) \leq y f(x)+x \quad \text { for all real } x, y
$$
Let $a=f(0)$. Setting $y=0$ in (1) gives $f(x-a) \leq x$ for all real $x$ and, equivalently,
$$
f(y) \leq y+a \quad \text { for all real } y
$$
Setting $x=f(y)$ in (1) yields in view of (2)
$$
a=f(0) \leq y f(f(y))+f(y) \leq y f(f(y))+y+a .
$$
This implies $0 \leq y(f(f(y))+1)$ and thus
$$
f(f(y)) \geq-1 \quad \text { for all } y>0
$$
From (2) and (3) we obtain $-1 \leq f(f(y)) \leq f(y)+a$ for all $y>0$, so
$$
f(y) \geq-a-1 \quad \text { for all } y>0
$$
Now we show that
$$
f(x) \leq 0 \quad \text { for all real } x
$$
Assume the contrary, i.e. there is some $x$ such that $f(x)>0$. Take any $y$ such that
$$
y<x-a \quad \text { and } \quad y<\frac{-a-x-1}{f(x)}
$$
Then in view of (2)
$$
x-f(y) \geq x-(y+a)>0
$$
and with (1) and (4) we obtain
$$
y f(x)+x \geq f(x-f(y)) \geq-a-1,
$$
whence
$$
y \geq \frac{-a-x-1}{f(x)}
$$
contrary to our choice of $y$. Thereby, we have established (5).
Setting $x=0$ in (5) leads to $a=f(0) \leq 0$ and (2) then yields
$$
f(x) \leq x \quad \text { for all real } x
$$
Now choose $y$ such that $y>0$ and $y>-f(-1)-1$ and set $x=f(y)-1$. From (11), (5) and
(6) we obtain
$$
f(-1)=f(x-f(y)) \leq y f(x)+x=y f(f(y)-1)+f(y)-1 \leq y(f(y)-1)-1 \leq-y-1,
$$
i.e. $y \leq-f(-1)-1$, a contradiction to the choice of $y$.
Solution 2. Assume that
$$
f(x-f(y)) \leq y f(x)+x \quad \text { for all real } x, y
$$
Let $a=f(0)$. Setting $y=0$ in (7) gives $f(x-a) \leq x$ for all real $x$ and, equivalently,
$$
f(y) \leq y+a \quad \text { for all real } y
$$
Now we show that
$$
f(z) \geq 0 \quad \text { for all } z \geq 1
$$
Let $z \geq 1$ be fixed, set $b=f(z)$ and assume that $b<0$. Setting $x=w+b$ and $y=z$ in (7) gives
$$
f(w)-z f(w+b) \leq w+b \quad \text { for all real } w
$$
Applying (10) to $w, w+b, \ldots, w+(n-1) b$, where $n=1,2, \ldots$, leads to
$$
\begin{gathered}
f(w)-z^{n} f(w+n b)=(f(w)-z f(w+b))+z(f(w+b)-z f(w+2 b)) \\
+\cdots+z^{n-1}(f(w+(n-1) b)-z f(w+n b)) \\
\leq(w+b)+z(w+2 b)+\cdots+z^{n-1}(w+n b)
\end{gathered}
$$
From (8) we obtain
$$
f(w+n b) \leq w+n b+a
$$
and, thus, we have for all positive integers $n$
$$
f(w) \leq\left(1+z+\cdots+z^{n-1}+z^{n}\right) w+\left(1+2 z+\cdots+n z^{n-1}+n z^{n}\right) b+z^{n} a .
$$
With $w=0$ we get
$$
a \leq\left(1+2 z+\cdots+n z^{n-1}+n z^{n}\right) b+a z^{n} .
$$
In view of the assumption $b<0$ we find some $n$ such that
$$
a>(n b+a) z^{n}
$$
because the right hand side tends to $-\infty$ as $n \rightarrow \infty$. Now (12) and (13) give the desired contradiction and (9) is established. In addition, we have for $z=1$ the strict inequality
$$
f(1)>0 \text {. }
$$
Indeed, assume that $f(1)=0$. Then setting $w=-1$ and $z=1$ in (11) leads to
$$
f(-1) \leq-(n+1)+a
$$
which is false if $n$ is sufficiently large.
To complete the proof we set $t=\min \{-a,-2 / f(1)\}$. Setting $x=1$ and $y=t$ in (7) gives
$$
f(1-f(t)) \leq t f(1)+1 \leq-2+1=-1 .
$$
On the other hand, by (8) and the choice of $t$ we have $f(t) \leq t+a \leq 0$ and hence $1-f(t) \geq 1$. The inequality (9) yields
$$
f(1-f(t)) \geq 0
$$
which contradicts (15).
## A6 USA (United States of America)
Suppose that $s_{1}, s_{2}, s_{3}, \ldots$ is a strictly increasing sequence of positive integers such that the subsequences
$$
s_{s_{1}}, s_{s_{2}}, s_{s_{3}}, \ldots \quad \text { and } \quad s_{s_{1}+1}, s_{s_{2}+1}, s_{s_{3}+1}, \ldots
$$
are both arithmetic progressions. Prove that $s_{1}, s_{2}, s_{3}, \ldots$ is itself an arithmetic progression.
Solution 1. Let $D$ be the common difference of the progression $s_{s_{1}}, s_{s_{2}}, \ldots$. Let for $n=$ 1, 2, ...
$$
d_{n}=s_{n+1}-s_{n}
$$
We have to prove that $d_{n}$ is constant. First we show that the numbers $d_{n}$ are bounded. Indeed, by supposition $d_{n} \geq 1$ for all $n$. Thus, we have for all $n$
$$
d_{n}=s_{n+1}-s_{n} \leq d_{s_{n}}+d_{s_{n}+1}+\cdots+d_{s_{n+1}-1}=s_{s_{n+1}}-s_{s_{n}}=D .
$$
The boundedness implies that there exist
$$
m=\min \left\{d_{n}: n=1,2, \ldots\right\} \quad \text { and } \quad M=\max \left\{d_{n}: n=1,2, \ldots\right\}
$$
It suffices to show that $m=M$. Assume that $m<M$. Choose $n$ such that $d_{n}=m$. Considering a telescoping sum of $m=d_{n}=s_{n+1}-s_{n}$ items not greater than $M$ leads to
$$
D=s_{s_{n+1}}-s_{s_{n}}=s_{s_{n}+m}-s_{s_{n}}=d_{s_{n}}+d_{s_{n}+1}+\cdots+d_{s_{n}+m-1} \leq m M
$$
and equality holds if and only if all items of the sum are equal to $M$. Now choose $n$ such that $d_{n}=M$. In the same way, considering a telescoping sum of $M$ items not less than $m$ we obtain
$$
D=s_{s_{n+1}}-s_{s_{n}}=s_{s_{n}+M}-s_{s_{n}}=d_{s_{n}}+d_{s_{n}+1}+\cdots+d_{s_{n}+M-1} \geq M m
$$
and equality holds if and only if all items of the sum are equal to $m$. The inequalities (1) and (2) imply that $D=M m$ and that
$$
\begin{aligned}
d_{s_{n}}=d_{s_{n}+1}=\cdots=d_{s_{n+1}-1}=M & \text { if } d_{n}=m, \\
d_{s_{n}}=d_{s_{n}+1}=\cdots=d_{s_{n+1}-1}=m & \text { if } d_{n}=M .
\end{aligned}
$$
Hence, $d_{n}=m$ implies $d_{s_{n}}=M$. Note that $s_{n} \geq s_{1}+(n-1) \geq n$ for all $n$ and moreover $s_{n}>n$ if $d_{n}=n$, because in the case $s_{n}=n$ we would have $m=d_{n}=d_{s_{n}}=M$ in contradiction to the assumption $m<M$. In the same way $d_{n}=M$ implies $d_{s_{n}}=m$ and $s_{n}>n$. Consequently, there is a strictly increasing sequence $n_{1}, n_{2}, \ldots$ such that
$$
d_{s_{n_{1}}}=M, \quad d_{s_{n_{2}}}=m, \quad d_{s_{n_{3}}}=M, \quad d_{s_{n_{4}}}=m, \quad \ldots
$$
The sequence $d_{s_{1}}, d_{s_{2}}, \ldots$ is the sequence of pairwise differences of $s_{s_{1}+1}, s_{s_{2}+1}, \ldots$ and $s_{s_{1}}, s_{s_{2}}, \ldots$, hence also an arithmetic progression. Thus $m=M$.
Solution 2. Let the integers $D$ and $E$ be the common differences of the progressions $s_{s_{1}}, s_{s_{2}}, \ldots$ and $s_{s_{1}+1}, s_{s_{2}+1}, \ldots$, respectively. Let briefly $A=s_{s_{1}}-D$ and $B=s_{s_{1}+1}-E$. Then, for all positive integers $n$,
$$
s_{s_{n}}=A+n D, \quad s_{s_{n}+1}=B+n E
$$
Since the sequence $s_{1}, s_{2}, \ldots$ is strictly increasing, we have for all positive integers $n$
$$
s_{s_{n}}<s_{s_{n}+1} \leq s_{s_{n+1}}
$$
which implies
$$
A+n D<B+n E \leq A+(n+1) D
$$
and thereby
$$
0<B-A+n(E-D) \leq D
$$
which implies $D-E=0$ and thus
$$
0 \leq B-A \leq D
$$
Let $m=\min \left\{s_{n+1}-s_{n}: n=1,2, \ldots\right\}$. Then
$$
B-A=\left(s_{s_{1}+1}-E\right)-\left(s_{s_{1}}-D\right)=s_{s_{1}+1}-s_{s_{1}} \geq m
$$
and
$$
D=A+\left(s_{1}+1\right) D-\left(A+s_{1} D\right)=s_{s_{s_{1}+1}}-s_{s_{s_{1}}}=s_{B+D}-s_{A+D} \geq m(B-A)
$$
From (3) we consider two cases.
Case 1. $B-A=D$.
Then, for each positive integer $n, s_{s_{n}+1}=B+n D=A+(n+1) D=s_{s_{n+1}}$, hence $s_{n+1}=s_{n}+1$ and $s_{1}, s_{2}, \ldots$ is an arithmetic progression with common difference 1 .
Case 2. $B-A<D$. Choose some positive integer $N$ such that $s_{N+1}-s_{N}=m$. Then
$$
\begin{aligned}
m(A-B+D-1) & =m((A+(N+1) D)-(B+N D+1)) \\
& \leq s_{A+(N+1) D}-s_{B+N D+1}=s_{s_{s_{N+1}}}-s_{s_{s_{N}+1}+1} \\
& =\left(A+s_{N+1} D\right)-\left(B+\left(s_{N}+1\right) D\right)=\left(s_{N+1}-s_{N}\right) D+A-B-D \\
& =m D+A-B-D,
\end{aligned}
$$
i.e.,
$$
(B-A-m)+(D-m(B-A)) \leq 0
$$
The inequalities (4)-(6) imply that
$$
B-A=m \quad \text { and } \quad D=m(B-A)
$$
Assume that there is some positive integer $n$ such that $s_{n+1}>s_{n}+m$. Then $\left.m(m+1) \leq m\left(s_{n+1}-s_{n}\right) \leq s_{s_{n+1}}-s_{s_{n}}=(A+(n+1) D)-(A+n D)\right)=D=m(B-A)=m^{2}$, a contradiction. Hence $s_{1}, s_{2}, \ldots$ is an arithmetic progression with common difference $m$.
## A7 JPN (Japan)
Find all functions $f$ from the set of real numbers into the set of real numbers which satisfy for all real $x, y$ the identity
$$
f(x f(x+y))=f(y f(x))+x^{2}
$$
Solution 1. It is no hard to see that the two functions given by $f(x)=x$ and $f(x)=-x$ for all real $x$ respectively solve the functional equation. In the sequel, we prove that there are no further solutions.
Let $f$ be a function satisfying the given equation. It is clear that $f$ cannot be a constant. Let us first show that $f(0)=0$. Suppose that $f(0) \neq 0$. For any real $t$, substituting $(x, y)=\left(0, \frac{t}{f(0)}\right)$ into the given functional equation, we obtain
$$
f(0)=f(t)
$$
contradicting the fact that $f$ is not a constant function. Therefore, $f(0)=0$. Next for any $t$, substituting $(x, y)=(t, 0)$ and $(x, y)=(t,-t)$ into the given equation, we get
$$
f(t f(t))=f(0)+t^{2}=t^{2}
$$
and
$$
f(t f(0))=f(-t f(t))+t^{2}
$$
respectively. Therefore, we conclude that
$$
f(t f(t))=t^{2}, \quad f(-t f(t))=-t^{2}, \quad \text { for every real } t
$$
Consequently, for every real $v$, there exists a real $u$, such that $f(u)=v$. We also see that if $f(t)=0$, then $0=f(t f(t))=t^{2}$ so that $t=0$, and thus 0 is the only real number satisfying $f(t)=0$.
We next show that for any real number $s$,
$$
f(-s)=-f(s)
$$
This is clear if $f(s)=0$. Suppose now $f(s)<0$, then we can find a number $t$ for which $f(s)=-t^{2}$. As $t \neq 0$ implies $f(t) \neq 0$, we can also find number $a$ such that $a f(t)=s$. Substituting $(x, y)=(t, a)$ into the given equation, we get
$$
f(t f(t+a))=f(a f(t))+t^{2}=f(s)+t^{2}=0
$$
and therefore, $t f(t+a)=0$, which implies $t+a=0$, and hence $s=-t f(t)$. Consequently, $f(-s)=f(t f(t))=t^{2}=-\left(-t^{2}\right)=-f(s)$ holds in this case.
Finally, suppose $f(s)>0$ holds. Then there exists a real number $t \neq 0$ for which $f(s)=t^{2}$. Choose a number $a$ such that $t f(a)=s$. Substituting $(x, y)=(t, a-t)$ into the given equation, we get $f(s)=f(t f(a))=f((a-t) f(t))+t^{2}=f((a-t) f(t))+f(s)$. So we have $f((a-t) f(t))=0$, from which we conclude that $(a-t) f(t)=0$. Since $f(t) \neq 0$, we get $a=t$ so that $s=t f(t)$ and thus we see $f(-s)=f(-t f(t))=-t^{2}=-f(s)$ holds in this case also. This observation finishes the proof of (3).
By substituting $(x, y)=(s, t),(x, y)=(t,-s-t)$ and $(x, y)=(-s-t, s)$ into the given equation,
we obtain
$$
\begin{array}{r}
f(s f(s+t)))=f(t f(s))+s^{2} \\
f(t f(-s))=f((-s-t) f(t))+t^{2}
\end{array}
$$
and
$$
f((-s-t) f(-t))=f(s f(-s-t))+(s+t)^{2}
$$
respectively. Using the fact that $f(-x)=-f(x)$ holds for all $x$ to rewrite the second and the third equation, and rearranging the terms, we obtain
$$
\begin{aligned}
f(t f(s))-f(s f(s+t)) & =-s^{2} \\
f(t f(s))-f((s+t) f(t)) & =-t^{2} \\
f((s+t) f(t))+f(s f(s+t)) & =(s+t)^{2}
\end{aligned}
$$
Adding up these three equations now yields $2 f(t f(s))=2 t s$, and therefore, we conclude that $f(t f(s))=t s$ holds for every pair of real numbers $s, t$. By fixing $s$ so that $f(s)=1$, we obtain $f(x)=s x$. In view of the given equation, we see that $s= \pm 1$. It is easy to check that both functions $f(x)=x$ and $f(x)=-x$ satisfy the given functional equation, so these are the desired solutions.
Solution 2. As in Solution 1 we obtain (1), (2) and (3).
Now we prove that $f$ is injective. For this purpose, let us assume that $f(r)=f(s)$ for some $r \neq s$. Then, by (2)
$$
r^{2}=f(r f(r))=f(r f(s))=f((s-r) f(r))+r^{2}
$$
where the last statement follows from the given functional equation with $x=r$ and $y=s-r$. Hence, $h=(s-r) f(r)$ satisfies $f(h)=0$ which implies $h^{2}=f(h f(h))=f(0)=0$, i.e., $h=0$. Then, by $s \neq r$ we have $f(r)=0$ which implies $r=0$, and finally $f(s)=f(r)=f(0)=0$. Analogously, it follows that $s=0$ which gives the contradiction $r=s$.
To prove $|f(1)|=1$ we apply (2) with $t=1$ and also with $t=f(1)$ and obtain $f(f(1))=1$ and $(f(1))^{2}=f(f(1) \cdot f(f(1)))=f(f(1))=1$.
Now we choose $\eta \in\{-1,1\}$ with $f(1)=\eta$. Using that $f$ is odd and the given equation with $x=1, y=z$ (second equality) and with $x=-1, y=z+2$ (fourth equality) we obtain
$$
\begin{aligned}
& f(z)+2 \eta=\eta(f(z \eta)+2)=\eta(f(f(z+1))+1)=\eta(-f(-f(z+1))+1) \\
& =-\eta f((z+2) f(-1))=-\eta f((z+2)(-\eta))=\eta f((z+2) \eta)=f(z+2)
\end{aligned}
$$
Hence,
$$
f(z+2 \eta)=\eta f(\eta z+2)=\eta(f(\eta z)+2 \eta)=f(z)+2
$$
Using this argument twice we obtain
$$
f(z+4 \eta)=f(z+2 \eta)+2=f(z)+4
$$
Substituting $z=2 f(x)$ we have
$$
f(2 f(x))+4=f(2 f(x)+4 \eta)=f(2 f(x+2))
$$
where the last equality follows from (4). Applying the given functional equation we proceed to
$$
f(2 f(x+2))=f(x f(2))+4=f(2 \eta x)+4
$$
where the last equality follows again from (4) with $z=0$, i.e., $f(2)=2 \eta$. Finally, $f(2 f(x))=$ $f(2 \eta x)$ and by injectivity of $f$ we get $2 f(x)=2 \eta x$ and hence the two solutions.
## Combinatorics
## C1 NZL (New Zealand)
Consider 2009 cards, each having one gold side and one black side, lying in parallel on a long table. Initially all cards show their gold sides. Two players, standing by the same long side of the table, play a game with alternating moves. Each move consists of choosing a block of 50 consecutive cards, the leftmost of which is showing gold, and turning them all over, so those which showed gold now show black and vice versa. The last player who can make a legal move wins.
(a) Does the game necessarily end?
(b) Does there exist a winning strategy for the starting player?
Solution. (a) We interpret a card showing black as the digit 0 and a card showing gold as the digit 1. Thus each position of the 2009 cards, read from left to right, corresponds bijectively to a nonnegative integer written in binary notation of 2009 digits, where leading zeros are allowed. Each move decreases this integer, so the game must end.
(b) We show that there is no winning strategy for the starting player. We label the cards from right to left by $1, \ldots, 2009$ and consider the set $S$ of cards with labels $50 i, i=1,2, \ldots, 40$. Let $g_{n}$ be the number of cards from $S$ showing gold after $n$ moves. Obviously, $g_{0}=40$. Moreover, $\left|g_{n}-g_{n+1}\right|=1$ as long as the play goes on. Thus, after an odd number of moves, the nonstarting player finds a card from $S$ showing gold and hence can make a move. Consequently, this player always wins.
## C2 ROU (Romania)
For any integer $n \geq 2$, let $N(n)$ be the maximal number of triples $\left(a_{i}, b_{i}, c_{i}\right), i=1, \ldots, N(n)$, consisting of nonnegative integers $a_{i}, b_{i}$ and $c_{i}$ such that the following two conditions are satisfied:
(1) $a_{i}+b_{i}+c_{i}=n$ for all $i=1, \ldots, N(n)$,
(2) If $i \neq j$, then $a_{i} \neq a_{j}, b_{i} \neq b_{j}$ and $c_{i} \neq c_{j}$.
Determine $N(n)$ for all $n \geq 2$.
Comment. The original problem was formulated for $m$-tuples instead for triples. The numbers $N(m, n)$ are then defined similarly to $N(n)$ in the case $m=3$. The numbers $N(3, n)$ and $N(n, n)$ should be determined. The case $m=3$ is the same as in the present problem. The upper bound for $N(n, n)$ can be proved by a simple generalization. The construction of a set of triples attaining the bound can be easily done by induction from $n$ to $n+2$.
Solution. Let $n \geq 2$ be an integer and let $\left\{T_{1}, \ldots, T_{N}\right\}$ be any set of triples of nonnegative integers satisfying the conditions (1) and (2). Since the $a$-coordinates are pairwise distinct we have
$$
\sum_{i=1}^{N} a_{i} \geq \sum_{i=1}^{N}(i-1)=\frac{N(N-1)}{2}
$$
Analogously,
$$
\sum_{i=1}^{N} b_{i} \geq \frac{N(N-1)}{2} \quad \text { and } \quad \sum_{i=1}^{N} c_{i} \geq \frac{N(N-1)}{2}
$$
Summing these three inequalities and applying (1) yields
$$
3 \frac{N(N-1)}{2} \leq \sum_{i=1}^{N} a_{i}+\sum_{i=1}^{N} b_{i}+\sum_{i=1}^{N} c_{i}=\sum_{i=1}^{N}\left(a_{i}+b_{i}+c_{i}\right)=n N,
$$
hence $3 \frac{N-1}{2} \leq n$ and, consequently,
$$
N \leq\left\lfloor\frac{2 n}{3}\right\rfloor+1
$$
By constructing examples, we show that this upper bound can be attained, so $N(n)=\left\lfloor\frac{2 n}{3}\right\rfloor+1$.
We distinguish the cases $n=3 k-1, n=3 k$ and $n=3 k+1$ for $k \geq 1$ and present the extremal examples in form of a table.
| $n=3 k-1$ | | |
| :---: | :---: | :---: |
| $\left\lfloor\frac{2 n}{3}\right\rfloor+1=2 k$ | | |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k+1$ | $2 k-2$ |
| 1 | $k+2$ | $2 k-4$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k-1$ | $2 k$ | 0 |
| $k$ | 0 | $2 k-1$ |
| $k+1$ | 1 | $2 k-3$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k-1$ | $k-1$ | 1 |
| $n=3 k$ | | |
| :---: | :---: | :---: |
| $\rfloor+1=2 k+1$ | | |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k$ | $2 k$ |
| 1 | $k+1$ | $2 k-2$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k$ | $2 k$ | 0 |
| $k+1$ | 0 | $2 k-1$ |
| $k+2$ | 1 | $2 k-3$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k$ | $k-1$ | 1 |
| $n=3 k+1$ | | |
| :---: | :---: | :---: |
| $\left\lfloor\left\lfloor\frac{2 n}{3}\right\rfloor+1=2 k+1\right.$ | | |
| $a_{i}$ | $b_{i}$ | $c_{i}$ |
| 0 | $k$ | $2 k+1$ |
| 1 | $k+1$ | $2 k-1$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $k$ | $2 k$ | 1 |
| $k+1$ | 0 | $2 k$ |
| $k+2$ | 1 | $2 k-2$ |
| $\vdots$ | $\vdots$ | $\vdots$ |
| $2 k$ | $k-1$ | 2 |
It can be easily seen that the conditions (1) and (2) are satisfied and that we indeed have $\left\lfloor\frac{2 n}{3}\right\rfloor+1$ triples in each case.
Comment. A cute combinatorial model is given by an equilateral triangle, partitioned into $n^{2}$ congruent equilateral triangles by $n-1$ equidistant parallels to each of its three sides. Two chess-like bishops placed at any two vertices of the small triangles are said to menace one another if they lie on a same parallel. The problem is to determine the largest number of bishops that can be placed so that none menaces another. A bishop may be assigned three coordinates $a, b, c$, namely the numbers of sides of small triangles they are off each of the sides of the big triangle. It is readily seen that the sum of these coordinates is always $n$, therefore fulfilling the requirements.
## C3 RUS (Russian Federation)
Let $n$ be a positive integer. Given a sequence $\varepsilon_{1}, \ldots, \varepsilon_{n-1}$ with $\varepsilon_{i}=0$ or $\varepsilon_{i}=1$ for each $i=1, \ldots, n-1$, the sequences $a_{0}, \ldots, a_{n}$ and $b_{0}, \ldots, b_{n}$ are constructed by the following rules:
$$
\begin{gathered}
a_{0}=b_{0}=1, \quad a_{1}=b_{1}=7, \\
a_{i+1}=\left\{\begin{array}{ll}
2 a_{i-1}+3 a_{i}, & \text { if } \varepsilon_{i}=0, \\
3 a_{i-1}+a_{i}, & \text { if } \varepsilon_{i}=1,
\end{array} \text { for each } i=1, \ldots, n-1,\right. \\
b_{i+1}=\left\{\begin{array}{ll}
2 b_{i-1}+3 b_{i}, & \text { if } \varepsilon_{n-i}=0, \\
3 b_{i-1}+b_{i}, & \text { if } \varepsilon_{n-i}=1,
\end{array} \text { for each } i=1, \ldots, n-1 .\right.
\end{gathered}
$$
Prove that $a_{n}=b_{n}$.
Solution. For a binary word $w=\sigma_{1} \ldots \sigma_{n}$ of length $n$ and a letter $\sigma \in\{0,1\}$ let $w \sigma=$ $\sigma_{1} \ldots \sigma_{n} \sigma$ and $\sigma w=\sigma \sigma_{1} \ldots \sigma_{n}$. Moreover let $\bar{w}=\sigma_{n} \ldots \sigma_{1}$ and let $\emptyset$ be the empty word (of length 0 and with $\bar{\emptyset}=\emptyset$ ). Let $(u, v)$ be a pair of two real numbers. For binary words $w$ we define recursively the numbers $(u, v)^{w}$ as follows:
$$
\begin{gathered}
(u, v)^{\emptyset}=v, \quad(u, v)^{0}=2 u+3 v, \quad(u, v)^{1}=3 u+v, \\
(u, v)^{w \sigma \varepsilon}= \begin{cases}3(u, v)^{w}+3(u, v)^{w \sigma}, & \text { if } \varepsilon=0, \\
3(u, v)^{w}+(u, v)^{w \sigma}, & \text { if } \varepsilon=1\end{cases}
\end{gathered}
$$
It easily follows by induction on the length of $w$ that for all real numbers $u_{1}, v_{1}, u_{2}, v_{2}, \lambda_{1}$ and $\lambda_{2}$
$$
\left(\lambda_{1} u_{1}+\lambda_{2} u_{2}, \lambda_{1} v_{1}+\lambda_{2} v_{2}\right)^{w}=\lambda_{1}\left(u_{1}, v_{1}\right)^{w}+\lambda_{2}\left(u_{2}, v_{2}\right)^{w}
$$
and that for $\varepsilon \in\{0,1\}$
$$
(u, v)^{\varepsilon w}=\left(v,(u, v)^{\varepsilon}\right)^{w} .
$$
Obviously, for $n \geq 1$ and $w=\varepsilon_{1} \ldots \varepsilon_{n-1}$, we have $a_{n}=(1,7)^{w}$ and $b_{n}=(1,7)^{\bar{w}}$. Thus it is sufficient to prove that
$$
(1,7)^{w}=(1,7)^{\bar{w}}
$$
for each binary word $w$. We proceed by induction on the length of $w$. The assertion is obvious if $w$ has length 0 or 1 . Now let $w \sigma \varepsilon$ be a binary word of length $n \geq 2$ and suppose that the assertion is true for all binary words of length at most $n-1$.
Note that $(2,1)^{\sigma}=7=(1,7)^{\emptyset}$ for $\sigma \in\{0,1\},(1,7)^{0}=23$, and $(1,7)^{1}=10$.
First let $\varepsilon=0$. Then in view of the induction hypothesis and the equalities (1) and (2), we obtain
$$
\begin{aligned}
&(1,7)^{w \sigma 0}=2(1,7)^{w}+3(1,7)^{w \sigma}=2(1,7)^{\bar{w}}+3(1,7)^{\sigma \bar{w}}=2(2,1)^{\sigma \bar{w}}+3(1,7)^{\sigma \bar{w}} \\
&=(7,23)^{\sigma \bar{w}}=(1,7)^{0 \sigma \bar{w}}
\end{aligned}
$$
Now let $\varepsilon=1$. Analogously, we obtain
$$
\begin{aligned}
&(1,7)^{w \sigma 1}=3(1,7)^{w}+(1,7)^{w \sigma}=3(1,7)^{\bar{w}}+(1,7)^{\sigma \bar{w}}=3(2,1)^{\sigma \bar{w}}+(1,7)^{\sigma \bar{w}} \\
&=(7,10)^{\sigma \bar{w}}=(1,7)^{1 \sigma \bar{w}}
\end{aligned}
$$
Thus the induction step is complete, (3) and hence also $a_{n}=b_{n}$ are proved.
Comment. The original solution uses the relation
$$
(1,7)^{\alpha \beta w}=\left((1,7)^{w},(1,7)^{\beta w}\right)^{\alpha}, \quad \alpha, \beta \in\{0,1\}
$$
which can be proved by induction on the length of $w$. Then (3) also follows by induction on the length of $w$ :
$$
(1,7)^{\alpha \beta w}=\left((1,7)^{w},(1,7)^{\beta w}\right)^{\alpha}=\left((1,7)^{\bar{w}},(1,7)^{\bar{w} \beta}\right)^{\alpha}=(1,7)^{\bar{w} \beta \alpha} .
$$
Here $w$ may be the empty word.
## C4 NLD (Netherlands)
For an integer $m \geq 1$, we consider partitions of a $2^{m} \times 2^{m}$ chessboard into rectangles consisting of cells of the chessboard, in which each of the $2^{m}$ cells along one diagonal forms a separate rectangle of side length 1 . Determine the smallest possible sum of rectangle perimeters in such a partition.
Solution 1. For a $k \times k$ chessboard, we introduce in a standard way coordinates of the vertices of the cells and assume that the cell $C_{i j}$ in row $i$ and column $j$ has vertices $(i-1, j-1),(i-$ $1, j),(i, j-1),(i, j)$, where $i, j \in\{1, \ldots, k\}$. Without loss of generality assume that the cells $C_{i i}$, $i=1, \ldots, k$, form a separate rectangle. Then we may consider the boards $B_{k}=\bigcup_{1 \leq i<j \leq k} C_{i j}$ below that diagonal and the congruent board $B_{k}^{\prime}=\bigcup_{1 \leq j<i \leq k} C_{i j}$ above that diagonal separately because no rectangle can simultaneously cover cells from $B_{k}$ and $B_{k}^{\prime}$. We will show that for $k=2^{m}$ the smallest total perimeter of a rectangular partition of $B_{k}$ is $m 2^{m+1}$. Then the overall answer to the problem is $2 \cdot m 2^{m+1}+4 \cdot 2^{m}=(m+1) 2^{m+2}$.
First we inductively construct for $m \geq 1$ a partition of $B_{2^{m}}$ with total perimeter $m 2^{m+1}$. If $m=0$, the board $B_{2^{m}}$ is empty and the total perimeter is 0 . For $m \geq 0$, the board $B_{2^{m+1}}$ consists of a $2^{m} \times 2^{m}$ square in the lower right corner with vertices $\left(2^{m}, 2^{m}\right),\left(2^{m}, 2^{m+1}\right),\left(2^{m+1}, 2^{m}\right)$, $\left(2^{m+1}, 2^{m+1}\right)$ to which two boards congruent to $B_{2^{m}}$ are glued along the left and the upper margin. The square together with the inductive partitions of these two boards yield a partition with total perimeter $4 \cdot 2^{m}+2 \cdot m 2^{m+1}=(m+1) 2^{m+2}$ and the induction step is complete.
Let
$$
D_{k}=2 k \log _{2} k
$$
Note that $D_{k}=m 2^{m+1}$ if $k=2^{m}$. Now we show by induction on $k$ that the total perimeter of a rectangular partition of $B_{k}$ is at least $D_{k}$. The case $k=1$ is trivial (see $m=0$ from above). Let the assertion be true for all positive integers less than $k$. We investigate a fixed rectangular partition of $B_{k}$ that attains the minimal total perimeter. Let $R$ be the rectangle that covers the cell $C_{1 k}$ in the lower right corner. Let $(i, j)$ be the upper left corner of $R$. First we show that $i=j$. Assume that $i<j$. Then the line from $(i, j)$ to $(i+1, j)$ or from $(i, j)$ to $(i, j-1)$ must belong to the boundary of some rectangle in the partition. Without loss of generality assume that this is the case for the line from $(i, j)$ to $(i+1, j)$.
Case 1. No line from $(i, l)$ to $(i+1, l)$ where $j<l<k$ belongs to the boundary of some rectangle of the partition.
Then there is some rectangle $R^{\prime}$ of the partition that has with $R$ the common side from $(i, j)$ to $(i, k)$. If we join these two rectangles to one rectangle we get a partition with smaller total perimeter, a contradiction.
Case 2. There is some $l$ such that $j<l<k$ and the line from $(i, l)$ to $(i+1, l)$ belongs to the boundary of some rectangle of the partition.
Then we replace the upper side of $R$ by the line $(i+1, j)$ to $(i+1, k)$ and for the rectangles whose lower side belongs to the line from $(i, j)$ to $(i, k)$ we shift the lower side upwards so that the new lower side belongs to the line from $(i+1, j)$ to $(i+1, k)$. In such a way we obtain a rectangular partition of $B_{k}$ with smaller total perimeter, a contradiction.
Now the fact that the upper left corner of $R$ has the coordinates $(i, i)$ is established. Consequently, the partition consists of $R$, of rectangles of a partition of a board congruent to $B_{i}$ and of rectangles of a partition of a board congruent to $B_{k-i}$. By the induction hypothesis, its total
perimeter is at least
$$
2(k-i)+2 i+D_{i}+D_{k-i} \geq 2 k+2 i \log _{2} i+2(k-i) \log _{2}(k-i) .
$$
Since the function $f(x)=2 x \log _{2} x$ is convex for $x>0$, JEnSEN's inequality immediately shows that the minimum of the right hand sight of (1) is attained for $i=k / 2$. Hence the total perimeter of the optimal partition of $B_{k}$ is at least $2 k+2 k / 2 \log _{2} k / 2+2(k / 2) \log _{2}(k / 2)=D_{k}$.
Solution 2. We start as in Solution 1 and present another proof that $m 2^{m+1}$ is a lower bound for the total perimeter of a partition of $B_{2^{m}}$ into $n$ rectangles. Let briefly $M=2^{m}$. For $1 \leq i \leq M$, let $r_{i}$ denote the number of rectangles in the partition that cover some cell from row $i$ and let $c_{j}$ be the number of rectangles that cover some cell from column $j$. Note that the total perimeter $p$ of all rectangles in the partition is
$$
p=2\left(\sum_{i=1}^{M} r_{i}+\sum_{i=1}^{M} c_{i}\right) .
$$
No rectangle can simultaneously cover cells from row $i$ and from column $i$ since otherwise it would also cover the cell $C_{i i}$. We classify subsets $S$ of rectangles of the partition as follows. We say that $S$ is of type $i, 1 \leq i \leq M$, if $S$ contains all $r_{i}$ rectangles that cover some cell from row $i$, but none of the $c_{i}$ rectangles that cover some cell from column $i$. Altogether there are $2^{n-r_{i}-c_{i}}$ subsets of type $i$. Now we show that no subset $S$ can be simultaneously of type $i$ and of type $j$ if $i \neq j$. Assume the contrary and let without loss of generality $i<j$. The cell $C_{i j}$ must be covered by some rectangle $R$. The subset $S$ is of type $i$, hence $R$ is contained in $S$. $S$ is of type $j$, thus $R$ does not belong to $S$, a contradiction. Since there are $2^{n}$ subsets of rectangles of the partition, we infer
$$
2^{n} \geq \sum_{i=1}^{M} 2^{n-r_{i}-c_{i}}=2^{n} \sum_{i=1}^{M} 2^{-\left(r_{i}+c_{i}\right)}
$$
By applying Jensen's inequality to the convex function $f(x)=2^{-x}$ we derive
$$
\frac{1}{M} \sum_{i=1}^{M} 2^{-\left(r_{i}+c_{i}\right)} \geq 2^{-\frac{1}{M} \sum_{i=1}^{M}\left(r_{i}+c_{i}\right)}=2^{-\frac{p}{2 M}}
$$
From (2) and (3) we obtain
$$
1 \geq M 2^{-\frac{p}{2 M}}
$$
and equivalently
$$
p \geq m 2^{m+1}
$$
## C5 NLD (Netherlands)
Five identical empty buckets of 2-liter capacity stand at the vertices of a regular pentagon. Cinderella and her wicked Stepmother go through a sequence of rounds: At the beginning of every round, the Stepmother takes one liter of water from the nearby river and distributes it arbitrarily over the five buckets. Then Cinderella chooses a pair of neighboring buckets, empties them into the river, and puts them back. Then the next round begins. The Stepmother's goal is to make one of these buckets overflow. Cinderella's goal is to prevent this. Can the wicked Stepmother enforce a bucket overflow?
Solution 1. No, the Stepmother cannot enforce a bucket overflow and Cinderella can keep playing forever. Throughout we denote the five buckets by $B_{0}, B_{1}, B_{2}, B_{3}$, and $B_{4}$, where $B_{k}$ is adjacent to bucket $B_{k-1}$ and $B_{k+1}(k=0,1,2,3,4)$ and all indices are taken modulo 5 . Cinderella enforces that the following three conditions are satisfied at the beginning of every round:
(1) Two adjacent buckets (say $B_{1}$ and $B_{2}$ ) are empty.
(2) The two buckets standing next to these adjacent buckets (here $B_{0}$ and $B_{3}$ ) have total contents at most 1.
(3) The remaining bucket (here $B_{4}$ ) has contents at most 1 .
These conditions clearly hold at the beginning of the first round, when all buckets are empty. Assume that Cinderella manages to maintain them until the beginning of the $r$-th round $(r \geq 1)$. Denote by $x_{k}(k=0,1,2,3,4)$ the contents of bucket $B_{k}$ at the beginning of this round and by $y_{k}$ the corresponding contents after the Stepmother has distributed her liter of water in this round.
By the conditions, we can assume $x_{1}=x_{2}=0, x_{0}+x_{3} \leq 1$ and $x_{4} \leq 1$. Then, since the Stepmother adds one liter, we conclude $y_{0}+y_{1}+y_{2}+y_{3} \leq 2$. This inequality implies $y_{0}+y_{2} \leq 1$ or $y_{1}+y_{3} \leq 1$. For reasons of symmetry, we only consider the second case.
Then Cinderella empties buckets $B_{0}$ and $B_{4}$.
At the beginning of the next round $B_{0}$ and $B_{4}$ are empty (condition (1) is fulfilled), due to $y_{1}+y_{3} \leq 1$ condition (2) is fulfilled and finally since $x_{2}=0$ we also must have $y_{2} \leq 1$ (condition (3) is fulfilled).
Therefore, Cinderella can indeed manage to maintain the three conditions (1)-(3) also at the beginning of the $(r+1)$-th round. By induction, she thus manages to maintain them at the beginning of every round. In particular she manages to keep the contents of every single bucket at most 1 liter. Therefore, the buckets of 2-liter capacity will never overflow.
Solution 2. We prove that Cinderella can maintain the following two conditions and hence she can prevent the buckets from overflow:
(1') Every two non-adjacent buckets contain a total of at most 1.
(2') The total contents of all five buckets is at most $\frac{3}{2}$.
We use the same notations as in the first solution. The two conditions again clearly hold at the beginning. Assume that Cinderella maintained these two conditions until the beginning of the $r$-th round. A pair of non-neighboring buckets $\left(B_{i}, B_{i+2}\right), i=0,1,2,3,4$ is called critical
if $y_{i}+y_{i+2}>1$. By condition $\left(2^{\prime}\right)$, after the Stepmother has distributed her water we have $y_{0}+y_{1}+y_{2}+y_{3}+y_{4} \leq \frac{5}{2}$. Therefore,
$$
\left(y_{0}+y_{2}\right)+\left(y_{1}+y_{3}\right)+\left(y_{2}+y_{4}\right)+\left(y_{3}+y_{0}\right)+\left(y_{4}+y_{1}\right)=2\left(y_{0}+y_{1}+y_{2}+y_{3}+y_{4}\right) \leq 5
$$
and hence there is a pair of non-neighboring buckets which is not critical, say $\left(B_{0}, B_{2}\right)$. Now, if both of the pairs $\left(B_{3}, B_{0}\right)$ and $\left(B_{2}, B_{4}\right)$ are critical, we must have $y_{1}<\frac{1}{2}$ and Cinderella can empty the buckets $B_{3}$ and $B_{4}$. This clearly leaves no critical pair of buckets and the total contents of all the buckets is then $y_{1}+\left(y_{0}+y_{2}\right) \leq \frac{3}{2}$. Therefore, conditions $\left(1^{\prime}\right)$ and $\left(2^{\prime}\right)$ are fulfilled.
Now suppose that without loss of generality the pair $\left(B_{3}, B_{0}\right)$ is not critical. If in this case $y_{0} \leq \frac{1}{2}$, then one of the inequalities $y_{0}+y_{1}+y_{2} \leq \frac{3}{2}$ and $y_{0}+y_{3}+y_{4} \leq \frac{3}{2}$ must hold. But then Cinderella can empty $B_{3}$ and $B_{4}$ or $B_{1}$ and $B_{2}$, respectively and clearly fulfill the conditions.
Finally consider the case $y_{0}>\frac{1}{2}$. By $y_{0}+y_{1}+y_{2}+y_{3}+y_{4} \leq \frac{5}{2}$, at least one of the pairs $\left(B_{1}, B_{3}\right)$ and $\left(B_{2}, B_{4}\right)$ is not critical. Without loss of generality let this be the pair $\left(B_{1}, B_{3}\right)$. Since the pair $\left(B_{3}, B_{0}\right)$ is not critical and $y_{0}>\frac{1}{2}$, we must have $y_{3} \leq \frac{1}{2}$. But then, as before, Cinderella can maintain the two conditions at the beginning of the next round by either emptying $B_{1}$ and $B_{2}$ or $B_{4}$ and $B_{0}$.
Comments on GREEDY approaches. A natural approach for Cinderella would be a GREEDY strategy as for example: Always remove as much water as possible from the system. It is straightforward to prove that GREEDY can avoid buckets of capacity $\frac{5}{2}$ from overflowing: If before the Stepmothers move one has $x_{0}+x_{1}+x_{2}+x_{3}+x_{4} \leq \frac{3}{2}$ then after her move the inequality $Y=y_{0}+y_{1}+y_{2}+y_{3}+y_{4} \leq \frac{5}{2}$ holds. If now Cinderella removes the two adjacent buckets with maximum total contents she removes at least $\frac{2 Y}{5}$ and thus the remaining buckets contain at most $\frac{3}{5} \cdot Y \leq \frac{3}{2}$.
But GREEDY is in general not strong enough to settle this problem as can be seen in the following example:
- In an initial phase, the Stepmother brings all the buckets (after her move) to contents of at least $\frac{1}{2}-2 \epsilon$, where $\epsilon$ is an arbitrary small positive number. This can be done by always splitting the 1 liter she has to distribute so that all buckets have the same contents. After her $r$-th move the total contents of each of the buckets is then $c_{r}$ with $c_{1}=1$ and $c_{r+1}=1+\frac{3}{5} \cdot c_{r}$ and hence $c_{r}=\frac{5}{2}-\frac{3}{2} \cdot\left(\frac{3}{5}\right)^{r-1}$. So the contents of each single bucket indeed approaches $\frac{1}{2}$ (from below). In particular, any two adjacent buckets have total contents strictly less than 1 which enables the Stepmother to always refill the buckets that Cinderella just emptied and then distribute the remaining water evenly over all buckets.
- After that phase GREEDY faces a situation like this ( $\left.\frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon\right)$ and leaves a situation of the form $\left(x_{0}, x_{1}, x_{2}, x_{3}, x_{4}\right)=\left(\frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon, \frac{1}{2}-2 \epsilon, 0,0\right)$.
- Then the Stepmother can add the amounts $\left(0, \frac{1}{4}+\epsilon, \epsilon, \frac{3}{4}-2 \epsilon, 0\right)$ to achieve a situation like this: $\left(y_{0}, y_{1}, y_{2}, y_{3}, y_{4}\right)=\left(\frac{1}{2}-2 \epsilon, \frac{3}{4}-\epsilon, \frac{1}{2}-\epsilon, \frac{3}{4}-2 \epsilon, 0\right)$.
- Now $B_{1}$ and $B_{2}$ are the adjacent buckets with the maximum total contents and thus GREEDY empties them to yield $\left(x_{0}, x_{1}, x_{2}, x_{3}, x_{4}\right)=\left(\frac{1}{2}-2 \epsilon, 0,0, \frac{3}{4}-2 \epsilon, 0\right)$.
- Then the Stepmother adds $\left(\frac{5}{8}, 0,0, \frac{3}{8}, 0\right)$, which yields $\left(\frac{9}{8}-2 \epsilon, 0,0, \frac{9}{8}-2 \epsilon, 0\right)$.
- Now GREEDY can only empty one of the two nonempty buckets and in the next step the Stepmother adds her liter to the other bucket and brings it to $\frac{17}{8}-2 \epsilon$, i.e. an overflow.
A harder variant. Five identical empty buckets of capacity $b$ stand at the vertices of a regular pentagon. Cinderella and her wicked Stepmother go through a sequence of rounds: At the beginning of every round, the Stepmother takes one liter of water from the nearby river and distributes it arbitrarily over the five buckets. Then Cinderella chooses a pair of neighboring buckets, empties them into the river, and puts them back. Then the next round begins. The Stepmother's goal is to make one of these buckets overflow. Cinderella's goal is to prevent this. Determine all bucket capacities $b$ for which the Stepmother can enforce a bucket to overflow.
Solution to the harder variant. The answer is $b<2$.
The previous proof shows that for all $b \geq 2$ the Stepmother cannot enforce overflowing. Now if $b<2$, let $R$ be a positive integer such that $b<2-2^{1-R}$. In the first $R$ rounds the Stepmother now ensures that at least one of the (nonadjacent) buckets $B_{1}$ and $B_{3}$ have contents of at least $1-2^{1-r}$ at the beginning of round $r(r=1,2, \ldots, R)$. This is trivial for $r=1$ and if it holds at the beginning of round $r$, she can fill the bucket which contains at least $1-2^{1-r}$ liters with another $2^{-r}$ liters and put the rest of her water $-1-2^{-r}$ liters - in the other bucket. As Cinderella now can remove the water of at most one of the two buckets, the other bucket carries its contents into the next round.
At the beginning of the $R$-th round there are $1-2^{1-R}$ liters in $B_{1}$ or $B_{3}$. The Stepmother puts the entire liter into that bucket and produces an overflow since $b<2-2^{1-R}$.
## C6 BGR (Bulgaria)
On a $999 \times 999$ board a limp rook can move in the following way: From any square it can move to any of its adjacent squares, i.e. a square having a common side with it, and every move must be a turn, i.e. the directions of any two consecutive moves must be perpendicular. A nonintersecting route of the limp rook consists of a sequence of pairwise different squares that the limp rook can visit in that order by an admissible sequence of moves. Such a non-intersecting route is called cyclic, if the limp rook can, after reaching the last square of the route, move directly to the first square of the route and start over.
How many squares does the longest possible cyclic, non-intersecting route of a limp rook visit?
Solution. The answer is $998^{2}-4=4 \cdot\left(499^{2}-1\right)$ squares.
First we show that this number is an upper bound for the number of cells a limp rook can visit. To do this we color the cells with four colors $A, B, C$ and $D$ in the following way: for $(i, j) \equiv(0,0) \bmod 2$ use $A$, for $(i, j) \equiv(0,1) \bmod 2$ use $B$, for $(i, j) \equiv(1,0) \bmod 2$ use $C$ and for $(i, j) \equiv(1,1) \bmod 2$ use $D$. From an $A$-cell the rook has to move to a $B$-cell or a $C$-cell. In the first case, the order of the colors of the cells visited is given by $A, B, D, C, A, B, D, C, A, \ldots$, in the second case it is $A, C, D, B, A, C, D, B, A, \ldots$ Since the route is closed it must contain the same number of cells of each color. There are only $499^{2} A$-cells. In the following we will show that the rook cannot visit all the $A$-cells on its route and hence the maximum possible number of cells in a route is $4 \cdot\left(499^{2}-1\right)$.
Assume that the route passes through every single $A$-cell. Color the $A$-cells in black and white in a chessboard manner, i.e. color any two $A$-cells at distance 2 in different color. Since the number of $A$-cells is odd the rook cannot always alternate between visiting black and white $A$-cells along its route. Hence there are two $A$-cells of the same color which are four rook-steps apart that are visited directly one after the other. Let these two $A$-cells have row and column numbers $(a, b)$ and $(a+2, b+2)$ respectively.

There is up to reflection only one way the rook can take from $(a, b)$ to $(a+2, b+2)$. Let this way be $(a, b) \rightarrow(a, b+1) \rightarrow(a+1, b+1) \rightarrow(a+1, b+2) \rightarrow(a+2, b+2)$. Also let without loss of generality the color of the cell $(a, b+1)$ be $B$ (otherwise change the roles of columns and rows).
Now consider the $A$-cell $(a, b+2)$. The only way the rook can pass through it is via $(a-1, b+2) \rightarrow$ $(a, b+2) \rightarrow(a, b+3)$ in this order, since according to our assumption after every $A$-cell the rook passes through a $B$-cell. Hence, to connect these two parts of the path, there must be
a path connecting the cell $(a, b+3)$ and $(a, b)$ and also a path connecting $(a+2, b+2)$ and $(a-1, b+2)$.
But these four cells are opposite vertices of a convex quadrilateral and the paths are outside of that quadrilateral and hence they must intersect. This is due to the following fact:
The path from $(a, b)$ to $(a, b+3)$ together with the line segment joining these two cells form a closed loop that has one of the cells $(a-1, b+2)$ and $(a+2, b+2)$ in its inside and the other one on the outside. Thus the path between these two points must cross the previous path.
But an intersection is only possible if a cell is visited twice. This is a contradiction.
Hence the number of cells visited is at most $4 \cdot\left(499^{2}-1\right)$.
The following picture indicates a recursive construction for all $n \times n$-chessboards with $n \equiv 3$ $\bmod 4$ which clearly yields a path that misses exactly one $A$-cell (marked with a dot, the center cell of the $15 \times 15$-chessboard) and hence, in the case of $n=999$ crosses exactly $4 \cdot\left(499^{2}-1\right)$ cells.

## C7 RUS (Russian Federation)
Variant 1. A grasshopper jumps along the real axis. He starts at point 0 and makes 2009 jumps to the right with lengths $1,2, \ldots, 2009$ in an arbitrary order. Let $M$ be a set of 2008 positive integers less than $1005 \cdot 2009$. Prove that the grasshopper can arrange his jumps in such a way that he never lands on a point from $M$.
Variant 2. Let $n$ be a nonnegative integer. A grasshopper jumps along the real axis. He starts at point 0 and makes $n+1$ jumps to the right with pairwise different positive integral lengths $a_{1}, a_{2}, \ldots, a_{n+1}$ in an arbitrary order. Let $M$ be a set of $n$ positive integers in the interval $(0, s)$, where $s=a_{1}+a_{2}+\cdots+a_{n+1}$. Prove that the grasshopper can arrange his jumps in such a way that he never lands on a point from $M$.
Solution of Variant 1. We construct the set of landing points of the grasshopper.
Case 1. $M$ does not contain numbers divisible by 2009.
We fix the numbers $2009 k$ as landing points, $k=1,2, \ldots, 1005$. Consider the open intervals $I_{k}=(2009(k-1), 2009 k), k=1,2, \ldots, 1005$. We show that we can choose exactly one point outside of $M$ as a landing point in 1004 of these intervals such that all lengths from 1 to 2009 are realized. Since there remains one interval without a chosen point, the length 2009 indeed will appear. Each interval has length 2009, hence a new landing point in an interval yields with a length $d$ also the length $2009-d$. Thus it is enough to implement only the lengths from $D=\{1,2, \ldots, 1004\}$. We will do this in a greedy way. Let $n_{k}, k=1,2, \ldots, 1005$, be the number of elements of $M$ that belong to the interval $I_{k}$. We order these numbers in a decreasing way, so let $p_{1}, p_{2}, \ldots, p_{1005}$ be a permutation of $\{1,2, \ldots, 1005\}$ such that $n_{p_{1}} \geq n_{p_{2}} \geq \cdots \geq n_{p_{1005}}$. In $I_{p_{1}}$ we do not choose a landing point. Assume that landing points have already been chosen in the intervals $I_{p_{2}}, \ldots, I_{p_{m}}$ and the lengths $d_{2}, \ldots, d_{m}$ from $D$ are realized, $m=1, \ldots, 1004$. We show that there is some $d \in D \backslash\left\{d_{2}, \ldots, d_{m}\right\}$ that can be implemented with a new landing point in $I_{p_{m+1}}$. Assume the contrary. Then the $1004-(m-1)$ other lengths are obstructed by the $n_{p_{m+1}}$ points of $M$ in $I_{p_{m+1}}$. Each length $d$ can be realized by two landing points, namely $2009\left(p_{m+1}-1\right)+d$ and $2009 p_{m+1}-d$, hence
$$
n_{p_{m+1}} \geq 2(1005-m)
$$
Moreover, since $|M|=2008=n_{1}+\cdots+n_{1005}$,
$$
2008 \geq n_{p_{1}}+n_{p_{2}}+\cdots+n_{p_{m+1}} \geq(m+1) n_{p_{m+1}}
$$
Consequently, by (1) and (2),
$$
2008 \geq 2(m+1)(1005-m)
$$
The right hand side of the last inequality obviously attains its minimum for $m=1004$ and this minimum value is greater than 2008, a contradiction.
Case 2. $M$ does contain a number $\mu$ divisible by 2009.
By the pigeonhole principle there exists some $r \in\{1, \ldots, 2008\}$ such that $M$ does not contain numbers with remainder $r$ modulo 2009. We fix the numbers $2009(k-1)+r$ as landing points, $k=1,2, \ldots, 1005$. Moreover, $1005 \cdot 2009$ is a landing point. Consider the open intervals
$I_{k}=(2009(k-1)+r, 2009 k+r), k=1,2, \ldots, 1004$. Analogously to Case 1 , it is enough to show that we can choose in 1003 of these intervals exactly one landing point outside of $M \backslash\{\mu\}$ such that each of the lengths of $D=\{1,2, \ldots, 1004\} \backslash\{r\}$ are implemented. Note that $r$ and $2009-r$ are realized by the first and last jump and that choosing $\mu$ would realize these two differences again. Let $n_{k}, k=1,2, \ldots, 1004$, be the number of elements of $M \backslash\{\mu\}$ that belong to the interval $I_{k}$ and $p_{1}, p_{2}, \ldots, p_{1004}$ be a permutation of $\{1,2, \ldots, 1004\}$ such that $n_{p_{1}} \geq n_{p_{2}} \geq \cdots \geq n_{p_{1004}}$. With the same reasoning as in Case 1 we can verify that a greedy choice of the landing points in $I_{p_{2}}, I_{p_{3}}, \ldots, I_{p_{1004}}$ is possible. We only have to replace (1) by
$$
n_{p_{m+1}} \geq 2(1004-m)
$$
( $D$ has one element less) and (2) by
$$
2007 \geq n_{p_{1}}+n_{p_{2}}+\cdots+n_{p_{m+1}} \geq(m+1) n_{p_{m+1}}
$$
Comment. The cardinality 2008 of $M$ in the problem is the maximum possible value. For $M=\{1,2, \ldots, 2009\}$, the grasshopper necessarily lands on a point from $M$.
Solution of Variant 2. First of all we remark that the statement in the problem implies a strengthening of itself: Instead of $|M|=n$ it is sufficient to suppose that $|M \cap(0, s-\bar{a}]| \leq n$, where $\bar{a}=\min \left\{a_{1}, a_{2}, \ldots, a_{n+1}\right\}$. This fact will be used in the proof.
We prove the statement by induction on $n$. The case $n=0$ is obvious. Let $n>0$ and let the assertion be true for all nonnegative integers less than $n$. Moreover let $a_{1}, a_{2}, \ldots, a_{n+1}, s$ and $M$ be given as in the problem. Without loss of generality we may assume that $a_{n+1}<a_{n}<$ $\cdots<a_{2}<a_{1}$. Set
$$
T_{k}=\sum_{i=1}^{k} a_{i} \quad \text { for } k=0,1, \ldots, n+1
$$
Note that $0=T_{0}<T_{1}<\cdots<T_{n+1}=s$. We will make use of the induction hypothesis as follows:
Claim 1. It suffices to show that for some $m \in\{1,2, \ldots, n+1\}$ the grasshopper is able to do at least $m$ jumps without landing on a point of $M$ and, in addition, after these $m$ jumps he has jumped over at least $m$ points of $M$.
Proof. Note that $m=n+1$ is impossible by $|M|=n$. Now set $n^{\prime}=n-m$. Then $0 \leq n^{\prime}<n$. The remaining $n^{\prime}+1$ jumps can be carried out without landing on one of the remaining at most $n^{\prime}$ forbidden points by the induction hypothesis together with a shift of the origin. This proves the claim.
An integer $k \in\{1,2, \ldots, n+1\}$ is called smooth, if the grasshopper is able to do $k$ jumps with the lengths $a_{1}, a_{2}, \ldots, a_{k}$ in such a way that he never lands on a point of $M$ except for the very last jump, when he may land on a point of $M$.
Obviously, 1 is smooth. Thus there is a largest number $k^{*}$, such that all the numbers $1,2, \ldots, k^{*}$ are smooth. If $k^{*}=n+1$, the proof is complete. In the following let $k^{*} \leq n$.
Claim 2. We have
$$
T_{k^{*}} \in M \quad \text { and } \quad\left|M \cap\left(0, T_{k^{*}}\right)\right| \geq k^{*} .
$$
Proof. In the case $T_{k^{*}} \notin M$ any sequence of jumps that verifies the smoothness of $k^{*}$ can be extended by appending $a_{k^{*}+1}$, which is a contradiction to the maximality of $k^{*}$. Therefore we have $T_{k^{*}} \in M$. If $\left|M \cap\left(0, T_{k^{*}}\right)\right|<k^{*}$, there exists an $l \in\left\{1,2, \ldots, k^{*}\right\}$ with $T_{k^{*}+1}-a_{l} \notin M$. By the induction hypothesis with $k^{*}-1$ instead of $n$, the grasshopper is able to reach $T_{k^{*}+1}-a_{l}$
with $k^{*}$ jumps of lengths from $\left\{a_{1}, a_{2}, \ldots, a_{k^{*}+1}\right\} \backslash\left\{a_{l}\right\}$ without landing on any point of $M$. Therefore $k^{*}+1$ is also smooth, which is a contradiction to the maximality of $k^{*}$. Thus Claim 2 is proved.
Now, by Claim 2, there exists a smallest integer $\bar{k} \in\left\{1,2, \ldots, k^{*}\right\}$ with
$$
T_{\bar{k}} \in M \quad \text { and } \quad\left|M \cap\left(0, T_{\bar{k}}\right)\right| \geq \bar{k}
$$
Claim 3. It is sufficient to consider the case
$$
\left|M \cap\left(0, T_{\bar{k}-1}\right]\right| \leq \bar{k}-1
$$
Proof. If $\bar{k}=1$, then (4) is clearly satisfied. In the following let $\bar{k}>1$. If $T_{\bar{k}-1} \in M$, then (4.) follows immediately by the minimality of $\bar{k}$. If $T_{\bar{k}-1} \notin M$, by the smoothness of $\bar{k}-1$, we obtain a situation as in Claim 1 with $m=\bar{k}-1$ provided that $\mid M \cap\left(0, T_{\bar{k}-1}| | \geq \bar{k}-1\right.$. Hence, we may even restrict ourselves to $\mid M \cap\left(0, T_{\bar{k}-1} \mid \leq \bar{k}-2\right.$ in this case and Claim 3 is proved.
Choose an integer $v \geq 0$ with $\left|M \cap\left(0, T_{\bar{k}}\right)\right|=\bar{k}+v$. Let $r_{1}>r_{2}>\cdots>r_{l}$ be exactly those indices $r$ from $\{\bar{k}+1, \bar{k}+2, \ldots, n+1\}$ for which $T_{\bar{k}}+a_{r} \notin M$. Then
$$
n=|M|=\left|M \cap\left(0, T_{\bar{k}}\right)\right|+1+\left|M \cap\left(T_{\bar{k}}, s\right)\right| \geq \bar{k}+v+1+(n+1-\bar{k}-l)
$$
and consequently $l \geq v+2$. Note that
$T_{\bar{k}}+a_{r_{1}}-a_{1}<T_{\bar{k}}+a_{r_{1}}-a_{2}<\cdots<T_{\bar{k}}+a_{r_{1}}-a_{\bar{k}}<T_{\bar{k}}+a_{r_{2}}-a_{\bar{k}}<\cdots<T_{\bar{k}}+a_{r_{v+2}}-a_{\bar{k}}<T_{\bar{k}}$ and that this are $\bar{k}+v+1$ numbers from $\left(0, T_{\bar{k}}\right)$. Therefore we find some $r \in\{\bar{k}+1, \bar{k}+$ $2, \ldots, n+1\}$ and some $s \in\{1,2, \ldots, \bar{k}\}$ with $T_{\bar{k}}+a_{r} \notin M$ and $T_{\bar{k}}+a_{r}-a_{s} \notin M$. Consider the set of jump lengths $B=\left\{a_{1}, a_{2}, \ldots, a_{\bar{k}}, a_{r}\right\} \backslash\left\{a_{s}\right\}$. We have
$$
\sum_{x \in B} x=T_{\bar{k}}+a_{r}-a_{s}
$$
and
$$
T_{\bar{k}}+a_{r}-a_{s}-\min (B)=T_{\bar{k}}-a_{s} \leq T_{\bar{k}-1} .
$$
By (4) and the strengthening, mentioned at the very beginning with $\bar{k}-1$ instead of $n$, the grasshopper is able to reach $T_{\bar{k}}+a_{r}-a_{s}$ by $\bar{k}$ jumps with lengths from $B$ without landing on any point of $M$. From there he is able to jump to $T_{\bar{k}}+a_{r}$ and therefore we reach a situation as in Claim 1 with $m=\bar{k}+1$, which completes the proof.
## C8 AUT (Austria)
For any integer $n \geq 2$, we compute the integer $h(n)$ by applying the following procedure to its decimal representation. Let $r$ be the rightmost digit of $n$.
(1) If $r=0$, then the decimal representation of $h(n)$ results from the decimal representation of $n$ by removing this rightmost digit 0 .
(2) If $1 \leq r \leq 9$ we split the decimal representation of $n$ into a maximal right part $R$ that solely consists of digits not less than $r$ and into a left part $L$ that either is empty or ends with a digit strictly smaller than $r$. Then the decimal representation of $h(n)$ consists of the decimal representation of $L$, followed by two copies of the decimal representation of $R-1$. For instance, for the number $n=17,151,345,543$, we will have $L=17,151, R=345,543$ and $h(n)=17,151,345,542,345,542$.
Prove that, starting with an arbitrary integer $n \geq 2$, iterated application of $h$ produces the integer 1 after finitely many steps.
Solution 1. We identify integers $n \geq 2$ with the digit-strings, briefly strings, of their decimal representation and extend the definition of $h$ to all non-empty strings with digits from 0 to 9. We recursively define ten functions $f_{0}, \ldots, f_{9}$ that map some strings into integers for $k=$ $9,8, \ldots, 1,0$. The function $f_{9}$ is only defined on strings $x$ (including the empty string $\varepsilon$ ) that entirely consist of nines. If $x$ consists of $m$ nines, then $f_{9}(x)=m+1, m=0,1, \ldots$ For $k \leq 8$, the domain of $f_{k}(x)$ is the set of all strings consisting only of digits that are $\geq k$. We write $x$ in the form $x_{0} k x_{1} k x_{2} k \ldots x_{m-1} k x_{m}$ where the strings $x_{s}$ only consist of digits $\geq k+1$. Note that some of these strings might equal the empty string $\varepsilon$ and that $m=0$ is possible, i.e. the digit $k$ does not appear in $x$. Then we define
$$
f_{k}(x)=\sum_{s=0}^{m} 4^{f_{k+1}\left(x_{s}\right)}
$$
We will use the following obvious fact:
Fact 1. If $x$ does not contain digits smaller than $k$, then $f_{i}(x)=4^{f_{i+1}(x)}$ for all $i=0, \ldots, k-1$. In particular, $f_{i}(\varepsilon)=4^{9-i}$ for all $i=0,1, \ldots, 9$.
Moreover, by induction on $k=9,8, \ldots, 0$ it follows easily:
Fact 2. If the nonempty string $x$ does not contain digits smaller than $k$, then $f_{i}(x)>f_{i}(\varepsilon)$ for all $i=0, \ldots, k$.
We will show the essential fact:
Fact 3. $f_{0}(n)>f_{0}(h(n))$.
Then the empty string will necessarily be reached after a finite number of applications of $h$. But starting from a string without leading zeros, $\varepsilon$ can only be reached via the strings $1 \rightarrow 00 \rightarrow 0 \rightarrow \varepsilon$. Hence also the number 1 will appear after a finite number of applications of $h$.
Proof of Fact 3. If the last digit $r$ of $n$ is 0 , then we write $n=x_{0} 0 \ldots 0 x_{m-1} 0 \varepsilon$ where the $x_{i}$ do not contain the digit 0 . Then $h(n)=x_{0} 0 \ldots 0 x_{m-1}$ and $f_{0}(n)-f_{0}(h(n))=f_{0}(\varepsilon)>0$.
So let the last digit $r$ of $n$ be at least 1 . Let $L=y k$ and $R=z r$ be the corresponding left and right parts where $y$ is some string, $k \leq r-1$ and the string $z$ consists only of digits not less
than $r$. Then $n=y k z r$ and $h(n)=y k z(r-1) z(r-1)$. Let $d(y)$ be the smallest digit of $y$. We consider two cases which do not exclude each other.
Case 1. $d(y) \geq k$.
Then
$$
f_{k}(n)-f_{k}(h(n))=f_{k}(z r)-f_{k}(z(r-1) z(r-1)) .
$$
In view of Fact 1 this difference is positive if and only if
$$
f_{r-1}(z r)-f_{r-1}(z(r-1) z(r-1))>0
$$
We have, using Fact 2,
$$
f_{r-1}(z r)=4^{f_{r}(z r)}=4^{f_{r}(z)+4^{f_{r+1}(z)}} \geq 4 \cdot 4^{f_{r}(z)}>4^{f_{r}(z)}+4^{f_{r}(z)}+4^{f_{r}(z)}=f_{r-1}(z(r-1) z(r-1)) .
$$
Here we use the additional definition $f_{10}(\varepsilon)=0$ if $r=9$. Consequently, $f_{k}(n)-f_{k}(h(n))>0$ and according to Fact $1, f_{0}(n)-f_{0}(h(n))>0$.
Case 2. $d(y) \leq k$.
We prove by induction on $d(y)=k, k-1, \ldots, 0$ that $f_{i}(n)-f_{i}(h(n))>0$ for all $i=0, \ldots, d(y)$. By Fact 1, it suffices to do so for $i=d(y)$. The initialization $d(y)=k$ was already treated in Case 1. Let $t=d(y)<k$. Write $y$ in the form utv where $v$ does not contain digits $\leq t$. Then, in view of the induction hypothesis,
$$
f_{t}(n)-f_{t}(h(n))=f_{t}(v k z r)-f_{t}(v k z(r-1) z(r-1))=4^{f_{t+1}(v k z r)}-4^{f_{t+1}(v k z(r-1) z(r-1))}>0
$$
Thus the inequality $f_{d(y)}(n)-f_{d(y)}(h(n))>0$ is established and from Fact 1 it follows that $f_{0}(n)-f_{0}(h(n))>0$.
Solution 2. We identify integers $n \geq 2$ with the digit-strings, briefly strings, of their decimal representation and extend the definition of $h$ to all non-empty strings with digits from 0 to 9. Moreover, let us define that the empty string, $\varepsilon$, is being mapped to the empty string. In the following all functions map the set of strings into the set of strings. For two functions $f$ and $g$ let $g \circ f$ be defined by $(g \circ f)(x)=g(f(x))$ for all strings $x$ and let, for non-negative integers $n$, $f^{n}$ denote the $n$-fold application of $f$. For any string $x$ let $s(x)$ be the smallest digit of $x$, and for the empty string let $s(\varepsilon)=\infty$. We define nine functions $g_{1}, \ldots, g_{9}$ as follows: Let $k \in\{1, \ldots, 9\}$ and let $x$ be a string. If $x=\varepsilon$ then $g_{k}(x)=\varepsilon$. Otherwise, write $x$ in the form $x=y z r$ where $y$ is either the empty string or ends with a digit smaller than $k, s(z) \geq k$ and $r$ is the rightmost digit of $x$. Then $g_{k}(x)=z r$.
Lemma 1. We have $g_{k} \circ h=g_{k} \circ h \circ g_{k}$ for all $k=1, \ldots, 9$.
Proof of Lemma 1. Let $x=y z r$ be as in the definition of $g_{k}$. If $y=\varepsilon$, then $g_{k}(x)=x$, whence
$$
g_{k}(h(x))=g_{k}\left(h\left(g_{k}(x)\right) .\right.
$$
So let $y \neq \varepsilon$.
Case 1. $z$ contains a digit smaller than $r$.
Let $z=u a v$ where $a<r$ and $s(v) \geq r$. Then
$$
h(x)= \begin{cases}\text { yuav } & \text { if } r=0 \\ \operatorname{yuav}(r-1) v(r-1) & \text { if } r>0\end{cases}
$$
and
$$
h\left(g_{k}(x)\right)=h(z r)=h(\text { uavr })= \begin{cases}\operatorname{uav} & \text { if } r=0 \\ \operatorname{uav}(r-1) v(r-1) & \text { if } r>0\end{cases}
$$
Since $y$ ends with a digit smaller than $k$, (1) is obviously true.
Case 2. $z$ does not contain a digit smaller than $r$.
Let $y=u v$ where $u$ is either the empty string or ends with a digit smaller than $r$ and $s(v) \geq r$. We have
$$
h(x)= \begin{cases}u v z & \text { if } r=0 \\ u v z(r-1) v z(r-1) & \text { if } r>0\end{cases}
$$
and
$$
h\left(g_{k}(x)\right)=h(z r)= \begin{cases}z & \text { if } r=0 \\ z(r-1) z(r-1) & \text { if } r>0\end{cases}
$$
Recall that $y$ and hence $v$ ends with a digit smaller than $k$, but all digits of $v$ are at least $r$. Now if $r>k$, then $v=\varepsilon$, whence the terminal digit of $u$ is smaller than $k$, which entails
$$
g_{k}(h(x))=z(r-1) z(r-1)=g_{k}\left(h\left(g_{k}(x)\right)\right) .
$$
If $r \leq k$, then
$$
g_{k}(h(x))=z(r-1)=g_{k}\left(h\left(g_{k}(x)\right)\right),
$$
so that in both cases (1) is true. Thus Lemma 1 is proved.
Lemma 2. Let $k \in\{1, \ldots, 9\}$, let $x$ be a non-empty string and let $n$ be a positive integer. If $h^{n}(x)=\varepsilon$ then $\left(g_{k} \circ h\right)^{n}(x)=\varepsilon$.
Proof of Lemma 2. We proceed by induction on $n$. If $n=1$ we have
$$
\varepsilon=h(x)=g_{k}(h(x))=\left(g_{k} \circ h\right)(x) .
$$
Now consider the step from $n-1$ to $n$ where $n \geq 2$. Let $h^{n}(x)=\varepsilon$ and let $y=h(x)$. Then $h^{n-1}(y)=\varepsilon$ and by the induction hypothesis $\left(g_{k} \circ h\right)^{n-1}(y)=\varepsilon$. In view of Lemma 1 ,
$$
\begin{aligned}
& \varepsilon=\left(g_{k} \circ h\right)^{n-2}\left(\left(g_{k} \circ h\right)(y)\right)=\left(g_{k} \circ h\right)^{n-2}\left(g_{k}(h(y))\right. \\
&=\left(g_{k} \circ h\right)^{n-2}\left(g_{k}\left(h\left(g_{k}(y)\right)\right)=\left(g_{k} \circ h\right)^{n-2}\left(g_{k}\left(h\left(g_{k}(h(x))\right)\right)=\left(g_{k} \circ h\right)^{n}(x)\right.\right.
\end{aligned}
$$
Thus the induction step is complete and Lemma 2 is proved.
We say that the non-empty string $x$ terminates if $h^{n}(x)=\varepsilon$ for some non-negative integer $n$.
Lemma 3. Let $x=y z r$ where $s(y) \geq k, s(z) \geq k, y$ ends with the digit $k$ and $z$ is possibly empty. If $y$ and $z r$ terminate then also $x$ terminates.
Proof of Lemma 3. Suppose that $y$ and $z r$ terminate. We proceed by induction on $k$. Let $k=0$. Obviously, $h(y w)=y h(w)$ for any non-empty string $w$. Let $h^{n}(z r)=\epsilon$. It follows easily by induction on $m$ that $h^{m}(y z r)=y h^{m}(z r)$ for $m=1, \ldots, n$. Consequently, $h^{n}(y z r)=y$. Since $y$ terminates, also $x=y z r$ terminates.
Now let the assertion be true for all nonnegative integers less than $k$ and let us prove it for $k$ where $k \geq 1$. It turns out that it is sufficient to prove that $y g_{k}(h(z r))$ terminates. Indeed:
Case 1. $r=0$.
Then $h(y z r)=y z=y g_{k}(h(z r))$.
Case 2. $0<r \leq k$.
We have $h(z r)=z(r-1) z(r-1)$ and $g_{k}(h(z r))=z(r-1)$. Then $h(y z r)=y z(r-1) y z(r-$
$1)=y g_{k}(h(z r)) y g_{k}(h(z r))$ and we may apply the induction hypothesis to see that if $\left.y g_{k} h(z r)\right)$ terminates, then $h(y z r)$ terminates.
Case 3. $r>k$.
Then $h(y z r)=y h(z r)=y g_{k}(h(z r))$.
Note that $y g_{k}(h(z r))$ has the form $y z^{\prime} r^{\prime}$ where $s\left(z^{\prime}\right) \geq k$. By the same arguments it is sufficient to prove that $y g_{k}\left(h\left(z^{\prime} r^{\prime}\right)\right)=y\left(g_{k} \circ h\right)^{2}(z r)$ terminates and, by induction, that $y\left(g_{k} \circ h\right)^{m}(z r)$ terminates for some positive integer $m$. In view of Lemma 2 there is some $m$ such that $\left(g_{k} \circ\right.$ $h)^{m}(z r)=\epsilon$, so $x=y z r$ terminates if $y$ terminates. Thus Lemma 3 is proved.
Now assume that there is some string $x$ that does not terminate. We choose $x$ minimal. If $x \geq 10$, we can write $x$ in the form $x=y z r$ of Lemma 3 and by this lemma $x$ terminates since $y$ and $z r$ are smaller than $x$. If $x \leq 9$, then $h(x)=(x-1)(x-1)$ and $h(x)$ terminates again by Lemma 3 and the minimal choice of $x$.
Solution 3. We commence by introducing some terminology. Instead of integers, we will consider the set $S$ of all strings consisting of the digits $0,1, \ldots, 9$, including the empty string $\epsilon$. If $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ is a nonempty string, we let $\rho(a)=a_{n}$ denote the terminal digit of $a$ and $\lambda(a)$ be the string with the last digit removed. We also define $\lambda(\epsilon)=\epsilon$ and denote the set of non-negative integers by $\mathbb{N}_{0}$.
Now let $k \in\{0,1,2, \ldots, 9\}$ denote any digit. We define a function $f_{k}: S \longrightarrow S$ on the set of strings: First, if the terminal digit of $n$ belongs to $\{0,1, \ldots, k\}$, then $f_{k}(n)$ is obtained from $n$ by deleting this terminal digit, i.e $f_{k}(n)=\lambda(n)$. Secondly, if the terminal digit of $n$ belongs to $\{k+1, \ldots, 9\}$, then $f_{k}(n)$ is obtained from $n$ by the process described in the problem. We also define $f_{k}(\epsilon)=\epsilon$. Note that up to the definition for integers $n \leq 1$, the function $f_{0}$ coincides with the function $h$ in the problem, through interpreting integers as digit strings. The argument will be roughly as follows. We begin by introducing a straightforward generalization of our claim about $f_{0}$. Then it will be easy to see that $f_{9}$ has all these stronger properties, which means that is suffices to show for $k \in\{0,1, \ldots, 8\}$ that $f_{k}$ possesses these properties provided that $f_{k+1}$ does.
We continue to use $k$ to denote any digit. The operation $f_{k}$ is said to be separating, if the followings holds: Whenever $a$ is an initial segment of $b$, there is some $N \in \mathbb{N}_{0}$ such that $f_{k}^{N}(b)=a$. The following two notions only apply to the case where $f_{k}$ is indeed separating, otherwise they remain undefined. For every $a \in S$ we denote the least $N \in \mathbb{N}_{0}$ for which $f_{k}^{N}(a)=\epsilon$ occurs by $g_{k}(a)$ (because $\epsilon$ is an initial segment of $a$, such an $N$ exists if $f_{k}$ is separating). If for every two strings $a$ and $b$ such that $a$ is a terminal segment of $b$ one has $g_{k}(a) \leq g_{k}(b)$, we say that $f_{k}$ is coherent. In case that $f_{k}$ is separating and coherent we call the digit $k$ seductive.
As $f_{9}(a)=\lambda(a)$ for all $a$, it is obvious that 9 is seductive. Hence in order to show that 0 is seductive, which clearly implies the statement of the problem, it suffices to take any $k \in\{0,1, \ldots, 8\}$ such that $k+1$ is seductive and to prove that $k$ has to be seductive as well. Note that in doing so, we have the function $g_{k+1}$ at our disposal. We have to establish two things and we begin with
Step 1. $f_{k}$ is separating.
Before embarking on the proof of this, we record a useful observation which is easily proved by induction on $M$.
Claim 1. For any strings $A, B$ and any positive integer $M$ such that $f_{k}^{M-1}(B) \neq \epsilon$, we have
$$
f_{k}^{M}(A k B)=A k f_{k}^{M}(B)
$$
Now we call a pair $(a, b)$ of strings wicked provided that $a$ is an initial segment of $b$, but there is no $N \in \mathbb{N}_{0}$ such that $f_{k}^{N}(b)=a$. We need to show that there are none, so assume that there were such pairs. Choose a wicked pair $(a, b)$ for which $g_{k+1}(b)$ attains its minimal possible value. Obviously $b \neq \epsilon$ for any wicked pair $(a, b)$. Let $z$ denote the terminal digit of $b$. Observe that $a \neq b$, which means that $a$ is also an initial segment of $\lambda(b)$. To facilitate the construction of the eventual contradiction, we prove
Claim 2. There cannot be an $N \in \mathbb{N}_{0}$ such that
$$
f_{k}^{N}(b)=\lambda(b)
$$
Proof of Claim 2. For suppose that such an $N$ existed. Because $g_{k+1}(\lambda(b))<g_{k+1}(b)$ in view of the coherency of $f_{k+1}$, the pair $(a, \lambda(b))$ is not wicked. But then there is some $N^{\prime}$ for which $f_{k}^{N^{\prime}}(\lambda(b))=a$ which entails $f_{k}^{N+N^{\prime}}(b)=a$, contradiction. Hence Claim 2 is proved.
It follows that $z \leq k$ is impossible, for otherwise $N=1$ violated Claim 2.
Also $z>k+1$ is impossible: Set $B=f_{k}(b)$. Then also $f_{k+1}(b)=B$, but $g_{k+1}(B)<g_{k+1}(b)$ and $a$ is an initial segment of $B$. Thus the pair $(a, B)$ is not wicked. Hence there is some $N \in \mathbb{N}_{0}$ with $a=f_{k}^{N}(B)$, which, however, entails $a=f_{k}^{N+1}(b)$.
We are left with the case $z=k+1$. Let $L$ denote the left part and $R=R^{*}(k+1)$ the right part of $b$. Then we have symbolically
$$
f_{k}(b)=L R^{*} k R^{*} k, f_{k}^{2}(b)=L R^{*} k R^{*} \quad \text { and } \quad f_{k+1}(b)=L R^{*} .
$$
Using that $R^{*}$ is a terminal segment of $L R^{*}$ and the coherency of $f_{k+1}$, we infer
$$
g_{k+1}\left(R^{*}\right) \leq g_{k+1}\left(L R^{*}\right)<g_{k+1}(b)
$$
Hence the pair $\left(\epsilon, R^{*}\right)$ is not wicked, so there is some minimal $M \in \mathbb{N}_{0}$ with $f_{k}^{M}\left(R^{*}\right)=\epsilon$ and by Claim 1 it follows that $f_{k}^{2+M}(b)=L R^{*} k$. Finally, we infer that $\lambda(b)=L R^{*}=f_{k}\left(L R^{*} k\right)=$ $f_{k}^{3+M}(b)$, which yields a contradiction to Claim 2.
This final contradiction establishes that $f_{k}$ is indeed separating.
Step 2. $f_{k}$ is coherent.
To prepare the proof of this, we introduce some further pieces of terminology. A nonempty string $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ is called a hypostasis, if $a_{n}<a_{i}$ for all $i=1, \ldots, n-1$. Reading an arbitrary string $a$ backwards, we easily find a, possibly empty, sequence $\left(A_{1}, A_{2}, \ldots, A_{m}\right)$ of hypostases such that $\rho\left(A_{1}\right) \leq \rho\left(A_{2}\right) \leq \cdots \leq \rho\left(A_{m}\right)$ and, symbolically, $a=A_{1} A_{2} \ldots A_{m}$. The latter sequence is referred to as the decomposition of $a$. So, for instance, $(20,0,9)$ is the decomposition of 2009 and the string 50 is a hypostasis. Next we explain when we say about two strings $a$ and $b$ that $a$ is injectible into $b$. The definition is by induction on the length of $b$. Let $\left(B_{1}, B_{2}, \ldots, B_{n}\right)$ be the decomposition of $b$ into hypostases. Then $a$ is injectible into $b$ if for the decomposition $\left(A_{1}, A_{2}, \ldots, A_{m}\right)$ of $a$ there is a strictly increasing function $H:\{1,2, \ldots, m\} \longrightarrow\{1,2, \ldots, n\}$ satisfying
$$
\rho\left(A_{i}\right)=\rho\left(B_{H(i)}\right) \text { for all } i=1, \ldots, m \text {; }
$$
$\lambda\left(A_{i}\right)$ is injectible into $\lambda\left(B_{H(i)}\right)$ for all $i=1, \ldots, m$.
If one can choose $H$ with $H(m)=n$, then we say that $a$ is strongly injectible into $b$. Obviously, if $a$ is a terminal segment of $b$, then $a$ is strongly injectible into $b$.
Claim 3. If $a$ and $b$ are two nonempty strings such that $a$ is strongly injectible into $b$, then $\lambda(a)$ is injectible into $\lambda(b)$.
Proof of Claim 3. Let $\left(B_{1}, B_{2}, \ldots, B_{n}\right)$ be the decomposition of $b$ and let $\left(A_{1}, A_{2}, \ldots, A_{m}\right)$ be the decomposition of $a$. Take a function $H$ exemplifying that $a$ is strongly injectible into $b$. Let $\left(C_{1}, C_{2}, \ldots, C_{r}\right)$ be the decomposition of $\lambda\left(A_{m}\right)$ and let $\left(D_{1}, D_{2}, \ldots, D_{s}\right)$ be the decomposition of $\lambda\left(B_{n}\right)$. Choose a strictly increasing $H^{\prime}:\{1,2, \ldots, r\} \longrightarrow\{1,2, \ldots s\}$ witnessing that $\lambda\left(A_{m}\right)$ is injectible into $\lambda\left(B_{n}\right)$. Clearly, $\left(A_{1}, A_{2}, \ldots, A_{m-1}, C_{1}, C_{2}, \ldots, C_{r}\right)$ is the decomposition of $\lambda(a)$ and $\left(B_{1}, B_{2}, \ldots, B_{n-1}, D_{1}, D_{2}, \ldots, D_{s}\right)$ is the decomposition of $\lambda(b)$. Then the function $H^{\prime \prime}:\{1,2, \ldots, m+r-1\} \longrightarrow\{1,2, \ldots, n+s-1\}$ given by $H^{\prime \prime}(i)=H(i)$ for $i=1,2, \ldots, m-1$ and $H^{\prime \prime}(m-1+i)=n-1+H^{\prime}(i)$ for $i=1,2, \ldots, r$ exemplifies that $\lambda(a)$ is injectible into $\lambda(b)$, which finishes the proof of the claim.
A pair $(a, b)$ of strings is called aggressive if $a$ is injectible into $b$ and nevertheless $g_{k}(a)>g_{k}(b)$. Observe that if $f_{k}$ was incoherent, which we shall assume from now on, then such pairs existed. Now among all aggressive pairs we choose one, say $(a, b)$, for which $g_{k}(b)$ attains its least possible value. Obviously $f_{k}(a)$ cannot be injectible into $f_{k}(b)$, for otherwise the pair $\left(f_{k}(a), f_{k}(b)\right)$ was aggressive and contradicted our choice of $(a, b)$. Let $\left(A_{1}, A_{2}, \ldots, A_{m}\right)$ and $\left(B_{1}, B_{2}, \ldots, B_{n}\right)$ be the decompositions of $a$ and $b$ and take a function $H:\{1,2, \ldots, m\} \longrightarrow\{1,2, \ldots, n\}$ exemplifying that $a$ is indeed injectible into $b$. If we had $H(m)<n$, then $a$ was also injectible into the number $b^{\prime}$ whose decomposition is $\left(B_{1}, B_{2}, \ldots, B_{n-1}\right)$ and by separativity of $f_{k}$ we obtained $g_{k}\left(b^{\prime}\right)<g_{k}(b)$, whence the pair ( $a, b^{\prime}$ ) was also aggressive, contrary to the minimality condition imposed on $b$. Therefore $a$ is strongly injectible into $b$. In particular, $a$ and $b$ have a common terminal digit, say $z$. If we had $z \leq k$, then $f_{k}(a)=\lambda(a)$ and $f_{k}(b)=\lambda(b)$, so that by Claim $3, f_{k}(a)$ was injectible into $f_{k}(b)$, which is a contradiction. Hence, $z \geq k+1$.
Now let $r$ be the minimal element of $\{1,2, \ldots, m\}$ for which $\rho\left(A_{r}\right)=z$. Then the maximal right part of $a$ consisting of digits $\geq z$ is equal to $R_{a}$, the string whose decomposition is $\left(A_{r}, A_{r+1}, \ldots, A_{m}\right)$. Then $R_{a}-1$ is a hypostasis and $\left(A_{1}, \ldots, A_{r-1}, R_{a}-1, R_{a}-1\right)$ is the decomposition of $f_{k}(a)$. Defining $s$ and $R_{b}$ in a similar fashion with respect to $b$, we see that $\left(B_{1}, \ldots, B_{s-1}, R_{b}-1, R_{b}-1\right)$ is the decomposition of $f_{k}(b)$. The definition of injectibility then easily entails that $R_{a}$ is strongly injectible into $R_{b}$. It follows from Claim 3 that $\lambda\left(R_{a}\right)=$ $\lambda\left(R_{a}-1\right)$ is injectible into $\lambda\left(R_{b}\right)=\lambda\left(R_{b}-1\right)$, whence the function $H^{\prime}:\{1,2, \ldots, r+1\} \longrightarrow$ $\{1,2, \ldots, s+1\}$, given by $H^{\prime}(i)=H(i)$ for $i=1,2, \ldots, r-1, H^{\prime}(r)=s$ and $H^{\prime}(r+1)=s+1$ exemplifies that $f_{k}(a)$ is injectible into $f_{k}(b)$, which yields a contradiction as before.
This shows that aggressive pairs cannot exist, whence $f_{k}$ is indeed coherent, which finishes the proof of the seductivity of $k$, whereby the problem is finally solved.
## Geometry
## G1 BEL (Belgium)
Let $A B C$ be a triangle with $A B=A C$. The angle bisectors of $A$ and $B$ meet the sides $B C$ and $A C$ in $D$ and $E$, respectively. Let $K$ be the incenter of triangle $A D C$. Suppose that $\angle B E K=45^{\circ}$. Find all possible values of $\angle B A C$.
Solution 1. Answer: $\angle B A C=60^{\circ}$ or $\angle B A C=90^{\circ}$ are possible values and the only possible values.
Let $I$ be the incenter of triangle $A B C$, then $K$ lies on the line $C I$. Let $F$ be the point, where the incircle of triangle $A B C$ touches the side $A C$; then the segments $I F$ and $I D$ have the same length and are perpendicular to $A C$ and $B C$, respectively.

Figure 1

Figure 2
Let $P, Q$ and $R$ be the points where the incircle of triangle $A D C$ touches the sides $A D, D C$ and $C A$, respectively. Since $K$ and $I$ lie on the angle bisector of $\angle A C D$, the segments $I D$ and $I F$ are symmetric with respect to the line $I C$. Hence there is a point $S$ on $I F$ where the incircle of triangle $A D C$ touches the segment $I F$. Then segments $K P, K Q, K R$ and $K S$ all have the same length and are perpendicular to $A D, D C, C A$ and $I F$, respectively. So - regardless of the value of $\angle B E K$ - the quadrilateral $K R F S$ is a square and $\angle S F K=\angle K F C=45^{\circ}$.
Consider the case $\angle B A C=60^{\circ}$ (see Figure 1). Then triangle $A B C$ is equilateral. Furthermore we have $F=E$, hence $\angle B E K=\angle I F K=\angle S E K=45^{\circ}$. So $60^{\circ}$ is a possible value for $\angle B A C$.
Now consider the case $\angle B A C=90^{\circ}$ (see Figure 2). Then $\angle C B A=\angle A C B=45^{\circ}$. Furthermore, $\angle K I E=\frac{1}{2} \angle C B A+\frac{1}{2} \angle A C B=45^{\circ}, \angle A E B=180^{\circ}-90^{\circ}-22.5^{\circ}=67.5^{\circ}$ and $\angle E I A=\angle B I D=180^{\circ}-90^{\circ}-22.5^{\circ}=67.5^{\circ}$. Hence triangle $I E A$ is isosceles and a reflection of the bisector of $\angle I A E$ takes $I$ to $E$ and $K$ to itself. So triangle $I K E$ is symmetric with respect to this axis, i.e. $\angle K I E=\angle I E K=\angle B E K=45^{\circ}$. So $90^{\circ}$ is a possible value for $\angle B A C$, too.
If, on the other hand, $\angle B E K=45^{\circ}$ then $\angle B E K=\angle I E K=\angle I F K=45^{\circ}$. Then
- either $F=E$, which makes the angle bisector $B I$ be an altitude, i.e., which makes triangle $A B C$ isosceles with base $A C$ and hence equilateral and so $\angle B A C=60^{\circ}$,
- or $E$ lies between $F$ and $C$, which makes the points $K, E, F$ and $I$ concyclic, so $45^{\circ}=$ $\angle K F C=\angle K F E=\angle K I E=\angle C B I+\angle I C B=2 \cdot \angle I C B=90^{\circ}-\frac{1}{2} \angle B A C$, and so $\angle B A C=90^{\circ}$,
- or $F$ lies between $E$ and $C$, then again, $K, E, F$ and $I$ are concyclic, so $45^{\circ}=\angle K F C=$ $180^{\circ}-\angle K F E=\angle K I E$, which yields the same result $\angle B A C=90^{\circ}$. (However, for $\angle B A C=90^{\circ} E$ lies, in fact, between $F$ and $C$, see Figure 2. So this case does not occur.)
This proves $90^{\circ}$ and $60^{\circ}$ to be the only possible values for $\angle B A C$.
Solution 2. Denote angles at $A, B$ and $C$ as usual by $\alpha, \beta$ and $\gamma$. Since triangle $A B C$ is isosceles, we have $\beta=\gamma=90^{\circ}-\frac{\alpha}{2}<90^{\circ}$, so $\angle E C K=45^{\circ}-\frac{\alpha}{4}=\angle K C D$. Since $K$ is the incenter of triangle $A D C$, we have $\angle C D K=\angle K D A=45^{\circ}$; furthermore $\angle D I C=45^{\circ}+\frac{\alpha}{4}$. Now, if $\angle B E K=45^{\circ}$, easy calculations within triangles $B C E$ and $K C E$ yield
$$
\begin{aligned}
& \angle K E C=180^{\circ}-\frac{\beta}{2}-45^{\circ}-\beta=135^{\circ}-\frac{3}{2} \beta=\frac{3}{2}\left(90^{\circ}-\beta\right)=\frac{3}{4} \alpha, \\
& \angle I K E=\frac{3}{4} \alpha+45^{\circ}-\frac{\alpha}{4}=45^{\circ}+\frac{\alpha}{2} .
\end{aligned}
$$
So in triangles $I C E, I K E, I D K$ and $I D C$ we have (see Figure 3)
$$
\begin{array}{ll}
\frac{I C}{I E}=\frac{\sin \angle I E C}{\sin \angle E C I}=\frac{\sin \left(45^{\circ}+\frac{3}{4} \alpha\right)}{\sin \left(45^{\circ}-\frac{\alpha}{4}\right)}, & \frac{I E}{I K}=\frac{\sin \angle E K I}{\sin \angle I E K}=\frac{\sin \left(45^{\circ}+\frac{\alpha}{2}\right)}{\sin 45^{\circ}} \\
\frac{I K}{I D}=\frac{\sin \angle K D I}{\sin \angle I K D}=\frac{\sin 45^{\circ}}{\sin \left(90^{\circ}-\frac{\alpha}{4}\right)}, & \frac{I D}{I C}=\frac{\sin \angle I C D}{\sin \angle C D I}=\frac{\sin \left(45^{\circ}-\frac{\alpha}{4}\right)}{\sin 90^{\circ}}
\end{array}
$$

Figure 3
Multiplication of these four equations yields
$$
1=\frac{\sin \left(45^{\circ}+\frac{3}{4} \alpha\right) \sin \left(45^{\circ}+\frac{\alpha}{2}\right)}{\sin \left(90^{\circ}-\frac{\alpha}{4}\right)}
$$
But, since
$$
\begin{aligned}
\sin \left(90^{\circ}-\frac{\alpha}{4}\right) & =\cos \frac{\alpha}{4}=\cos \left(\left(45^{\circ}+\frac{3}{4} \alpha\right)-\left(45^{\circ}+\frac{\alpha}{2}\right)\right) \\
& =\cos \left(45^{\circ}+\frac{3}{4} \alpha\right) \cos \left(45^{\circ}+\frac{\alpha}{2}\right)+\sin \left(45^{\circ}+\frac{3}{4} \alpha\right) \sin \left(45^{\circ}+\frac{\alpha}{2}\right)
\end{aligned}
$$
this is equivalent to
$$
\sin \left(45^{\circ}+\frac{3}{4} \alpha\right) \sin \left(45^{\circ}+\frac{\alpha}{2}\right)=\cos \left(45^{\circ}+\frac{3}{4} \alpha\right) \cos \left(45^{\circ}+\frac{\alpha}{2}\right)+\sin \left(45^{\circ}+\frac{3}{4} \alpha\right) \sin \left(45^{\circ}+\frac{\alpha}{2}\right)
$$
and finally
$$
\cos \left(45^{\circ}+\frac{3}{4} \alpha\right) \cos \left(45^{\circ}+\frac{\alpha}{2}\right)=0
$$
But this means $\cos \left(45^{\circ}+\frac{3}{4} \alpha\right)=0$, hence $45^{\circ}+\frac{3}{4} \alpha=90^{\circ}$, i.e. $\alpha=60^{\circ}$ or $\cos \left(45^{\circ}+\frac{\alpha}{2}\right)=0$, hence $45^{\circ}+\frac{\alpha}{2}=90^{\circ}$, i.e. $\alpha=90^{\circ}$. So these values are the only two possible values for $\alpha$.
On the other hand, both $\alpha=90^{\circ}$ and $\alpha=60^{\circ}$ yield $\angle B E K=45^{\circ}$, this was shown in Solution 1.
## G2 RUS (Russian Federation)
Let $A B C$ be a triangle with circumcenter $O$. The points $P$ and $Q$ are interior points of the sides $C A$ and $A B$, respectively. The circle $k$ passes through the midpoints of the segments $B P$, $C Q$, and $P Q$. Prove that if the line $P Q$ is tangent to circle $k$ then $O P=O Q$.
Solution 1. Let $K, L, M, B^{\prime}, C^{\prime}$ be the midpoints of $B P, C Q, P Q, C A$, and $A B$, respectively (see Figure 1). Since $C A \| L M$, we have $\angle L M P=\angle Q P A$. Since $k$ touches the segment $P Q$ at $M$, we find $\angle L M P=\angle L K M$. Thus $\angle Q P A=\angle L K M$. Similarly it follows from $A B \| M K$ that $\angle P Q A=\angle K L M$. Therefore, triangles $A P Q$ and $M K L$ are similar, hence
$$
\frac{A P}{A Q}=\frac{M K}{M L}=\frac{\frac{Q B}{2}}{\frac{P C}{2}}=\frac{Q B}{P C}
$$
Now (1) is equivalent to $A P \cdot P C=A Q \cdot Q B$ which means that the power of points $P$ and $Q$ with respect to the circumcircle of $\triangle A B C$ are equal, hence $O P=O Q$.

Figure 1
Comment. The last argument can also be established by the following calculation:
$$
\begin{aligned}
O P^{2}-O Q^{2} & =O B^{\prime 2}+B^{\prime} P^{2}-O C^{2}-C^{\prime} Q^{2} \\
& =\left(O A^{2}-A B^{2}\right)+B^{\prime} P^{2}-\left(O A^{2}-A C^{\prime 2}\right)-C^{\prime} Q^{2} \\
& =\left(A C^{\prime 2}-C^{\prime} Q^{2}\right)-\left(A B^{\prime 2}-B^{\prime} P^{2}\right) \\
& =\left(A C^{\prime}-C^{\prime} Q\right)\left(A C^{\prime}+C^{\prime} Q\right)-\left(A B^{\prime}-B^{\prime} P\right)\left(A B^{\prime}+B^{\prime} P\right) \\
& =A Q \cdot Q B-A P \cdot P C .
\end{aligned}
$$
With (1), we conclude $O P^{2}-O Q^{2}=0$, as desired.
Solution 2. Again, denote by $K, L, M$ the midpoints of segments $B P, C Q$, and $P Q$, respectively. Let $O, S, T$ be the circumcenters of triangles $A B C, K L M$, and $A P Q$, respectively (see Figure 2). Note that $M K$ and $L M$ are the midlines in triangles $B P Q$ and $C P Q$, respectively, so $\overrightarrow{M K}=\frac{1}{2} \overrightarrow{Q B}$ and $\overrightarrow{M L}=\frac{1}{2} \overrightarrow{P C}$. Denote by $\operatorname{pr}_{l}(\vec{v})$ the projection of vector $\vec{v}$ onto line $l$. Then $\operatorname{pr}_{A B}(\overrightarrow{O T})=\operatorname{pr}_{A B}(\overrightarrow{O A}-\overrightarrow{T A})=\frac{1}{2} \overrightarrow{B A}-\frac{1}{2} \overrightarrow{Q A}=\frac{1}{2} \overrightarrow{B Q}=\overrightarrow{K M}$ and $\operatorname{pr}_{A B}(\overrightarrow{S M})=\operatorname{pr}_{M K}(\overrightarrow{S M})=$ $\frac{1}{2} \overrightarrow{K M}=\frac{1}{2} \operatorname{pr}_{A B}(\overrightarrow{O T})$. Analogously we get $\operatorname{pr}_{C A}(\overrightarrow{S M})=\frac{1}{2} \operatorname{pr}_{C A}(\overrightarrow{O T})$. Since $A B$ and $C A$ are not parallel, this implies that $\overrightarrow{S M}=\frac{1}{2} \overrightarrow{O T}$.

Figure 2
Now, since the circle $k$ touches $P Q$ at $M$, we get $S M \perp P Q$, hence $O T \perp P Q$. Since $T$ is equidistant from $P$ and $Q$, the line $O T$ is a perpendicular bisector of segment $P Q$, and hence $O$ is equidistant from $P$ and $Q$ which finishes the proof.
## G3 IRN (Islamic Republic of Iran)
Let $A B C$ be a triangle. The incircle of $A B C$ touches the sides $A B$ and $A C$ at the points $Z$ and $Y$, respectively. Let $G$ be the point where the lines $B Y$ and $C Z$ meet, and let $R$ and $S$ be points such that the two quadrilaterals $B C Y R$ and $B C S Z$ are parallelograms.
Prove that $G R=G S$.
Solution 1. Denote by $k$ the incircle and by $k_{a}$ the excircle opposite to $A$ of triangle $A B C$. Let $k$ and $k_{a}$ touch the side $B C$ at the points $X$ and $T$, respectively, let $k_{a}$ touch the lines $A B$ and $A C$ at the points $P$ and $Q$, respectively. We use several times the fact that opposing sides of a parallelogram are of equal length, that points of contact of the excircle and incircle to a side of a triangle lie symmetric with respect to the midpoint of this side and that segments on two tangents to a circle defined by the points of contact and their point of intersection have the same length. So we conclude
$$
\begin{gathered}
Z P=Z B+B P=X B+B T=B X+C X=Z S \text { and } \\
C Q=C T=B X=B Z=C S .
\end{gathered}
$$

So for each of the points $Z, C$, their distances to $S$ equal the length of a tangent segment from this point to $k_{a}$. It is well-known, that all points with this property lie on the line $Z C$, which is the radical axis of $S$ and $k_{a}$. Similar arguments yield that $B Y$ is the radical axis of $R$ and $k_{a}$. So the point of intersection of $Z C$ and $B Y$, which is $G$ by definition, is the radical center of $R, S$ and $k_{a}$, from which the claim $G R=G S$ follows immediately.
Solution 2. Denote $x=A Z=A Y, y=B Z=B X, z=C X=C Y, p=Z G, q=G C$. Several lengthy calculations (Menelaos' theorem in triangle $A Z C$, law of Cosines in triangles $A B C$ and $A Z C$ and Stewart's theorem in triangle $Z C S$ ) give four equations for $p, q, \cos \alpha$
and $G S$ in terms of $x, y$, and $z$ that can be resolved for $G S$. The result is symmetric in $y$ and $z$, so $G R=G S$. More in detail this means:
The line $B Y$ intersects the sides of triangle $A Z C$, so Menelaos' theorem yields $\frac{p}{q} \cdot \frac{z}{x} \cdot \frac{x+y}{y}=1$, hence
$$
\frac{p}{q}=\frac{x y}{y z+z x} .
$$
Since we only want to show that the term for $G S$ is symmetric in $y$ and $z$, we abbreviate terms that are symmetric in $y$ and $z$ by capital letters, starting with $N=x y+y z+z x$. So (1) implies
$$
\frac{p}{p+q}=\frac{x y}{x y+y z+z x}=\frac{x y}{N} \quad \text { and } \quad \frac{q}{p+q}=\frac{y z+z x}{x y+y z+z x}=\frac{y z+z x}{N} .
$$
Now the law of Cosines in triangle $A B C$ yields
$$
\cos \alpha=\frac{(x+y)^{2}+(x+z)^{2}-(y+z)^{2}}{2(x+y)(x+z)}=\frac{2 x^{2}+2 x y+2 x z-2 y z}{2(x+y)(x+z)}=1-\frac{2 y z}{(x+y)(x+z)} .
$$
We use this result to apply the law of Cosines in triangle $A Z C$ :
$$
\begin{aligned}
(p+q)^{2} & =x^{2}+(x+z)^{2}-2 x(x+z) \cos \alpha \\
& =x^{2}+(x+z)^{2}-2 x(x+z) \cdot\left(1-\frac{2 y z}{(x+y)(x+z)}\right) \\
& =z^{2}+\frac{4 x y z}{x+y} .
\end{aligned}
$$
Now in triangle $Z C S$ the segment $G S$ is a cevian, so with StEWART's theorem we have $p y^{2}+q(y+z)^{2}=(p+q)\left(G S^{2}+p q\right)$, hence
$$
G S^{2}=\frac{p}{p+q} \cdot y^{2}+\frac{q}{p+q} \cdot(y+z)^{2}-\frac{p}{p+q} \cdot \frac{q}{p+q} \cdot(p+q)^{2} .
$$
Replacing the $p$ 's and $q$ 's herein by (2) and (3) yields
$$
\begin{aligned}
G S^{2} & =\frac{x y}{N} y^{2}+\frac{y z+z x}{N}(y+z)^{2}-\frac{x y}{N} \cdot \frac{y z+z x}{N} \cdot\left(z^{2}+\frac{4 x y z}{x+y}\right) \\
& =\frac{x y^{3}}{N}+\underbrace{\frac{y z(y+z)^{2}}{N}}_{M_{1}}+\frac{z x(y+z)^{2}}{N}-\frac{x y z^{3}(x+y)}{N^{2}}-\underbrace{\frac{4 x^{2} y^{2} z^{2}}{N^{2}}}_{M_{2}} \\
& =\frac{x y^{3}+z x(y+z)^{2}}{N}-\frac{x y z^{3}(x+y)}{N^{2}}+M_{1}-M_{2} \\
& =\underbrace{\frac{x\left(y^{3}+y^{2} z+y z^{2}+z^{3}\right)}{N}}_{M_{3}}+\frac{x y z^{2} N}{N^{2}}-\frac{x y z^{3}(x+y)}{N^{2}}+M_{1}-M_{2} \\
& =\frac{x^{2} y^{2} z^{2}+x y^{2} z^{3}+x^{2} y z^{3}-x^{2} y z^{3}-x y^{2} z^{3}}{N^{2}}+M_{1}-M_{2}+M_{3} \\
& =\frac{x^{2} y^{2} z^{2}}{N^{2}}+M_{1}-M_{2}+M_{3},
\end{aligned}
$$
a term that is symmetric in $y$ and $z$, indeed.
Comment. $G$ is known as GERGONnE's point of $\triangle A B C$.
## G4 UNK (United Kingdom)
Given a cyclic quadrilateral $A B C D$, let the diagonals $A C$ and $B D$ meet at $E$ and the lines $A D$ and $B C$ meet at $F$. The midpoints of $A B$ and $C D$ are $G$ and $H$, respectively. Show that $E F$ is tangent at $E$ to the circle through the points $E, G$, and $H$.
Solution 1. It suffices to show that $\angle H E F=\angle H G E$ (see Figure 1), since in circle $E G H$ the angle over the chord $E H$ at $G$ equals the angle between the tangent at $E$ and $E H$.
First, $\angle B A D=180^{\circ}-\angle D C B=\angle F C D$. Since triangles $F A B$ and $F C D$ have also a common interior angle at $F$, they are similar.

Figure 1
Denote by $\mathcal{T}$ the transformation consisting of a reflection at the bisector of $\angle D F C$ followed by a dilation with center $F$ and factor of $\frac{F A}{F C}$. Then $\mathcal{T}$ maps $F$ to $F, C$ to $A, D$ to $B$, and $H$ to $G$. To see this, note that $\triangle F C A \sim \triangle F D B$, so $\frac{F A}{F C}=\frac{F B}{F D}$. Moreover, as $\angle A D B=\angle A C B$, the image of the line $D E$ under $\mathcal{T}$ is parallel to $A C$ (and passes through $B$ ) and similarly the image of $C E$ is parallel to $D B$ and passes through $A$. Hence $E$ is mapped to the point $X$ which is the fourth vertex of the parallelogram $B E A X$. Thus, in particular $\angle H E F=\angle F X G$.
As $G$ is the midpoint of the diagonal $A B$ of the parallelogram $B E A X$, it is also the midpoint of $E X$. In particular, $E, G, X$ are collinear, and $E X=2 \cdot E G$.
Denote by $Y$ the fourth vertex of the parallelogram $D E C Y$. By an analogous reasoning as before, it follows that $\mathcal{T}$ maps $Y$ to $E$, thus $E, H, Y$ are collinear with $E Y=2 \cdot E H$. Therefore, by the intercept theorem, $H G \| X Y$.
From the construction of $\mathcal{T}$ it is clear that the lines $F X$ and $F E$ are symmetric with respect to the bisector of $\angle D F C$, as are $F Y$ and $F E$. Thus, $F, X, Y$ are collinear, which together with $H G \| X Y$ implies $\angle F X E=\angle H G E$. This completes the proof.
Solution 2. We use the following
Lemma (Gauß). Let $A B C D$ be a quadrilateral. Let $A B$ and $C D$ intersect at $P$, and $B C$ and $D A$ intersect at $Q$. Then the midpoints $K, L, M$ of $A C, B D$, and $P Q$, respectively, are collinear.
Proof: Let us consider the points $Z$ that fulfill the equation
$$
(A B Z)+(C D Z)=(B C Z)+(D A Z)
$$
where $(R S T)$ denotes the oriented area of the triangle $R S T$ (see Figure 2).

Figure 2
As (1) is linear in $Z$, it can either characterize a line, or be contradictory, or be trivially fulfilled for all $Z$ in the plane. If (1) was fulfilled for all $Z$, then it would hold for $Z=A, Z=B$, which gives $(C D A)=(B C A),(C D B)=(D A B)$, respectively, i.e. the diagonals of $A B C D$ would bisect each other, thus $A B C D$ would be a parallelogram. This contradicts the hypothesis that $A D$ and $B C$ intersect. Since $E, F, G$ fulfill (1), it is the equation of a line which completes the proof of the lemma.
Now consider the parallelograms $E A X B$ and $E C Y D$ (see Figure 1). Then $G, H$ are the midpoints of $E X, E Y$, respectively. Let $M$ be the midpoint of $E F$. By applying the Lemma to the (re-entrant) quadrilateral $A D B C$, it is evident that $G, H$, and $M$ are collinear. A dilation by a factor of 2 with center $E$ shows that $X, Y, F$ are collinear. Since $A X \| D E$ and $B X \| C E$, we have pairwise equal interior angles in the quadrilaterals $F D E C$ and $F B X A$. Since we have also $\angle E B A=\angle D C A=\angle C D Y$, the quadrilaterals are similar. Thus, $\angle F X A=\angle C E F$.
Clearly the parallelograms $E C Y D$ and $E B X A$ are similar, too, thus $\angle E X A=\angle C E Y$. Consequently, $\angle F X E=\angle F X A-\angle E X A=\angle C E F-\angle C E Y=\angle Y E F$. By the converse of the tangent-chord angle theorem $E F$ is tangent to the circle $X E Y$. A dilation by a factor of $\frac{1}{2}$ completes the proof.
Solution 3. As in Solution $2, G, H, M$ are proven to be collinear. It suffices to show that $M E^{2}=M G \cdot M H$. If $\boldsymbol{p}=\overrightarrow{O P}$ denotes the vector from circumcenter $O$ to point $P$, the claim becomes
$$
\left(\frac{\boldsymbol{e}-\boldsymbol{f}}{2}\right)^{2}=\left(\frac{\boldsymbol{e}+\boldsymbol{f}}{2}-\frac{\boldsymbol{a}+\boldsymbol{b}}{2}\right)\left(\frac{\boldsymbol{e}+\boldsymbol{f}}{2}-\frac{\boldsymbol{c}+\boldsymbol{d}}{2}\right)
$$
or equivalently
$$
4 \boldsymbol{e f}-(\boldsymbol{e}+\boldsymbol{f})(\boldsymbol{a}+\boldsymbol{b}+\boldsymbol{c}+\boldsymbol{d})+(\boldsymbol{a}+\boldsymbol{b})(\boldsymbol{c}+\boldsymbol{d})=0
$$
With $R$ as the circumradius of $A B C D$, we obtain for the powers $\mathcal{P}(E)$ and $\mathcal{P}(F)$ of $E$ and $F$, respectively, with respect to the circumcircle
$$
\begin{aligned}
& \mathcal{P}(E)=(\boldsymbol{e}-\boldsymbol{a})(\boldsymbol{e}-\boldsymbol{c})=(\boldsymbol{e}-\boldsymbol{b})(\boldsymbol{e}-\boldsymbol{d})=\boldsymbol{e}^{2}-R^{2} \\
& \mathcal{P}(F)=(\boldsymbol{f}-\boldsymbol{a})(\boldsymbol{f}-\boldsymbol{d})=(\boldsymbol{f}-\boldsymbol{b})(\boldsymbol{f}-\boldsymbol{c})=\boldsymbol{f}^{2}-R^{2}
\end{aligned}
$$
hence
$$
\begin{aligned}
& (\boldsymbol{e}-\boldsymbol{a})(\boldsymbol{e}-\boldsymbol{c})=\boldsymbol{e}^{2}-R^{2} \\
& (\boldsymbol{e}-\boldsymbol{b})(\boldsymbol{e}-\boldsymbol{d})=\boldsymbol{e}^{2}-R^{2} \\
& (\boldsymbol{f}-\boldsymbol{a})(\boldsymbol{f}-\boldsymbol{d})=\boldsymbol{f}^{2}-R^{2} \\
& (\boldsymbol{f}-\boldsymbol{b})(\boldsymbol{f}-\boldsymbol{c})=\boldsymbol{f}^{2}-R^{2}
\end{aligned}
$$
Since $F$ lies on the polar to $E$ with respect to the circumcircle, we have
$$
4 \boldsymbol{e} \boldsymbol{f}=4 R^{2}
$$
Adding up (3) to (7) yields (2), as desired.
## G5 POL (Poland)
Let $P$ be a polygon that is convex and symmetric to some point $O$. Prove that for some parallelogram $R$ satisfying $P \subset R$ we have
$$
\frac{|R|}{|P|} \leq \sqrt{2}
$$
where $|R|$ and $|P|$ denote the area of the sets $R$ and $P$, respectively.
Solution 1. We will construct two parallelograms $R_{1}$ and $R_{3}$, each of them containing $P$, and prove that at least one of the inequalities $\left|R_{1}\right| \leq \sqrt{2}|P|$ and $\left|R_{3}\right| \leq \sqrt{2}|P|$ holds (see Figure 1). First we will construct a parallelogram $R_{1} \supseteq P$ with the property that the midpoints of the sides of $R_{1}$ are points of the boundary of $P$.
Choose two points $A$ and $B$ of $P$ such that the triangle $O A B$ has maximal area. Let $a$ be the line through $A$ parallel to $O B$ and $b$ the line through $B$ parallel to $O A$. Let $A^{\prime}, B^{\prime}, a^{\prime}$ and $b^{\prime}$ be the points or lines, that are symmetric to $A, B, a$ and $b$, respectively, with respect to $O$. Now let $R_{1}$ be the parallelogram defined by $a, b, a^{\prime}$ and $b^{\prime}$.

Figure 1
Obviously, $A$ and $B$ are located on the boundary of the polygon $P$, and $A, B, A^{\prime}$ and $B^{\prime}$ are midpoints of the sides of $R_{1}$. We note that $P \subseteq R_{1}$. Otherwise, there would be a point $Z \in P$ but $Z \notin R_{1}$, i.e., one of the lines $a, b, a^{\prime}$ or $b^{\prime}$ were between $O$ and $Z$. If it is $a$, we have $|O Z B|>|O A B|$, which is contradictory to the choice of $A$ and $B$. If it is one of the lines $b, a^{\prime}$ or $b^{\prime}$ almost identical arguments lead to a similar contradiction.
Let $R_{2}$ be the parallelogram $A B A^{\prime} B^{\prime}$. Since $A$ and $B$ are points of $P$, segment $A B \subset P$ and so $R_{2} \subset R_{1}$. Since $A, B, A^{\prime}$ and $B^{\prime}$ are midpoints of the sides of $R_{1}$, an easy argument yields
$$
\left|R_{1}\right|=2 \cdot\left|R_{2}\right|
$$
Let $R_{3}$ be the smallest parallelogram enclosing $P$ defined by lines parallel to $A B$ and $B A^{\prime}$. Obviously $R_{2} \subset R_{3}$ and every side of $R_{3}$ contains at least one point of the boundary of $P$. Denote by $C$ the intersection point of $a$ and $b$, by $X$ the intersection point of $A B$ and $O C$, and by $X^{\prime}$ the intersection point of $X C$ and the boundary of $R_{3}$. In a similar way denote by $D$
the intersection point of $b$ and $a^{\prime}$, by $Y$ the intersection point of $A^{\prime} B$ and $O D$, and by $Y^{\prime}$ the intersection point of $Y D$ and the boundary of $R_{3}$.
Note that $O C=2 \cdot O X$ and $O D=2 \cdot O Y$, so there exist real numbers $x$ and $y$ with $1 \leq x, y \leq 2$ and $O X^{\prime}=x \cdot O X$ and $O Y^{\prime}=y \cdot O Y$. Corresponding sides of $R_{3}$ and $R_{2}$ are parallel which yields
$$
\left|R_{3}\right|=x y \cdot\left|R_{2}\right|
$$
The side of $R_{3}$ containing $X^{\prime}$ contains at least one point $X^{*}$ of $P$; due to the convexity of $P$ we have $A X^{*} B \subset P$. Since this side of the parallelogram $R_{3}$ is parallel to $A B$ we have $\left|A X^{*} B\right|=\left|A X^{\prime} B\right|$, so $\left|O A X^{\prime} B\right|$ does not exceed the area of $P$ confined to the sector defined by the rays $O B$ and $O A$. In a similar way we conclude that $\left|O B^{\prime} Y^{\prime} A^{\prime}\right|$ does not exceed the area of $P$ confined to the sector defined by the rays $O B$ and $O A^{\prime}$. Putting things together we have $\left|O A X^{\prime} B\right|=x \cdot|O A B|,\left|O B D A^{\prime}\right|=y \cdot\left|O B A^{\prime}\right|$. Since $|O A B|=\left|O B A^{\prime}\right|$, we conclude that $|P| \geq 2 \cdot\left|A X^{\prime} B Y^{\prime} A^{\prime}\right|=2 \cdot\left(x \cdot|O A B|+y \cdot\left|O B A^{\prime}\right|\right)=4 \cdot \frac{x+y}{2} \cdot|O A B|=\frac{x+y}{2} \cdot R_{2}$; this is in short
$$
\frac{x+y}{2} \cdot\left|R_{2}\right| \leq|P|
$$
Since all numbers concerned are positive, we can combine (1)-(3). Using the arithmetic-geometric-mean inequality we obtain
$$
\left|R_{1}\right| \cdot\left|R_{3}\right|=2 \cdot\left|R_{2}\right| \cdot x y \cdot\left|R_{2}\right| \leq 2 \cdot\left|R_{2}\right|^{2}\left(\frac{x+y}{2}\right)^{2} \leq 2 \cdot|P|^{2}
$$
This implies immediately the desired result $\left|R_{1}\right| \leq \sqrt{2} \cdot|P|$ or $\left|R_{3}\right| \leq \sqrt{2} \cdot|P|$.
Solution 2. We construct the parallelograms $R_{1}, R_{2}$ and $R_{3}$ in the same way as in Solution 1 and will show that $\frac{\left|R_{1}\right|}{|P|} \leq \sqrt{2}$ or $\frac{\left|R_{3}\right|}{|P|} \leq \sqrt{2}$.

Figure 2
Recall that affine one-to-one maps of the plane preserve the ratio of areas of subsets of the plane. On the other hand, every parallelogram can be transformed with an affine map onto a square. It follows that without loss of generality we may assume that $R_{1}$ is a square (see Figure 2).
Then $R_{2}$, whose vertices are the midpoints of the sides of $R_{1}$, is a square too, and $R_{3}$, whose sides are parallel to the diagonals of $R_{1}$, is a rectangle.
Let $a>0, b \geq 0$ and $c \geq 0$ be the distances introduced in Figure 2. Then $\left|R_{1}\right|=2 a^{2}$ and
$\left|R_{3}\right|=(a+2 b)(a+2 c)$.
Points $A, A^{\prime}, B$ and $B^{\prime}$ are in the convex polygon $P$. Hence the square $A B A^{\prime} B^{\prime}$ is a subset of $P$. Moreover, each of the sides of the rectangle $R_{3}$ contains a point of $P$, otherwise $R_{3}$ would not be minimal. It follows that
$$
|P| \geq a^{2}+2 \cdot \frac{a b}{2}+2 \cdot \frac{a c}{2}=a(a+b+c)
$$
Now assume that both $\frac{\left|R_{1}\right|}{|P|}>\sqrt{2}$ and $\frac{\left|R_{3}\right|}{|P|}>\sqrt{2}$, then
$$
2 a^{2}=\left|R_{1}\right|>\sqrt{2} \cdot|P| \geq \sqrt{2} \cdot a(a+b+c)
$$
and
$$
(a+2 b)(a+2 c)=\left|R_{3}\right|>\sqrt{2} \cdot|P| \geq \sqrt{2} \cdot a(a+b+c)
$$
All numbers concerned are positive, so after multiplying these inequalities we get
$$
2 a^{2}(a+2 b)(a+2 c)>2 a^{2}(a+b+c)^{2}
$$
But the arithmetic-geometric-mean inequality implies the contradictory result
$$
2 a^{2}(a+2 b)(a+2 c) \leq 2 a^{2}\left(\frac{(a+2 b)+(a+2 c)}{2}\right)^{2}=2 a^{2}(a+b+c)^{2}
$$
Hence $\frac{\left|R_{1}\right|}{|P|} \leq \sqrt{2}$ or $\frac{\left|R_{3}\right|}{|P|} \leq \sqrt{2}$, as desired.
## G6 UKR (Ukraine)
Let the sides $A D$ and $B C$ of the quadrilateral $A B C D$ (such that $A B$ is not parallel to $C D$ ) intersect at point $P$. Points $O_{1}$ and $O_{2}$ are the circumcenters and points $H_{1}$ and $H_{2}$ are the orthocenters of triangles $A B P$ and $D C P$, respectively. Denote the midpoints of segments $O_{1} H_{1}$ and $O_{2} H_{2}$ by $E_{1}$ and $E_{2}$, respectively. Prove that the perpendicular from $E_{1}$ on $C D$, the perpendicular from $E_{2}$ on $A B$ and the line $H_{1} H_{2}$ are concurrent.
Solution 1. We keep triangle $A B P$ fixed and move the line $C D$ parallel to itself uniformly, i.e. linearly dependent on a single parameter $\lambda$ (see Figure 1). Then the points $C$ and $D$ also move uniformly. Hence, the points $O_{2}, H_{2}$ and $E_{2}$ move uniformly, too. Therefore also the perpendicular from $E_{2}$ on $A B$ moves uniformly. Obviously, the points $O_{1}, H_{1}, E_{1}$ and the perpendicular from $E_{1}$ on $C D$ do not move at all. Hence, the intersection point $S$ of these two perpendiculars moves uniformly. Since $H_{1}$ does not move, while $H_{2}$ and $S$ move uniformly along parallel lines (both are perpendicular to $C D$ ), it is sufficient to prove their collinearity for two different positions of $C D$.

Figure 1
Let $C D$ pass through either point $A$ or point $B$. Note that by hypothesis these two cases are different. We will consider the case $A \in C D$, i.e. $A=D$. So we have to show that the perpendiculars from $E_{1}$ on $A C$ and from $E_{2}$ on $A B$ intersect on the altitude $A H$ of triangle $A B C$ (see Figure 2).

Figure 2
To this end, we consider the midpoints $A_{1}, B_{1}, C_{1}$ of $B C, C A, A B$, respectively. As $E_{1}$ is the center of Feuerbach's circle (nine-point circle) of $\triangle A B P$, we have $E_{1} C_{1}=E_{1} H$. Similarly, $E_{2} B_{1}=E_{2} H$. Note further that a point $X$ lies on the perpendicular from $E_{1}$ on $A_{1} C_{1}$ if and only if
$$
X C_{1}^{2}-X A_{1}^{2}=E_{1} C_{1}^{2}-E_{1} A_{1}^{2}
$$
Similarly, the perpendicular from $E_{2}$ on $A_{1} B_{1}$ is characterized by
$$
X A_{1}^{2}-X B_{1}^{2}=E_{2} A_{1}^{2}-E_{2} B_{1}^{2}
$$
The line $H_{1} H_{2}$, which is perpendicular to $B_{1} C_{1}$ and contains $A$, is given by
$$
X B_{1}^{2}-X C_{1}^{2}=A B_{1}^{2}-A C_{1}^{2}
$$
The three lines are concurrent if and only if
$$
\begin{aligned}
0 & =X C_{1}^{2}-X A_{1}^{2}+X A_{1}^{2}-X B_{1}^{2}+X B_{1}^{2}-X C_{1}^{2} \\
& =E_{1} C_{1}^{2}-E_{1} A_{1}^{2}+E_{2} A_{1}^{2}-E_{2} B_{1}^{2}+A B_{1}^{2}-A C_{1}^{2} \\
& =-E_{1} A_{1}^{2}+E_{2} A_{1}^{2}+E_{1} H^{2}-E_{2} H^{2}+A B_{1}^{2}-A C_{1}^{2}
\end{aligned}
$$
i.e. it suffices to show that
$$
E_{1} A_{1}^{2}-E_{2} A_{1}^{2}-E_{1} H^{2}+E_{2} H^{2}=\frac{A C^{2}-A B^{2}}{4}
$$
We have
$$
\frac{A C^{2}-A B^{2}}{4}=\frac{H C^{2}-H B^{2}}{4}=\frac{(H C+H B)(H C-H B)}{4}=\frac{H A_{1} \cdot B C}{2}
$$
Let $F_{1}, F_{2}$ be the projections of $E_{1}, E_{2}$ on $B C$. Obviously, these are the midpoints of $H P_{1}$,
$H P_{2}$, where $P_{1}, P_{2}$ are the midpoints of $P B$ and $P C$ respectively. Then
$$
\begin{aligned}
& E_{1} A_{1}^{2}-E_{2} A_{1}^{2}-E_{1} H^{2}+E_{2} H^{2} \\
& =F_{1} A_{1}^{2}-F_{1} H^{2}-F_{2} A_{1}^{2}+F_{2} H^{2} \\
& =\left(F_{1} A_{1}-F_{1} H\right)\left(F_{1} A_{1}+F_{1} H\right)-\left(F_{2} A_{1}-F_{2} H\right)\left(F_{2} A_{1}+F_{2} H\right) \\
& =A_{1} H \cdot\left(A_{1} P_{1}-A_{1} P_{2}\right) \\
& =\frac{A_{1} H \cdot B C}{2} \\
& =\frac{A C^{2}-A B^{2}}{4}
\end{aligned}
$$
which proves the claim.
Solution 2. Let the perpendicular from $E_{1}$ on $C D$ meet $P H_{1}$ at $X$, and the perpendicular from $E_{2}$ on $A B$ meet $P H_{2}$ at $Y$ (see Figure 3). Let $\varphi$ be the intersection angle of $A B$ and $C D$. Denote by $M, N$ the midpoints of $P H_{1}, P H_{2}$ respectively.

Figure 3
We will prove now that triangles $E_{1} X M$ and $E_{2} Y N$ have equal angles at $E_{1}, E_{2}$, and supplementary angles at $X, Y$.
In the following, angles are understood as oriented, and equalities of angles modulo $180^{\circ}$.
Let $\alpha=\angle H_{2} P D, \psi=\angle D P C, \beta=\angle C P H_{1}$. Then $\alpha+\psi+\beta=\varphi, \angle E_{1} X H_{1}=\angle H_{2} Y E_{2}=\varphi$, thus $\angle M X E_{1}+\angle N Y E_{2}=180^{\circ}$.
By considering the Feuerbach circle of $\triangle A B P$ whose center is $E_{1}$ and which goes through $M$, we have $\angle E_{1} M H_{1}=\psi+2 \beta$. Analogous considerations with the Feuerbach circle of $\triangle D C P$ yield $\angle H_{2} N E_{2}=\psi+2 \alpha$. Hence indeed $\angle X E_{1} M=\varphi-(\psi+2 \beta)=(\psi+2 \alpha)-\varphi=\angle Y E_{2} N$.
It follows now that
$$
\frac{X M}{M E_{1}}=\frac{Y N}{N E_{2}}
$$
Furthermore, $M E_{1}$ is half the circumradius of $\triangle A B P$, while $P H_{1}$ is the distance of $P$ to the orthocenter of that triangle, which is twice the circumradius times the cosine of $\psi$. Together
with analogous reasoning for $\triangle D C P$ we have
$$
\frac{M E_{1}}{P H_{1}}=\frac{1}{4 \cos \psi}=\frac{N E_{2}}{P H_{2}}
$$
By multiplication,
$$
\frac{X M}{P H_{1}}=\frac{Y N}{P H_{2}}
$$
and therefore
$$
\frac{P X}{X H_{1}}=\frac{H_{2} Y}{Y P}
$$
Let $E_{1} X, E_{2} Y$ meet $H_{1} H_{2}$ in $R, S$ respectively.
Applying the intercept theorem to the parallels $E_{1} X, P H_{2}$ and center $H_{1}$ gives
$$
\frac{H_{2} R}{R H_{1}}=\frac{P X}{X H_{1}}
$$
while with parallels $E_{2} Y, P H_{1}$ and center $H_{2}$ we obtain
$$
\frac{H_{2} S}{S H_{1}}=\frac{H_{2} Y}{Y P}
$$
Combination of the last three equalities yields that $R$ and $S$ coincide.
## G7 IRN (Islamic Republic of Iran)
Let $A B C$ be a triangle with incenter $I$ and let $X, Y$ and $Z$ be the incenters of the triangles $B I C, C I A$ and $A I B$, respectively. Let the triangle $X Y Z$ be equilateral. Prove that $A B C$ is equilateral too.
Solution. $A Z, A I$ and $A Y$ divide $\angle B A C$ into four equal angles; denote them by $\alpha$. In the same way we have four equal angles $\beta$ at $B$ and four equal angles $\gamma$ at $C$. Obviously $\alpha+\beta+\gamma=\frac{180^{\circ}}{4}=45^{\circ}$; and $0^{\circ}<\alpha, \beta, \gamma<45^{\circ}$.

Easy calculations in various triangles yield $\angle B I C=180^{\circ}-2 \beta-2 \gamma=180^{\circ}-\left(90^{\circ}-2 \alpha\right)=$ $90^{\circ}+2 \alpha$, hence (for $X$ is the incenter of triangle $B C I$, so $I X$ bisects $\angle B I C$ ) we have $\angle X I C=$ $\angle B I X=\frac{1}{2} \angle B I C=45^{\circ}+\alpha$ and with similar aguments $\angle C I Y=\angle Y I A=45^{\circ}+\beta$ and $\angle A I Z=\angle Z I B=45^{\circ}+\gamma$. Furthermore, we have $\angle X I Y=\angle X I C+\angle C I Y=\left(45^{\circ}+\alpha\right)+$ $\left(45^{\circ}+\beta\right)=135^{\circ}-\gamma, \angle Y I Z=135^{\circ}-\alpha$, and $\angle Z I X=135^{\circ}-\beta$.
Now we calculate the lengths of $I X, I Y$ and $I Z$ in terms of $\alpha, \beta$ and $\gamma$. The perpendicular from $I$ on $C X$ has length $I X \cdot \sin \angle C X I=I X \cdot \sin \left(90^{\circ}+\beta\right)=I X \cdot \cos \beta$. But $C I$ bisects $\angle Y C X$, so the perpendicular from $I$ on $C Y$ has the same length, and we conclude
$$
I X \cdot \cos \beta=I Y \cdot \cos \alpha
$$
To make calculations easier we choose a length unit that makes $I X=\cos \alpha$. Then $I Y=\cos \beta$ and with similar arguments $I Z=\cos \gamma$.
Since $X Y Z$ is equilateral we have $Z X=Z Y$. The law of Cosines in triangles $X Y I, Y Z I$ yields
$$
\begin{aligned}
& Z X^{2}=Z Y^{2} \\
\Longrightarrow & I Z^{2}+I X^{2}-2 \cdot I Z \cdot I X \cdot \cos \angle Z I X=I Z^{2}+I Y^{2}-2 \cdot I Z \cdot I Y \cdot \cos \angle Y I Z \\
\Longrightarrow & I X^{2}-I Y^{2}=2 \cdot I Z \cdot(I X \cdot \cos \angle Z I X-I Y \cdot \cos \angle Y I Z) \\
\Longrightarrow & \underbrace{\cos ^{2} \alpha-\cos ^{2} \beta}_{\text {L.H.S. }}=\underbrace{2 \cdot \cos \gamma \cdot\left(\cos \alpha \cdot \cos \left(135^{\circ}-\beta\right)-\cos \beta \cdot \cos \left(135^{\circ}-\alpha\right)\right)}_{\text {R.H.S. }} .
\end{aligned}
$$
A transformation of the left-hand side (L.H.S.) yields
$$
\begin{aligned}
\text { L.H.S. } & =\cos ^{2} \alpha \cdot\left(\sin ^{2} \beta+\cos ^{2} \beta\right)-\cos ^{2} \beta \cdot\left(\sin ^{2} \alpha+\cos ^{2} \alpha\right) \\
& =\cos ^{2} \alpha \cdot \sin ^{2} \beta-\cos ^{2} \beta \cdot \sin ^{2} \alpha
\end{aligned}
$$
$$
\begin{aligned}
& =(\cos \alpha \cdot \sin \beta+\cos \beta \cdot \sin \alpha) \cdot(\cos \alpha \cdot \sin \beta-\cos \beta \cdot \sin \alpha) \\
& =\sin (\beta+\alpha) \cdot \sin (\beta-\alpha)=\sin \left(45^{\circ}-\gamma\right) \cdot \sin (\beta-\alpha)
\end{aligned}
$$
whereas a transformation of the right-hand side (R.H.S.) leads to
$$
\begin{aligned}
\text { R.H.S. } & =2 \cdot \cos \gamma \cdot\left(\cos \alpha \cdot\left(-\cos \left(45^{\circ}+\beta\right)\right)-\cos \beta \cdot\left(-\cos \left(45^{\circ}+\alpha\right)\right)\right) \\
& =2 \cdot \frac{\sqrt{2}}{2} \cdot \cos \gamma \cdot(\cos \alpha \cdot(\sin \beta-\cos \beta)+\cos \beta \cdot(\cos \alpha-\sin \alpha)) \\
& =\sqrt{2} \cdot \cos \gamma \cdot(\cos \alpha \cdot \sin \beta-\cos \beta \cdot \sin \alpha) \\
& =\sqrt{2} \cdot \cos \gamma \cdot \sin (\beta-\alpha)
\end{aligned}
$$
Equating L.H.S. and R.H.S. we obtain
$$
\begin{aligned}
& \sin \left(45^{\circ}-\gamma\right) \cdot \sin (\beta-\alpha)=\sqrt{2} \cdot \cos \gamma \cdot \sin (\beta-\alpha) \\
\Longrightarrow & \sin (\beta-\alpha) \cdot\left(\sqrt{2} \cdot \cos \gamma-\sin \left(45^{\circ}-\gamma\right)\right)=0 \\
\Longrightarrow & \alpha=\beta \quad \text { or } \quad \sqrt{2} \cdot \cos \gamma=\sin \left(45^{\circ}-\gamma\right) .
\end{aligned}
$$
But $\gamma<45^{\circ}$; so $\sqrt{2} \cdot \cos \gamma>\cos \gamma>\cos 45^{\circ}=\sin 45^{\circ}>\sin \left(45^{\circ}-\gamma\right)$. This leaves $\alpha=\beta$. With similar reasoning we have $\alpha=\gamma$, which means triangle $A B C$ must be equilateral.
## G8 BGR (Bulgaria)
Let $A B C D$ be a circumscribed quadrilateral. Let $g$ be a line through $A$ which meets the segment $B C$ in $M$ and the line $C D$ in $N$. Denote by $I_{1}, I_{2}$, and $I_{3}$ the incenters of $\triangle A B M$, $\triangle M N C$, and $\triangle N D A$, respectively. Show that the orthocenter of $\triangle I_{1} I_{2} I_{3}$ lies on $g$.
Solution 1. Let $k_{1}, k_{2}$ and $k_{3}$ be the incircles of triangles $A B M, M N C$, and $N D A$, respectively (see Figure 1). We shall show that the tangent $h$ from $C$ to $k_{1}$ which is different from $C B$ is also tangent to $k_{3}$.

Figure 1
To this end, let $X$ denote the point of intersection of $g$ and $h$. Then $A B C X$ and $A B C D$ are circumscribed quadrilaterals, whence
$$
C D-C X=(A B+C D)-(A B+C X)=(B C+A D)-(B C+A X)=A D-A X
$$
i.e.
$$
A X+C D=C X+A D
$$
which in turn reveals that the quadrilateral $A X C D$ is also circumscribed. Thus $h$ touches indeed the circle $k_{3}$.
Moreover, we find that $\angle I_{3} C I_{1}=\angle I_{3} C X+\angle X C I_{1}=\frac{1}{2}(\angle D C X+\angle X C B)=\frac{1}{2} \angle D C B=$ $\frac{1}{2}\left(180^{\circ}-\angle M C N\right)=180^{\circ}-\angle M I_{2} N=\angle I_{3} I_{2} I_{1}$, from which we conclude that $C, I_{1}, I_{2}, I_{3}$ are concyclic.
Let now $L_{1}$ and $L_{3}$ be the reflection points of $C$ with respect to the lines $I_{2} I_{3}$ and $I_{1} I_{2}$ respectively. Since $I_{1} I_{2}$ is the angle bisector of $\angle N M C$, it follows that $L_{3}$ lies on $g$. By analogous reasoning, $L_{1}$ lies on $g$.
Let $H$ be the orthocenter of $\triangle I_{1} I_{2} I_{3}$. We have $\angle I_{2} L_{3} I_{1}=\angle I_{1} C I_{2}=\angle I_{1} I_{3} I_{2}=180^{\circ}-\angle I_{1} H I_{2}$, which entails that the quadrilateral $I_{2} H I_{1} L_{3}$ is cyclic. Analogously, $I_{3} H L_{1} I_{2}$ is cyclic.
Then, working with oriented angles modulo $180^{\circ}$, we have
$$
\angle L_{3} H I_{2}=\angle L_{3} I_{1} I_{2}=\angle I_{2} I_{1} C=\angle I_{2} I_{3} C=\angle L_{1} I_{3} I_{2}=\angle L_{1} H I_{2},
$$
whence $L_{1}, L_{3}$, and $H$ are collinear. By $L_{1} \neq L_{3}$, the claim follows.
Comment. The last part of the argument essentially reproves the following fact: The Simson line of a point $P$ lying on the circumcircle of a triangle $A B C$ with respect to that triangle bisects the line segment connecting $P$ with the orthocenter of $A B C$.
Solution 2. We start by proving that $C, I_{1}, I_{2}$, and $I_{3}$ are concyclic.

Figure 2
To this end, notice first that $I_{2}, M, I_{1}$ are collinear, as are $N, I_{2}, I_{3}$ (see Figure 2). Denote by $\alpha, \beta, \gamma, \delta$ the internal angles of $A B C D$. By considerations in triangle $C M N$, it follows that $\angle I_{3} I_{2} I_{1}=\frac{\gamma}{2}$. We will show that $\angle I_{3} C I_{1}=\frac{\gamma}{2}$, too. Denote by $I$ the incenter of $A B C D$. Clearly, $I_{1} \in B I, I_{3} \in D I, \angle I_{1} A I_{3}=\frac{\alpha}{2}$.
Using the abbreviation $[X, Y Z]$ for the distance from point $X$ to the line $Y Z$, we have because of $\angle B A I_{1}=\angle I A I_{3}$ and $\angle I_{1} A I=\angle I_{3} A D$ that
$$
\frac{\left[I_{1}, A B\right]}{\left[I_{1}, A I\right]}=\frac{\left[I_{3}, A I\right]}{\left[I_{3}, A D\right]}
$$
Furthermore, consideration of the angle sums in $A I B, B I C, C I D$ and $D I A$ implies $\angle A I B+$ $\angle C I D=\angle B I C+\angle D I A=180^{\circ}$, from which we see
$$
\frac{\left[I_{1}, A I\right]}{\left[I_{3}, C I\right]}=\frac{I_{1} I}{I_{3} I}=\frac{\left[I_{1}, C I\right]}{\left[I_{3}, A I\right]} .
$$
Because of $\left[I_{1}, A B\right]=\left[I_{1}, B C\right],\left[I_{3}, A D\right]=\left[I_{3}, C D\right]$, multiplication yields
$$
\frac{\left[I_{1}, B C\right]}{\left[I_{3}, C I\right]}=\frac{\left[I_{1}, C I\right]}{\left[I_{3}, C D\right]} .
$$
By $\angle D C I=\angle I C B=\gamma / 2$ it follows that $\angle I_{1} C B=\angle I_{3} C I$ which concludes the proof of the
above statement.
Let the perpendicular from $I_{1}$ on $I_{2} I_{3}$ intersect $g$ at $Z$. Then $\angle M I_{1} Z=90^{\circ}-\angle I_{3} I_{2} I_{1}=$ $90^{\circ}-\gamma / 2=\angle M C I_{2}$. Since we have also $\angle Z M I_{1}=\angle I_{2} M C$, triangles $M Z I_{1}$ and $M I_{2} C$ are similar. From this one easily proves that also $M I_{2} Z$ and $M C I_{1}$ are similar. Because $C, I_{1}, I_{2}$, and $I_{3}$ are concyclic, $\angle M Z I_{2}=\angle M I_{1} C=\angle N I_{3} C$, thus $N I_{2} Z$ and $N C I_{3}$ are similar, hence $N C I_{2}$ and $N I_{3} Z$ are similar. We conclude $\angle Z I_{3} I_{2}=\angle I_{2} C N=90^{\circ}-\gamma / 2$, hence $I_{1} I_{2} \perp Z I_{3}$. This completes the proof.
## Number Theory
## N1 AUS (Australia)
A social club has $n$ members. They have the membership numbers $1,2, \ldots, n$, respectively. From time to time members send presents to other members, including items they have already received as presents from other members. In order to avoid the embarrassing situation that a member might receive a present that he or she has sent to other members, the club adds the following rule to its statutes at one of its annual general meetings:
"A member with membership number $a$ is permitted to send a present to a member with membership number $b$ if and only if $a(b-1)$ is a multiple of $n$."
Prove that, if each member follows this rule, none will receive a present from another member that he or she has already sent to other members.
Alternative formulation: Let $G$ be a directed graph with $n$ vertices $v_{1}, v_{2}, \ldots, v_{n}$, such that there is an edge going from $v_{a}$ to $v_{b}$ if and only if $a$ and $b$ are distinct and $a(b-1)$ is a multiple of $n$. Prove that this graph does not contain a directed cycle.
Solution 1. Suppose there is an edge from $v_{i}$ to $v_{j}$. Then $i(j-1)=i j-i=k n$ for some integer $k$, which implies $i=i j-k n$. If $\operatorname{gcd}(i, n)=d$ and $\operatorname{gcd}(j, n)=e$, then $e$ divides $i j-k n=i$ and thus $e$ also divides $d$. Hence, if there is an edge from $v_{i}$ to $v_{j}$, then $\operatorname{gcd}(j, n) \mid \operatorname{gcd}(i, n)$.
If there is a cycle in $G$, say $v_{i_{1}} \rightarrow v_{i_{2}} \rightarrow \cdots \rightarrow v_{i_{r}} \rightarrow v_{i_{1}}$, then we have
$$
\operatorname{gcd}\left(i_{1}, n\right)\left|\operatorname{gcd}\left(i_{r}, n\right)\right| \operatorname{gcd}\left(i_{r-1}, n\right)|\ldots| \operatorname{gcd}\left(i_{2}, n\right) \mid \operatorname{gcd}\left(i_{1}, n\right)
$$
which implies that all these greatest common divisors must be equal, say be equal to $t$.
Now we pick any of the $i_{k}$, without loss of generality let it be $i_{1}$. Then $i_{r}\left(i_{1}-1\right)$ is a multiple of $n$ and hence also (by dividing by $t$ ), $i_{1}-1$ is a multiple of $\frac{n}{t}$. Since $i_{1}$ and $i_{1}-1$ are relatively prime, also $t$ and $\frac{n}{t}$ are relatively prime. So, by the Chinese remainder theorem, the value of $i_{1}$ is uniquely determined modulo $n=t \cdot \frac{n}{t}$ by the value of $t$. But, as $i_{1}$ was chosen arbitrarily among the $i_{k}$, this implies that all the $i_{k}$ have to be equal, a contradiction.
Solution 2. If $a, b, c$ are integers such that $a b-a$ and $b c-b$ are multiples of $n$, then also $a c-a=a(b c-b)+(a b-a)-(a b-a) c$ is a multiple of $n$. This implies that if there is an edge from $v_{a}$ to $v_{b}$ and an edge from $v_{b}$ to $v_{c}$, then there also must be an edge from $v_{a}$ to $v_{c}$. Therefore, if there are any cycles at all, the smallest cycle must have length 2. But suppose the vertices $v_{a}$ and $v_{b}$ form such a cycle, i. e., $a b-a$ and $a b-b$ are both multiples of $n$. Then $a-b$ is also a multiple of $n$, which can only happen if $a=b$, which is impossible.
Solution 3. Suppose there was a cycle $v_{i_{1}} \rightarrow v_{i_{2}} \rightarrow \cdots \rightarrow v_{i_{r}} \rightarrow v_{i_{1}}$. Then $i_{1}\left(i_{2}-1\right)$ is a multiple of $n$, i.e., $i_{1} \equiv i_{1} i_{2} \bmod n$. Continuing in this manner, we get $i_{1} \equiv i_{1} i_{2} \equiv$ $i_{1} i_{2} i_{3} \equiv i_{1} i_{2} i_{3} \ldots i_{r} \bmod n$. But the same holds for all $i_{k}$, i. e., $i_{k} \equiv i_{1} i_{2} i_{3} \ldots i_{r} \bmod n$. Hence $i_{1} \equiv i_{2} \equiv \cdots \equiv i_{r} \bmod n$, which means $i_{1}=i_{2}=\cdots=i_{r}$, a contradiction.
Solution 4. Let $n=k$ be the smallest value of $n$ for which the corresponding graph has a cycle. We show that $k$ is a prime power.
If $k$ is not a prime power, it can be written as a product $k=d e$ of relatively prime integers greater than 1. Reducing all the numbers modulo $d$ yields a single vertex or a cycle in the corresponding graph on $d$ vertices, because if $a(b-1) \equiv 0 \bmod k$ then this equation also holds modulo $d$. But since the graph on $d$ vertices has no cycles, by the minimality of $k$, we must have that all the indices of the cycle are congruent modulo $d$. The same holds modulo $e$ and hence also modulo $k=d e$. But then all the indices are equal, which is a contradiction.
Thus $k$ must be a prime power $k=p^{m}$. There are no edges ending at $v_{k}$, so $v_{k}$ is not contained in any cycle. All edges not starting at $v_{k}$ end at a vertex belonging to a non-multiple of $p$, and all edges starting at a non-multiple of $p$ must end at $v_{1}$. But there is no edge starting at $v_{1}$. Hence there is no cycle.
Solution 5. Suppose there was a cycle $v_{i_{1}} \rightarrow v_{i_{2}} \rightarrow \cdots \rightarrow v_{i_{r}} \rightarrow v_{i_{1}}$. Let $q=p^{m}$ be a prime power dividing $n$. We claim that either $i_{1} \equiv i_{2} \equiv \cdots \equiv i_{r} \equiv 0 \bmod q$ or $i_{1} \equiv i_{2} \equiv \cdots \equiv i_{r} \equiv$ $1 \bmod q$.
Suppose that there is an $i_{s}$ not divisible by $q$. Then, as $i_{s}\left(i_{s+1}-1\right)$ is a multiple of $q, i_{s+1} \equiv$ $1 \bmod p$. Similarly, we conclude $i_{s+2} \equiv 1 \bmod p$ and so on. So none of the labels is divisible by $p$, but since $i_{s}\left(i_{s+1}-1\right)$ is a multiple of $q=p^{m}$ for all $s$, all $i_{s+1}$ are congruent to 1 modulo $q$. This proves the claim.
Now, as all the labels are congruent modulo all the prime powers dividing $n$, they must all be equal by the Chinese remainder theorem. This is a contradiction.
## N2 PER (Peru)
A positive integer $N$ is called balanced, if $N=1$ or if $N$ can be written as a product of an even number of not necessarily distinct primes. Given positive integers $a$ and $b$, consider the polynomial $P$ defined by $P(x)=(x+a)(x+b)$.
(a) Prove that there exist distinct positive integers $a$ and $b$ such that all the numbers $P(1), P(2)$, ..., $P(50)$ are balanced.
(b) Prove that if $P(n)$ is balanced for all positive integers $n$, then $a=b$.
Solution. Define a function $f$ on the set of positive integers by $f(n)=0$ if $n$ is balanced and $f(n)=1$ otherwise. Clearly, $f(n m) \equiv f(n)+f(m) \bmod 2$ for all positive integers $n, m$.
(a) Now for each positive integer $n$ consider the binary sequence $(f(n+1), f(n+2), \ldots, f(n+$ $50)$ ). As there are only $2^{50}$ different such sequences there are two different positive integers $a$ and $b$ such that
$$
(f(a+1), f(a+2), \ldots, f(a+50))=(f(b+1), f(b+2), \ldots, f(b+50))
$$
But this implies that for the polynomial $P(x)=(x+a)(x+b)$ all the numbers $P(1), P(2)$, $\ldots, P(50)$ are balanced, since for all $1 \leq k \leq 50$ we have $f(P(k)) \equiv f(a+k)+f(b+k) \equiv$ $2 f(a+k) \equiv 0 \bmod 2$.
(b) Now suppose $P(n)$ is balanced for all positive integers $n$ and $a<b$. Set $n=k(b-a)-a$ for sufficiently large $k$, such that $n$ is positive. Then $P(n)=k(k+1)(b-a)^{2}$, and this number can only be balanced, if $f(k)=f(k+1)$ holds. Thus, the sequence $f(k)$ must become constant for sufficiently large $k$. But this is not possible, as for every prime $p$ we have $f(p)=1$ and for every square $t^{2}$ we have $f\left(t^{2}\right)=0$.
Hence $a=b$.
Comment. Given a positive integer $k$, a computer search for the pairs of positive integers $(a, b)$, for which $P(1), P(2), \ldots, P(k)$ are all balanced yields the following results with minimal sum $a+b$ and $a<b$ :
| $k$ | 3 | 4 | 5 | 10 | 20 |
| :--- | :---: | :---: | :---: | :---: | :---: |
| $(a, b)$ | $(2,4)$ | $(6,11)$ | $(8,14)$ | $(20,34)$ | $(1751,3121)$ |
Therefore, trying to find $a$ and $b$ in part (a) of the problem cannot be done by elementary calculations.
## N3 EST (Estonia)
Let $f$ be a non-constant function from the set of positive integers into the set of positive integers, such that $a-b$ divides $f(a)-f(b)$ for all distinct positive integers $a, b$. Prove that there exist infinitely many primes $p$ such that $p$ divides $f(c)$ for some positive integer $c$.
Solution 1. Denote by $v_{p}(a)$ the exponent of the prime $p$ in the prime decomposition of $a$.
Assume that there are only finitely many primes $p_{1}, p_{2}, \ldots, p_{m}$ that divide some function value produced of $f$.
There are infinitely many positive integers $a$ such that $v_{p_{i}}(a)>v_{p_{i}}(f(1))$ for all $i=1,2, \ldots, m$, e.g. $a=\left(p_{1} p_{2} \ldots p_{m}\right)^{\alpha}$ with $\alpha$ sufficiently large. Pick any such $a$. The condition of the problem then yields $a \mid(f(a+1)-f(1))$. Assume $f(a+1) \neq f(1)$. Then we must have $v_{p_{i}}(f(a+1)) \neq$ $v_{p_{i}}(f(1))$ for at least one $i$. This yields $v_{p_{i}}(f(a+1)-f(1))=\min \left\{v_{p_{i}}(f(a+1)), v_{p_{i}}(f(1))\right\} \leq$ $v_{p_{1}}(f(1))<v_{p_{i}}(a)$. But this contradicts the fact that $a \mid(f(a+1)-f(1))$.
Hence we must have $f(a+1)=f(1)$ for all such $a$.
Now, for any positive integer $b$ and all such $a$, we have $(a+1-b) \mid(f(a+1)-f(b))$, i.e., $(a+1-b) \mid(f(1)-f(b))$. Since this is true for infinitely many positive integers $a$ we must have $f(b)=f(1)$. Hence $f$ is a constant function, a contradiction. Therefore, our initial assumption was false and there are indeed infinitely many primes $p$ dividing $f(c)$ for some positive integer c.
Solution 2. Assume that there are only finitely many primes $p_{1}, p_{2}, \ldots, p_{m}$ that divide some function value of $f$. Since $f$ is not identically 1 , we must have $m \geq 1$.
Then there exist non-negative integers $\alpha_{1}, \ldots, \alpha_{m}$ such that
$$
f(1)=p_{1}^{\alpha_{1}} p_{2}^{\alpha_{2}} \ldots p_{m}^{\alpha_{m}}
$$
We can pick a positive integer $r$ such that $f(r) \neq f(1)$. Let
$$
M=1+p_{1}^{\alpha_{1}+1} p_{2}^{\alpha_{2}+1} \ldots p_{m}^{\alpha_{m}+1} \cdot(f(r)+r)
$$
Then for all $i \in\{1, \ldots, m\}$ we have that $p_{i}^{\alpha_{i}+1}$ divides $M-1$ and hence by the condition of the problem also $f(M)-f(1)$. This implies that $f(M)$ is divisible by $p_{i}^{\alpha_{i}}$ but not by $p_{i}^{\alpha_{i}+1}$ for all $i$ and therefore $f(M)=f(1)$.
Hence
$$
\begin{aligned}
M-r & >p_{1}^{\alpha_{1}+1} p_{2}^{\alpha_{2}+1} \ldots p_{m}^{\alpha_{m}+1} \cdot(f(r)+r)-r \\
& \geq p_{1}^{\alpha_{1}+1} p_{2}^{\alpha_{2}+1} \ldots p_{m}^{\alpha_{m}+1}+(f(r)+r)-r \\
& >p_{1}^{\alpha_{1}} p_{2}^{\alpha_{2}} \ldots p_{m}^{\alpha_{m}}+f(r) \\
& \geq|f(M)-f(r)| .
\end{aligned}
$$
But since $M-r$ divides $f(M)-f(r)$ this can only be true if $f(r)=f(M)=f(1)$, which contradicts the choice of $r$.
Comment. In the case that $f$ is a polynomial with integer coefficients the result is well-known, see e.g. W. Schwarz, Einführung in die Methoden der Primzahltheorie, 1969.
## N4 PRK (Democratic People's Republic of Korea)
Find all positive integers $n$ such that there exists a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{n}$ satisfying
$$
a_{k+1}=\frac{a_{k}^{2}+1}{a_{k-1}+1}-1
$$
for every $k$ with $2 \leq k \leq n-1$.
Solution 1. Such a sequence exists for $n=1,2,3,4$ and no other $n$. Since the existence of such a sequence for some $n$ implies the existence of such a sequence for all smaller $n$, it suffices to prove that $n=5$ is not possible and $n=4$ is possible.
Assume first that for $n=5$ there exists a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{5}$ satisfying the conditions
$$
\begin{aligned}
& a_{2}^{2}+1=\left(a_{1}+1\right)\left(a_{3}+1\right), \\
& a_{3}^{2}+1=\left(a_{2}+1\right)\left(a_{4}+1\right), \\
& a_{4}^{2}+1=\left(a_{3}+1\right)\left(a_{5}+1\right) .
\end{aligned}
$$
Assume $a_{1}$ is odd, then $a_{2}$ has to be odd as well and as then $a_{2}^{2}+1 \equiv 2 \bmod 4, a_{3}$ has to be even. But this is a contradiction, since then the even number $a_{2}+1$ cannot divide the odd number $a_{3}^{2}+1$.
Hence $a_{1}$ is even.
If $a_{2}$ is odd, $a_{3}^{2}+1$ is even (as a multiple of $a_{2}+1$ ) and hence $a_{3}$ is odd, too. Similarly we must have $a_{4}$ odd as well. But then $a_{3}^{2}+1$ is a product of two even numbers $\left(a_{2}+1\right)\left(a_{4}+1\right)$ and thus is divisible by 4 , which is a contradiction as for odd $a_{3}$ we have $a_{3}^{2}+1 \equiv 2 \bmod 4$.
Hence $a_{2}$ is even. Furthermore $a_{3}+1$ divides the odd number $a_{2}^{2}+1$ and so $a_{3}$ is even. Similarly, $a_{4}$ and $a_{5}$ are even as well.
Now set $x=a_{2}$ and $y=a_{3}$. From the given condition we get $(x+1) \mid\left(y^{2}+1\right)$ and $(y+1) \mid\left(x^{2}+1\right)$. We will prove that there is no pair of positive even numbers $(x, y)$ satisfying these two conditions, thus yielding a contradiction to the assumption.
Assume there exists a pair $\left(x_{0}, y_{0}\right)$ of positive even numbers satisfying the two conditions $\left(x_{0}+1\right) \mid\left(y_{0}^{2}+1\right)$ and $\left(y_{0}+1\right) \mid\left(x_{0}^{2}+1\right)$.
Then one has $\left(x_{0}+1\right) \mid\left(y_{0}^{2}+1+x_{0}^{2}-1\right)$, i.e., $\left(x_{0}+1\right) \mid\left(x_{0}^{2}+y_{0}^{2}\right)$, and similarly $\left(y_{0}+1\right) \mid\left(x_{0}^{2}+y_{0}^{2}\right)$. Any common divisor $d$ of $x_{0}+1$ and $y_{0}+1$ must hence also divide the number $\left(x_{0}^{2}+1\right)+\left(y_{0}^{2}+1\right)-\left(x_{0}^{2}+y_{0}^{2}\right)=2$. But as $x_{0}+1$ and $y_{0}+1$ are both odd, we must have $d=1$. Thus $x_{0}+1$ and $y_{0}+1$ are relatively prime and therefore there exists a positive integer $k$ such that
$$
k(x+1)(y+1)=x^{2}+y^{2}
$$
has the solution $\left(x_{0}, y_{0}\right)$. We will show that the latter equation has no solution $(x, y)$ in positive even numbers.
Assume there is a solution. Pick the solution $\left(x_{1}, y_{1}\right)$ with the smallest sum $x_{1}+y_{1}$ and assume $x_{1} \geq y_{1}$. Then $x_{1}$ is a solution to the quadratic equation
$$
x^{2}-k\left(y_{1}+1\right) x+y_{1}^{2}-k\left(y_{1}+1\right)=0 .
$$
Let $x_{2}$ be the second solution, which by Vieta's theorem fulfills $x_{1}+x_{2}=k\left(y_{1}+1\right)$ and $x_{1} x_{2}=y_{1}^{2}-k\left(y_{1}+1\right)$. If $x_{2}=0$, the second equation implies $y_{1}^{2}=k\left(y_{1}+1\right)$, which is impossible, as $y_{1}+1>1$ cannot divide the relatively prime number $y_{1}^{2}$. Therefore $x_{2} \neq 0$.
Also we get $\left(x_{1}+1\right)\left(x_{2}+1\right)=x_{1} x_{2}+x_{1}+x_{2}+1=y_{1}^{2}+1$ which is odd, and hence $x_{2}$ must be even and positive. Also we have $x_{2}+1=\frac{y_{1}^{2}+1}{x_{1}+1} \leq \frac{y_{1}^{2}+1}{y_{1}+1} \leq y_{1} \leq x_{1}$. But this means that the pair $\left(x^{\prime}, y^{\prime}\right)$ with $x^{\prime}=y_{1}$ and $y^{\prime}=x_{2}$ is another solution of $k(x+1)(y+1)=x^{2}+y^{2}$ in even positive numbers with $x^{\prime}+y^{\prime}<x_{1}+y_{1}$, a contradiction.
Therefore we must have $n \leq 4$.
When $n=4$, a possible example of a sequence is $a_{1}=4, a_{2}=33, a_{3}=217$ and $a_{4}=1384$.
Solution 2. It is easy to check that for $n=4$ the sequence $a_{1}=4, a_{2}=33, a_{3}=217$ and $a_{4}=1384$ is possible.
Now assume there is a sequence with $n \geq 5$. Then we have in particular
$$
\begin{aligned}
& a_{2}^{2}+1=\left(a_{1}+1\right)\left(a_{3}+1\right), \\
& a_{3}^{2}+1=\left(a_{2}+1\right)\left(a_{4}+1\right), \\
& a_{4}^{2}+1=\left(a_{3}+1\right)\left(a_{5}+1\right) .
\end{aligned}
$$
Also assume without loss of generality that among all such quintuples $\left(a_{1}, a_{2}, a_{3}, a_{4}, a_{5}\right)$ we have chosen one with minimal $a_{1}$.
One shows quickly the following fact:
If three positive integers $x, y, z$ fulfill $y^{2}+1=(x+1)(z+1)$ and if $y$ is even, then $x$ and $z$ are even as well and either $x<y<z$ or $z<y<x$ holds.
Indeed, the first part is obvious and from $x<y$ we conclude
$$
z+1=\frac{y^{2}+1}{x+1} \geq \frac{y^{2}+1}{y}>y
$$
and similarly in the other case.
Now, if $a_{3}$ was odd, then $\left(a_{2}+1\right)\left(a_{4}+1\right)=a_{3}^{2}+1 \equiv 2 \bmod 4$ would imply that one of $a_{2}$ or $a_{4}$ is even, this contradicts (1). Thus $a_{3}$ and hence also $a_{1}, a_{2}, a_{4}$ and $a_{5}$ are even. According to (1), one has $a_{1}<a_{2}<a_{3}<a_{4}<a_{5}$ or $a_{1}>a_{2}>a_{3}>a_{4}>a_{5}$ but due to the minimality of $a_{1}$ the first series of inequalities must hold.
Consider the identity
$\left(a_{3}+1\right)\left(a_{1}+a_{3}\right)=a_{3}^{2}-1+\left(a_{1}+1\right)\left(a_{3}+1\right)=a_{2}^{2}+a_{3}^{2}=a_{2}^{2}-1+\left(a_{2}+1\right)\left(a_{4}+1\right)=\left(a_{2}+1\right)\left(a_{2}+a_{4}\right)$.
Any common divisor of the two odd numbers $a_{2}+1$ and $a_{3}+1$ must also divide $\left(a_{2}+1\right)\left(a_{4}+\right.$ $1)-\left(a_{3}+1\right)\left(a_{3}-1\right)=2$, so these numbers are relatively prime. Hence the last identity shows that $a_{1}+a_{3}$ must be a multiple of $a_{2}+1$, i.e. there is an integer $k$ such that
$$
a_{1}+a_{3}=k\left(a_{2}+1\right)
$$
Now set $a_{0}=k\left(a_{1}+1\right)-a_{2}$. This is an integer and we have
$$
\begin{aligned}
\left(a_{0}+1\right)\left(a_{2}+1\right) & =k\left(a_{1}+1\right)\left(a_{2}+1\right)-\left(a_{2}-1\right)\left(a_{2}+1\right) \\
& =\left(a_{1}+1\right)\left(a_{1}+a_{3}\right)-\left(a_{1}+1\right)\left(a_{3}+1\right)+2 \\
& =\left(a_{1}+1\right)\left(a_{1}-1\right)+2=a_{1}^{2}+1
\end{aligned}
$$
Thus $a_{0} \geq 0$. If $a_{0}>0$, then by (1) we would have $a_{0}<a_{1}<a_{2}$ and then the quintuple $\left(a_{0}, a_{1}, a_{2}, a_{3}, a_{4}\right)$ would contradict the minimality of $a_{1}$.
Hence $a_{0}=0$, implying $a_{2}=a_{1}^{2}$. But also $a_{2}=k\left(a_{1}+1\right)$, which finally contradicts the fact that $a_{1}+1>1$ is relatively prime to $a_{1}^{2}$ and thus cannot be a divisior of this number.
Hence $n \geq 5$ is not possible.
Comment 1. Finding the example for $n=4$ is not trivial and requires a tedious calculation, but it can be reduced to checking a few cases. The equations $\left(a_{1}+1\right)\left(a_{3}+1\right)=a_{2}^{2}+1$ and $\left(a_{2}+1\right)\left(a_{4}+1\right)=a_{3}^{2}+1$ imply, as seen in the proof, that $a_{1}$ is even and $a_{2}, a_{3}, a_{4}$ are odd. The case $a_{1}=2$ yields $a_{2}^{2} \equiv-1 \bmod 3$ which is impossible. Hence $a_{1}=4$ is the smallest possibility. In this case $a_{2}^{2} \equiv-1 \bmod 5$ and $a_{2}$ is odd, which implies $a_{2} \equiv 3$ or $a_{2} \equiv 7 \bmod 10$. Hence we have to start checking $a_{2}=7,13,17,23,27,33$ and in the last case we succeed.
Comment 2. The choice of $a_{0}=k\left(a_{1}+1\right)-a_{2}$ in the second solution appears more natural if one considers that by the previous calculations one has $a_{1}=k\left(a_{2}+1\right)-a_{3}$ and $a_{2}=k\left(a_{3}+1\right)-a_{4}$. Alternatively, one can solve the equation (2) for $a_{3}$ and use $a_{2}^{2}+1=\left(a_{1}+1\right)\left(a_{3}+1\right)$ to get $a_{2}^{2}-k\left(a_{1}+1\right) a_{2}+a_{1}^{2}-k\left(a_{1}+1\right)=0$. Now $a_{0}$ is the second solution to this quadratic equation in $a_{2}$ (Vieta jumping).
## N5 HUN (Hungary)
Let $P(x)$ be a non-constant polynomial with integer coefficients. Prove that there is no function $T$ from the set of integers into the set of integers such that the number of integers $x$ with $T^{n}(x)=x$ is equal to $P(n)$ for every $n \geq 1$, where $T^{n}$ denotes the $n$-fold application of $T$.
Solution 1. Assume there is a polynomial $P$ of degree at least 1 with the desired property for a given function $T$. Let $A(n)$ denote the set of all $x \in \mathbb{Z}$ such that $T^{n}(x)=x$ and let $B(n)$ denote the set of all $x \in \mathbb{Z}$ for which $T^{n}(x)=x$ and $T^{k}(x) \neq x$ for all $1 \leq k<n$. Both sets are finite under the assumption made. For each $x \in A(n)$ there is a smallest $k \geq 1$ such that $T^{k}(x)=x$, i.e., $x \in B(k)$. Let $d=\operatorname{gcd}(k, n)$. There are positive integers $r, s$ such that $r k-s n=d$ and hence $x=T^{r k}(x)=T^{s n+d}(x)=T^{d}\left(T^{s n}(x)\right)=T^{d}(x)$. The minimality of $k$ implies $d=k$, i.e., $k \mid n$. On the other hand one clearly has $B(k) \subset A(n)$ if $k \mid n$ and thus we have $A(n)=\bigcup_{d \mid n} B(d)$ as a disjoint union and hence
$$
|A(n)|=\sum_{d \mid n}|B(d)|
$$
Furthermore, for every $x \in B(n)$ the elements $x, T^{1}(x), T^{2}(x), \ldots, T^{n-1}(x)$ are $n$ distinct elements of $B(n)$. The fact that they are in $A(n)$ is obvious. If for some $k<n$ and some $0 \leq i<n$ we had $T^{k}\left(T^{i}(x)\right)=T^{i}(x)$, i.e. $\quad T^{k+i}(x)=T^{i}(x)$, that would imply $x=T^{n}(x)=T^{n-i}\left(T^{i}(x)\right)=T^{n-i}\left(T^{k+i}(x)\right)=T^{k}\left(T^{n}(x)\right)=T^{k}(x)$ contradicting the minimality of $n$. Thus $T^{i}(x) \in B(n)$ and $T^{i}(x) \neq T^{j}(x)$ for $0 \leq i<j \leq n-1$.
So indeed, $T$ permutes the elements of $B(n)$ in (disjoint) cycles of length $n$ and in particular one has $n||B(n)|$.
Now let $P(x)=\sum_{i=0}^{k} a_{i} x^{i}, a_{i} \in \mathbb{Z}, k \geq 1, a_{k} \neq 0$ and suppose that $|A(n)|=P(n)$ for all $n \geq 1$. Let $p$ be any prime. Then
$$
p^{2}| | B\left(p^{2}\right)\left|=\left|A\left(p^{2}\right)\right|-|A(p)|=a_{1}\left(p^{2}-p\right)+a_{2}\left(p^{4}-p^{2}\right)+\ldots\right.
$$
Hence $p \mid a_{1}$ and since this is true for all primes we must have $a_{1}=0$.
Now consider any two different primes $p$ and $q$. Since $a_{1}=0$ we have that
$$
\left|A\left(p^{2} q\right)\right|-|A(p q)|=a_{2}\left(p^{4} q^{2}-p^{2} q^{2}\right)+a_{3}\left(p^{6} q^{3}-p^{3} q^{3}\right)+\ldots
$$
is a multiple of $p^{2} q$. But we also have
$$
p^{2} q| | B\left(p^{2} q\right)\left|=\left|A\left(p^{2} q\right)\right|-|A(p q)|-\left|B\left(p^{2}\right)\right|\right.
$$
This implies
$$
p^{2} q| | B\left(p^{2}\right)\left|=\left|A\left(p^{2}\right)\right|-|A(p)|=a_{2}\left(p^{4}-p^{2}\right)+a_{3}\left(p^{6}-p^{3}\right)+\cdots+a_{k}\left(p^{2 k}-p^{k}\right)\right.
$$
Since this is true for every prime $q$ we must have $a_{2}\left(p^{4}-p^{2}\right)+a_{3}\left(p^{6}-p^{3}\right)+\cdots+a_{k}\left(p^{2 k}-p^{k}\right)=0$ for every prime $p$. Since this expression is a polynomial in $p$ of degree $2 k$ (because $a_{k} \neq 0$ ) this is a contradiction, as such a polynomial can have at most $2 k$ zeros.
Comment. The last contradiction can also be reached via
$$
a_{k}=\lim _{p \rightarrow \infty} \frac{1}{p^{2 k}}\left(a_{2}\left(p^{4}-p^{2}\right)+a_{3}\left(p^{6}-p^{3}\right)+\cdots+a_{k}\left(p^{2 k}-p^{k}\right)\right)=0 .
$$
Solution 2. As in the first solution define $A(n)$ and $B(n)$ and assume that a polynomial $P$ with the required property exists. This again implies that $|A(n)|$ and $|B(n)|$ is finite for all positive integers $n$ and that
$$
P(n)=|A(n)|=\sum_{d \mid n}|B(d)| \quad \text { and } \quad n||B(n)| .
$$
Now, for any two distinct primes $p$ and $q$, we have
$$
P(0) \equiv P(p q) \equiv|B(1)|+|B(p)|+|B(q)|+|B(p q)| \equiv|B(1)|+|B(p)| \quad \bmod q
$$
Thus, for any fixed $p$, the expression $P(0)-|B(1)|-|B(p)|$ is divisible by arbitrarily large primes $q$ which means that $P(0)=|B(1)|+|B(p)|=P(p)$ for any prime $p$. This implies that the polynomial $P$ is constant, a contradiction.
## N6 TUR (Turkey)
Let $k$ be a positive integer. Show that if there exists a sequence $a_{0}, a_{1}, \ldots$ of integers satisfying the condition
$$
a_{n}=\frac{a_{n-1}+n^{k}}{n} \quad \text { for all } n \geq 1
$$
then $k-2$ is divisible by 3 .
Solution 1. Part $A$. For each positive integer $k$, there exists a polynomial $P_{k}$ of degree $k-1$ with integer coefficients, i. e., $P_{k} \in \mathbb{Z}[x]$, and an integer $q_{k}$ such that the polynomial identity
$$
x P_{k}(x)=x^{k}+P_{k}(x-1)+q_{k}
$$
is satisfied. To prove this, for fixed $k$ we write
$$
P_{k}(x)=b_{k-1} x^{k-1}+\cdots+b_{1} x+b_{0}
$$
and determine the coefficients $b_{k-1}, b_{k-2}, \ldots, b_{0}$ and the number $q_{k}$ successively. Obviously, we have $b_{k-1}=1$. For $m=k-1, k-2, \ldots, 1$, comparing the coefficients of $x^{m}$ in the identity $\left(I_{k}\right)$ results in an expression of $b_{m-1}$ as an integer linear combination of $b_{k-1}, \ldots, b_{m}$, and finally $q_{k}=-P_{k}(-1)$.
Part $B$. Let $k$ be a positive integer, and let $a_{0}, a_{1}, \ldots$ be a sequence of real numbers satisfying the recursion given in the problem. This recursion can be written as
$$
a_{n}-P_{k}(n)=\frac{a_{n-1}-P_{k}(n-1)}{n}-\frac{q_{k}}{n} \quad \text { for all } n \geq 1
$$
which by induction gives
$$
a_{n}-P_{k}(n)=\frac{a_{0}-P_{k}(0)}{n!}-q_{k} \sum_{i=0}^{n-1} \frac{i!}{n!} \text { for all } n \geq 1
$$
Therefore, the numbers $a_{n}$ are integers for all $n \geq 1$ only if
$$
a_{0}=P_{k}(0) \quad \text { and } \quad q_{k}=0
$$
Part $C$. Multiplying the identity $\left(I_{k}\right)$ by $x^{2}+x$ and subtracting the identities $\left(I_{k+1}\right),\left(I_{k+2}\right)$ and $q_{k} x^{2}=q_{k} x^{2}$ therefrom, we obtain
$$
x T_{k}(x)=T_{k}(x-1)+2 x\left(P_{k}(x-1)+q_{k}\right)-\left(q_{k+2}+q_{k+1}+q_{k}\right),
$$
where the polynomials $T_{k} \in \mathbb{Z}[x]$ are defined by $T_{k}(x)=\left(x^{2}+x\right) P_{k}(x)-P_{k+1}(x)-P_{k+2}(x)-q_{k} x$. Thus
$$
x T_{k}(x) \equiv T_{k}(x-1)+q_{k+2}+q_{k+1}+q_{k} \bmod 2, \quad k=1,2, \ldots
$$
Comparing the degrees, we easily see that this is only possible if $T_{k}$ is the zero polynomial modulo 2 , and
$$
q_{k+2} \equiv q_{k+1}+q_{k} \bmod 2 \quad \text { for } k=1,2, \ldots
$$
Since $q_{1}=-1$ and $q_{2}=0$, these congruences finish the proof.
Solution 2. Part $A$ and $B$. Let $k$ be a positive integer, and suppose there is a sequence $a_{0}, a_{1}, \ldots$ as required. We prove: There exists a polynomial $P \in \mathbb{Z}[x]$, i. e., with integer coefficients, such that $a_{n}=P(n), n=0,1, \ldots$, and $\quad x P(x)=x^{k}+P(x-1)$.
To prove this, we write $\quad P(x)=b_{k-1} x^{k-1}+\cdots+b_{1} x+b_{0} \quad$ and determine the coefficients $b_{k-1}, b_{k-2}, \ldots, b_{0}$ successively such that
$$
x P(x)-x^{k}-P(x-1)=q,
$$
where $q=q_{k}$ is an integer. Comparing the coefficients of $x^{m}$ results in an expression of $b_{m-1}$ as an integer linear combination of $b_{k-1}, \ldots, b_{m}$.
Defining $c_{n}=a_{n}-P(n)$, we get
$$
\begin{aligned}
P(n)+c_{n} & =\frac{P(n-1)+c_{n-1}+n^{k}}{n}, \quad \text { i.e., } \\
q+n c_{n} & =c_{n-1},
\end{aligned}
$$
hence
$$
c_{n}=\frac{c_{0}}{n!}-q \cdot \frac{0!+1!+\cdots+(n-1)!}{n!}
$$
We conclude $\lim _{n \rightarrow \infty} c_{n}=0$, which, using $c_{n} \in \mathbb{Z}$, implies $c_{n}=0$ for sufficiently large $n$. Therefore, we get $q=0$ and $c_{n}=0, n=0,1, \ldots$.
Part C. Suppose that $q=q_{k}=0$, i. e. $x P(x)=x^{k}+P(x-1)$. To consider this identity for arguments $x \in \mathbb{F}_{4}$, we write $\mathbb{F}_{4}=\{0,1, \alpha, \alpha+1\}$. Then we get
$$
\begin{aligned}
\alpha P_{k}(\alpha) & =\alpha^{k}+P_{k}(\alpha+1) \quad \text { and } \\
(\alpha+1) P_{k}(\alpha+1) & =(\alpha+1)^{k}+P_{k}(\alpha),
\end{aligned}
$$
hence
$$
\begin{aligned}
P_{k}(\alpha) & =1 \cdot P_{k}(\alpha)=(\alpha+1) \alpha P_{k}(\alpha) \\
& =(\alpha+1) P_{k}(\alpha+1)+(\alpha+1) \alpha^{k} \\
& =P_{k}(\alpha)+(\alpha+1)^{k}+(\alpha+1) \alpha^{k} .
\end{aligned}
$$
Now, $(\alpha+1)^{k-1}=\alpha^{k}$ implies $k \equiv 2 \bmod 3$.
Comment 1. For $k=2$, the sequence given by $a_{n}=n+1, n=0,1, \ldots$, satisfies the conditions of the problem.
Comment 2. The first few polynomials $P_{k}$ and integers $q_{k}$ are
$$
\begin{aligned}
& P_{1}(x)=1, \quad q_{1}=-1, \\
& P_{2}(x)=x+1, \quad q_{2}=0, \\
& P_{3}(x)=x^{2}+x-1, \quad q_{3}=1, \\
& P_{4}(x)=x^{3}+x^{2}-2 x-1, \quad q_{4}=-1, \\
& P_{5}(x)=x^{4}+x^{3}-3 x^{2}+5, \quad q_{5}=-2, \\
& P_{6}(x)=x^{5}+x^{4}-4 x^{3}+2 x^{2}+10 x-5, \quad q_{6}=9, \\
& q_{7}=-9, \quad q_{8}=-50, \quad q_{9}=267, \quad q_{10}=-413, \quad q_{11}=-2180 .
\end{aligned}
$$
A lookup in the On-Line Encyclopedia of Integer Sequences (A000587) reveals that the sequence $q_{1},-q_{2}, q_{3},-q_{4}, q_{5}, \ldots$ is known as Uppuluri-CARPENTER numbers. The result that $q_{k}=0$ implies $k \equiv 2 \bmod 3$ is contained in
Murty, Summer: On the $p$-adic series $\sum_{n=0}^{\infty} n^{k} \cdot n$ !. CRM Proc. and Lecture Notes 36, 2004. As shown by Alexander (Non-Vanishing of Uppuluri-Carpenter Numbers, Preprint 2006), Uppuluri-Carpenter numbers are zero at most twice.
Comment 3. The numbers $q_{k}$ can be written in terms of the Stirling numbers of the second kind. To show this, we fix the notation such that
$$
\begin{aligned}
x^{k}= & S_{k-1, k-1} x(x-1) \cdots(x-k+1) \\
& +S_{k-1, k-2} x(x-1) \cdots(x-k+2) \\
& +\cdots+S_{k-1,0} x
\end{aligned}
$$
e.g., $S_{2,2}=1, S_{2,1}=3, S_{2,0}=1$, and we define
$$
\Omega_{k}=S_{k-1, k-1}-S_{k-1, k-2}+-\cdots
$$
Replacing $x$ by $-x$ in (*) results in
$$
\begin{aligned}
x^{k}= & S_{k-1, k-1} x(x+1) \cdots(x+k-1) \\
& -S_{k-1, k-2} x(x+1) \cdots(x+k-2) \\
& +-\cdots \pm S_{k-1,0} x
\end{aligned}
$$
Defining
$$
\begin{aligned}
P(x)= & S_{k-1, k-1}(x+1) \cdots(x+k-1) \\
& +\left(S_{k-1, k-1}-S_{k-1, k-2}\right)(x+1) \cdots(x+k-2) \\
& +\left(S_{k-1, k-1}-S_{k-1, k-2}+S_{k-1, k-3}\right)(x+1) \cdots(x+k-3) \\
& +\cdots+\Omega_{k}
\end{aligned}
$$
we obtain
$$
\begin{aligned}
x P(x)-P(x-1)= & S_{k-1, k-1} x(x+1) \cdots(x+k-1) \\
& -S_{k-1, k-2} x(x+1) \cdots(x+k-2) \\
& +-\cdots \pm S_{k-1,0} x-\Omega_{k} \\
= & x^{k}-\Omega_{k}
\end{aligned}
$$
hence $q_{k}=-\Omega_{k}$.
## N7 MNG (Mongolia)
Let $a$ and $b$ be distinct integers greater than 1 . Prove that there exists a positive integer $n$ such that $\left(a^{n}-1\right)\left(b^{n}-1\right)$ is not a perfect square.
Solution 1. At first we notice that
$$
\begin{aligned}
(1-\alpha)^{\frac{1}{2}}(1-\beta)^{\frac{1}{2}} & =\left(1-\frac{1}{2} \cdot \alpha-\frac{1}{8} \cdot \alpha^{2}-\cdots\right)\left(1-\frac{1}{2} \cdot \beta-\frac{1}{8} \cdot \beta^{2}-\cdots\right) \\
& =\sum_{k, \ell \geq 0} c_{k, \ell} \cdot \alpha^{k} \beta^{\ell} \quad \text { for all } \alpha, \beta \in(0,1)
\end{aligned}
$$
where $c_{0,0}=1$ and $c_{k, \ell}$ are certain coefficients.
For an indirect proof, we suppose that $x_{n}=\sqrt{\left(a^{n}-1\right)\left(b^{n}-1\right)} \in \mathbb{Z}$ for all positive integers $n$. Replacing $a$ by $a^{2}$ and $b$ by $b^{2}$ if necessary, we may assume that $a$ and $b$ are perfect squares, hence $\sqrt{a b}$ is an integer.
At first we shall assume that $a^{\mu} \neq b^{\nu}$ for all positive integers $\mu, \nu$. We have
$$
x_{n}=(\sqrt{a b})^{n}\left(1-\frac{1}{a^{n}}\right)^{\frac{1}{2}}\left(1-\frac{1}{b^{n}}\right)^{\frac{1}{2}}=\sum_{k, \ell \geq 0} c_{k, \ell}\left(\frac{\sqrt{a b}}{a^{k} b^{\ell}}\right)^{n} .
$$
Choosing $k_{0}$ and $\ell_{0}$ such that $a^{k_{0}}>\sqrt{a b}, b^{\ell_{0}}>\sqrt{a b}$, we define the polynomial
$$
P(x)=\prod_{k=0, \ell=0}^{k_{0}-1, \ell_{0}-1}\left(a^{k} b^{\ell} x-\sqrt{a b}\right)=: \sum_{i=0}^{k_{0} \cdot \ell_{0}} d_{i} x^{i}
$$
with integer coefficients $d_{i}$. By our assumption, the zeros
$$
\frac{\sqrt{a b}}{a^{k} b^{\ell}}, \quad k=0, \ldots, k_{0}-1, \quad \ell=0, \ldots, \ell_{0}-1
$$
of $P$ are pairwise distinct.
Furthermore, we consider the integer sequence
$$
y_{n}=\sum_{i=0}^{k_{0} \cdot \ell_{0}} d_{i} x_{n+i}, \quad n=1,2, \ldots
$$
By the theory of linear recursions, we obtain
$$
y_{n}=\sum_{\substack{k, \ell \geq 0 \\ k \geq k_{0} \text { or } \ell \geq \ell_{0}}} e_{k, \ell}\left(\frac{\sqrt{a b}}{a^{k} b^{\ell}}\right)^{n}, \quad n=1,2, \ldots
$$
with real numbers $e_{k, \ell}$. We have
$$
\left|y_{n}\right| \leq \sum_{\substack{k, \ell \geq 0 \\ k \geq k_{0} \text { or } \ell \geq \ell_{0}}}\left|e_{k, \ell}\right|\left(\frac{\sqrt{a b}}{a^{k} b^{\ell}}\right)^{n}=: M_{n} .
$$
Because the series in (4) is obtained by a finite linear combination of the absolutely convergent series (1), we conclude that in particular $M_{1}<\infty$. Since
$$
\frac{\sqrt{a b}}{a^{k} b^{\ell}} \leq \lambda:=\max \left\{\frac{\sqrt{a b}}{a^{k_{0}}}, \frac{\sqrt{a b}}{b^{\ell_{0}}}\right\} \quad \text { for all } k, \ell \geq 0 \text { such that } k \geq k_{0} \text { or } \ell \geq \ell_{0}
$$
we get the estimates $M_{n+1} \leq \lambda M_{n}, n=1,2, \ldots$ Our choice of $k_{0}$ and $\ell_{0}$ ensures $\lambda<1$, which implies $M_{n} \rightarrow 0$ and consequently $y_{n} \rightarrow 0$ as $n \rightarrow \infty$. It follows that $y_{n}=0$ for all sufficiently large $n$.
So, equation (3) reduces to $\sum_{i=0}^{k_{0} \cdot \ell_{0}} d_{i} x_{n+i}=0$.
Using the theory of linear recursions again, for sufficiently large $n$ we have
$$
x_{n}=\sum_{k=0, \ell=0}^{k_{0}-1, \ell_{0}-1} f_{k, \ell}\left(\frac{\sqrt{a b}}{a^{k} b^{\ell}}\right)^{n}
$$
for certain real numbers $f_{k, \ell}$.
Comparing with (2), we see that $f_{k, \ell}=c_{k, \ell}$ for all $k, \ell \geq 0$ with $k<k_{0}, \ell<\ell_{0}$, and $c_{k, \ell}=0$ if $k \geq k_{0}$ or $\ell \geq \ell_{0}$, since we assumed that $a^{\mu} \neq b^{\nu}$ for all positive integers $\mu, \nu$.
In view of (1), this means
$$
(1-\alpha)^{\frac{1}{2}}(1-\beta)^{\frac{1}{2}}=\sum_{k=0, \ell=0}^{k_{0}-1, \ell_{0}-1} c_{k, \ell} \cdot \alpha^{k} \beta^{\ell}
$$
for all real numbers $\alpha, \beta \in(0,1)$. We choose $k^{*}<k_{0}$ maximal such that there is some $i$ with $c_{k^{*}, i} \neq 0$. Squaring (5) and comparing coefficients of $\alpha^{2 k^{*}} \beta^{2 i^{*}}$, where $i^{*}$ is maximal with $c_{k^{*}, i^{*}} \neq 0$, we see that $k^{*}=0$. This means that the right hand side of (5) is independent of $\alpha$, which is clearly impossible.
We are left with the case that $a^{\mu}=b^{\nu}$ for some positive integers $\mu$ and $\nu$. We may assume that $\mu$ and $\nu$ are relatively prime. Then there is some positive integer $c$ such that $a=c^{\nu}$ and $b=c^{\mu}$. Now starting with the expansion (2), i. e.,
$$
x_{n}=\sum_{j \geq 0} g_{j}\left(\frac{\sqrt{c^{\mu+\nu}}}{c^{j}}\right)^{n}
$$
for certain coefficients $g_{j}$, and repeating the arguments above, we see that $g_{j}=0$ for sufficiently large $j$, say $j>j_{0}$. But this means that
$$
\left(1-x^{\mu}\right)^{\frac{1}{2}}\left(1-x^{\nu}\right)^{\frac{1}{2}}=\sum_{j=0}^{j_{0}} g_{j} x^{j}
$$
for all real numbers $x \in(0,1)$. Squaring, we see that
$$
\left(1-x^{\mu}\right)\left(1-x^{\nu}\right)
$$
is the square of a polynomial in $x$. In particular, all its zeros are of order at least 2 , which implies $\mu=\nu$ by looking at roots of unity. So we obtain $\mu=\nu=1$, i. e., $a=b$, a contradiction.
Solution 2. We set $a^{2}=A, b^{2}=B$, and $z_{n}=\sqrt{\left(A^{n}-1\right)\left(B^{n}-1\right)}$. Let us assume that $z_{n}$ is an integer for $n=1,2, \ldots$. Without loss of generality, we may suppose that $b<a$. We determine an integer $k \geq 2$ such that $b^{k-1} \leq a<b^{k}$, and define a sequence $\gamma_{1}, \gamma_{2}, \ldots$ of rational numbers such that
$$
2 \gamma_{1}=1 \quad \text { and } \quad 2 \gamma_{n+1}=\sum_{i=1}^{n} \gamma_{i} \gamma_{n-i} \text { for } n=1,2, \ldots
$$
It could easily be shown that $\gamma_{n}=\frac{1 \cdot 1 \cdot 3 . .(2 n-3)}{2 \cdot 4 \cdot 6 \cdot \ldots 2 n}$, for instance by reading VANDERMONDEs convolution as an equation between polynomials, but we shall have no use for this fact.
Using Landaus $O$-Notation in the usual way, we have
$$
\begin{aligned}
& \left\{(a b)^{n}-\gamma_{1}\left(\frac{a}{b}\right)^{n}-\gamma_{2}\left(\frac{a}{b^{3}}\right)^{n}-\cdots-\gamma_{k}\left(\frac{a}{b^{2 k-1}}\right)^{n}+O\left(\frac{b}{a}\right)^{n}\right\}^{2} \\
& =A^{n} B^{n}-2 \gamma_{1} A^{n}-\sum_{i=2}^{k}\left(2 \gamma_{i}-\sum_{j=1}^{i-1} \gamma_{j} \gamma_{i-j}\right)\left(\frac{A}{B^{i-1}}\right)^{n}+O\left(\frac{A}{B^{k}}\right)^{n}+O\left(B^{n}\right) \\
& =A^{n} B^{n}-A^{n}+O\left(B^{n}\right)
\end{aligned}
$$
whence
$$
z_{n}=(a b)^{n}-\gamma_{1}\left(\frac{a}{b}\right)^{n}-\gamma_{2}\left(\frac{a}{b^{3}}\right)^{n}-\cdots-\gamma_{k}\left(\frac{a}{b^{2 k-1}}\right)^{n}+O\left(\frac{b}{a}\right)^{n}
$$
Now choose rational numbers $r_{1}, r_{2}, \ldots, r_{k+1}$ such that
$$
(x-a b) \cdot\left(x-\frac{a}{b}\right) \ldots\left(x-\frac{a}{b^{2 k-1}}\right)=x^{k+1}-r_{1} x^{k}+-\cdots \pm r_{k+1}
$$
and then a natural number $M$ for which $M r_{1}, M r_{2}, \ldots M r_{k+1}$ are integers. For known reasons,
$$
M\left(z_{n+k+1}-r_{1} z_{n+k}+-\cdots \pm r_{k+1} z_{n}\right)=O\left(\frac{b}{a}\right)^{n}
$$
for all $n \in \mathbb{N}$ and thus there is a natural number $N$ which is so large, that
$$
z_{n+k+1}=r_{1} z_{n+k}-r_{2} z_{n+k-1}+-\cdots \mp r_{k+1} z_{n}
$$
holds for all $n \geqslant N$. Now the theory of linear recursions reveals that there are some rational numbers $\delta_{0}, \delta_{1}, \delta_{2}, \ldots, \delta_{k}$ such that
$$
z_{n}=\delta_{0}(a b)^{n}-\delta_{1}\left(\frac{a}{b}\right)^{n}-\delta_{2}\left(\frac{a}{b^{3}}\right)^{n}-\cdots-\delta_{k}\left(\frac{a}{b^{2 k-1}}\right)^{n}
$$
for sufficiently large $n$, where $\delta_{0}>0$ as $z_{n}>0$. As before, one obtains
$$
\begin{aligned}
& A^{n} B^{n}-A^{n}-B^{n}+1=z_{n}^{2} \\
& =\left\{\delta_{0}(a b)^{n}-\delta_{1}\left(\frac{a}{b}\right)^{n}-\delta_{2}\left(\frac{a}{b^{3}}\right)^{n}-\cdots-\delta_{k}\left(\frac{a}{b^{2 k-1}}\right)^{n}\right\}^{2} \\
& =\delta_{0}^{2} A^{n} B^{n}-2 \delta_{0} \delta_{1} A^{n}-\sum_{i=2}^{i=k}\left(2 \delta_{0} \delta_{i}-\sum_{j=1}^{j=i-1} \delta_{j} \delta_{i-j}\right)\left(\frac{A}{B^{i-1}}\right)^{n}+O\left(\frac{A}{B^{k}}\right)^{n}
\end{aligned}
$$
Easy asymptotic calculations yield $\delta_{0}=1, \delta_{1}=\frac{1}{2}, \delta_{i}=\frac{1}{2} \sum_{j=1}^{j=i-1} \delta_{j} \delta_{i-j}$ for $i=2,3, \ldots, k-2$, and then $a=b^{k-1}$. It follows that $k>2$ and there is some $P \in \mathbb{Q}[X]$ for which $(X-1)\left(X^{k-1}-1\right)=$ $P(X)^{2}$. But this cannot occur, for instance as $X^{k-1}-1$ has no double zeros. Thus our
assumption that $z_{n}$ was an integer for $n=1,2, \ldots$ turned out to be wrong, which solves the problem.
Original formulation of the problem. $a, b$ are positive integers such that $a \cdot b$ is not a square of an integer. Prove that there exists a (infinitely many) positive integer $n$ such that ( $\left.a^{n}-1\right)\left(b^{n}-1\right)$ is not a square of an integer.
Solution. Lemma. Let $c$ be a positive integer, which is not a perfect square. Then there exists an odd prime $p$ such that $c$ is not a quadratic residue modulo $p$.
Proof. Denoting the square-free part of $c$ by $c^{\prime}$, we have the equality $\left(\frac{c^{\prime}}{p}\right)=\left(\frac{c}{p}\right)$ of the corresponding LegEndre symbols. Suppose that $c^{\prime}=q_{1} \cdots q_{m}$, where $q_{1}<\cdots<q_{m}$ are primes. Then we have
$$
\left(\frac{c^{\prime}}{p}\right)=\left(\frac{q_{1}}{p}\right) \cdots\left(\frac{q_{m}}{p}\right)
$$
Case 1. Let $q_{1}$ be odd. We choose a quadratic nonresidue $r_{1}$ modulo $q_{1}$ and quadratic residues $r_{i}$ modulo $q_{i}$ for $i=2, \ldots, m$. By the Chinese remainder theorem and the Dirichlet theorem, there exists a (infinitely many) prime $p$ such that
$$
\begin{aligned}
& p \equiv r_{1} \bmod q_{1} \\
& p \equiv r_{2} \bmod q_{2} \\
& \vdots \\
& \quad \vdots \\
& p \equiv r_{m} \bmod q_{m} \\
& p \equiv 1 \bmod 4
\end{aligned}
$$
By our choice of the residues, we obtain
$$
\left(\frac{p}{q_{i}}\right)=\left(\frac{r_{i}}{q_{i}}\right)= \begin{cases}-1, & i=1 \\ 1, & i=2, \ldots, m\end{cases}
$$
The congruence $p \equiv 1 \bmod 4$ implies that $\left(\frac{q_{i}}{p}\right)=\left(\frac{p}{q_{i}}\right), i=1, \ldots, m$, by the law of quadratic reciprocity. Thus
$$
\left(\frac{c^{\prime}}{p}\right)=\left(\frac{q_{1}}{p}\right) \cdots\left(\frac{q_{m}}{p}\right)=-1
$$
Case 2. Suppose $q_{1}=2$. We choose quadratic residues $r_{i}$ modulo $q_{i}$ for $i=2, \ldots, m$. Again, by the Chinese remainder theorem and the Dirichlet theorem, there exists a prime $p$ such that
$$
\begin{aligned}
& p \equiv r_{2} \bmod q_{2} \\
& \vdots \\
& \quad \vdots \\
& p \equiv r_{m} \bmod q_{m} \\
& p \equiv 5 \bmod 8
\end{aligned}
$$
By the choice of the residues, we obtain $\left(\frac{p}{q_{i}}\right)=\left(\frac{r_{i}}{q_{i}}\right)=1$ for $i=2, \ldots, m$. Since $p \equiv 1 \bmod 4$ we have $\left(\frac{q_{i}}{p}\right)=\left(\frac{p}{q_{i}}\right), i=2, \ldots, m$, by the law of quadratic reciprocity. The congruence $p \equiv 5 \bmod 8$
implies that $\left(\frac{2}{p}\right)=-1$. Thus
$$
\left(\frac{c^{\prime}}{p}\right)=\left(\frac{2}{p}\right)\left(\frac{q_{2}}{p}\right) \cdots\left(\frac{q_{m}}{p}\right)=-1
$$
and the lemma is proved.
Applying the lemma for $c=a \cdot b$, we find an odd prime $p$ such that
$$
\left(\frac{a b}{p}\right)=\left(\frac{a}{p}\right) \cdot\left(\frac{b}{p}\right)=-1 .
$$
This implies either
$$
a^{\frac{p-1}{2}} \equiv 1 \bmod p, \quad b^{\frac{p-1}{2}} \equiv-1 \bmod p, \quad \text { or } \quad a^{\frac{p-1}{2}} \equiv-1 \bmod p, \quad b^{\frac{p-1}{2}} \equiv 1 \bmod p
$$
Without loss of generality, suppose that $a^{\frac{p-1}{2}} \equiv 1 \bmod p$ and $b^{\frac{p-1}{2}} \equiv-1 \bmod p$. The second congruence implies that $b^{\frac{p-1}{2}}-1$ is not divisible by $p$. Hence, if the exponent $\nu_{p}\left(a^{\frac{p-1}{2}}-1\right)$ of $p$ in the prime decomposition of $\left(a^{\frac{p-1}{2}}-1\right)$ is odd, then $\left(a^{\frac{p-1}{2}}-1\right)\left(b^{\frac{p-1}{2}}-1\right)$ is not a perfect square. If $\nu_{p}\left(a^{\frac{p-1}{2}}-1\right)$ is even, then $\nu_{p}\left(a^{\frac{p-1}{2} p}-1\right)$ is odd by the well-known power lifting property
$$
\nu_{p}\left(a^{\frac{p-1}{2} p}-1\right)=\nu_{p}\left(a^{\frac{p-1}{2}}-1\right)+1 .
$$
In this case, $\left(a^{\frac{p-1}{2} p}-1\right)\left(b^{\frac{p-1}{2} p}-1\right)$ is not a perfect square.
Comment 1. In 1998, the following problem appeared in Crux Mathematicorum:
Problem 2344. Find all positive integers $N$ that are quadratic residues modulo all primes greater than $N$.
The published solution (Crux Mathematicorum, 25(1999)4) is the same as the proof of the lemma given above, see also http://www.mathlinks.ro/viewtopic.php?t=150495.
Comment 2. There is also an elementary proof of the lemma. We cite Theorem 3 of Chapter 5 and its proof from the book
Ireland, Rosen: A Classical Introduction to Modern Number Theory, Springer 1982.
Theorem. Let $a$ be a nonsquare integer. Then there are infinitely many primes $p$ for which $a$ is a quadratic nonresidue.
Proof. It is easily seen that we may assume that $a$ is square-free. Let $a=2^{e} q_{1} q_{2} \cdots q_{n}$, where $q_{i}$ are distinct odd primes and $e=0$ or 1 . The case $a=2$ has to be dealt with separately. We shall assume to begin with that $n \geq 1$, i. e., that $a$ is divisible by an odd prime.
Let $\ell_{1}, \ell_{2}, \ldots, \ell_{k}$ be a finite set of odd primes not including any $q_{i}$. Let $s$ be any quadratic nonresidue $\bmod q_{n}$, and find a simultaneous solution to the congruences
$$
\begin{aligned}
& x \equiv 1 \bmod \ell_{i}, \quad i=1, \ldots, k, \\
& x \equiv 1 \bmod 8, \\
& x \equiv 1 \bmod q_{i}, \quad i=1, \ldots, n-1, \\
& x \equiv s \bmod q_{n} .
\end{aligned}
$$
Call the solution $b . b$ is odd. Suppose that $b=p_{1} p_{2} \cdots p_{m}$ is its prime decomposition. Since
$b \equiv 1 \bmod 8$ we have $\left(\frac{2}{b}\right)=1$ and $\left(\frac{q_{i}}{b}\right)=\left(\frac{b}{q_{i}}\right)$ by a result on JACOBI symbols. Thus
$$
\left(\frac{a}{b}\right)=\left(\frac{2}{b}\right)^{e}\left(\frac{q_{1}}{b}\right) \cdots\left(\frac{q_{n-1}}{b}\right)\left(\frac{q_{n}}{b}\right)=\left(\frac{b}{q_{1}}\right) \cdots\left(\frac{b}{q_{n-1}}\right)\left(\frac{b}{q_{n}}\right)=\left(\frac{1}{q_{1}}\right) \cdots\left(\frac{1}{q_{n-1}}\right)\left(\frac{s}{q_{n}}\right)=-1
$$
On the other hand, by the definition of $\left(\frac{a}{b}\right)$, we have $\left(\frac{a}{b}\right)=\left(\frac{a}{p_{1}}\right)\left(\frac{a}{p_{2}}\right) \cdots\left(\frac{a}{p_{m}}\right)$. It follows that $\left(\frac{a}{p_{i}}\right)=-1$ for some $i$.
Notice that $\ell_{j}$ does not divide $b$. Thus $p_{i} \notin\left\{\ell_{1}, \ell_{2}, \ldots, \ell_{k}\right\}$.
To summarize, if $a$ is a nonsquare, divisible by an odd prime, we have found a prime $p$, outside of a given finite set of primes $\left\{2, \ell_{1}, \ell_{2}, \ldots, \ell_{k}\right\}$, such that $\left(\frac{a}{p}\right)=-1$. This proves the theorem in this case.
It remains to consider the case $a=2$. Let $\ell_{1}, \ell_{2}, \ldots, \ell_{k}$ be a finite set of primes, excluding 3 , for which $\left(\frac{2}{\ell_{i}}\right)=-1$. Let $b=8 \ell_{1} \ell_{2} \cdots \ell_{k}+3 . b$ is not divisible by 3 or any $\ell_{i}$. Since $b \equiv 3 \bmod 8$ we have $\left(\frac{2}{b}\right)=(-1)^{\frac{b^{2}-1}{8}}=-1$. Suppose that $b=p_{1} p_{2} \cdots p_{m}$ is the prime decomposition of b. Then, as before, we see that $\left(\frac{2}{p_{i}}\right)=-1$ for some $i . p_{i} \notin\left\{3, \ell_{1}, \ell_{2}, \ldots, \ell_{k}\right\}$. This proves the theorem for $a=2$.
This proof has also been posted to mathlinks, see http://www.mathlinks.ro/viewtopic. php?t=150495 again.
The IMO 2009 is organised by §Bildung
|