Recreational Mathematics
Paul Yiu
Department of Mathematics Florida Atlantic University
Summer 2006
Chapters 1–36
Wednesday, July 26
Monday *** 7/3 7/10 7/17 7/24 Wednesday *** 7/5 7/12 7/19 7/26 Friday 6/30 7/7 7/14 7/21 7/28 ii Contents
1 The Nim game 101 1.1 Euclidean algorithm ...... 101 1.2 Binary representation of a number ...... 101 1.2.1 A number from its binary representation . ....102 1.3 Thenimsum...... 102 1.4 The game Nim ...... 103
2 The Josephus problem and its generalization 105 2.1 The Josephus problem ...... 105 2.2 The generalized Josephus problem J(n, k) ...... 107
3 Representation of a number in different bases 109 3.1 Base b-representation of a number ...... 109 3.1.1 A number from its base b-representation . ....110 3.2 Balanced division by an odd number ...... 111 3.3 Balanced base b representation of a number ...... 112 3.4 Arithmetic in balanced base 3 representations . ....113
4 A card trick 201
5 Cheney’s card trick 205 5.1 Three basic principles ...... 205 5.1.1 The pigeonhole principle ...... 205 5.1.2 Arithmetic modulo 13 ...... 205 5.1.3 Permutations of three objects ...... 206
6 Coin weighing 209 6.1 Coin weighing with 3 standard weights ...... 209 6.2 A twelve coin problem ...... 209 iv CONTENTS
7 Greatest common divisor 301 7.1 gcd(a, b) from the Euclidean algorithm ...... 301 7.1.1 gcd(a, b) as an integer combination of a and b . . 302 7.2 gcd(a, b) by counting interior points of a lattice triangle 302 7.2.1 Calculation of gcd ...... 303 7.3 Fibonacci numbers ...... 304
8 Lattice polygons 307 8.1 Pick’s Theorem: area of lattice polygon ...... 307 8.2 Counting primitive triangles ...... 308 8.2.1 The number of primitive triangles in a lattice polygon ...... 308
9 The Farey sequences 311 9.1 The Farey sequence ...... 311 9.2 Primitive lattice triangles ...... 312 √ 10 Irrationality of n √ 401 10.1 Irrationality of 2 ...... 401 10.1.1 Reasoning with units digits ...... 401 10.1.2 Reasoning with even and odd ...... 401 10.1.3 Reasoning in a base 3 ...... 402 10.1.4 Geometric√ proof ...... 402 10.2 Irrationality of n ...... 402 10.2.1 N. J. Fine’s proof ...... 402 10.2.2 P. Ungar’s proof ...... 403 10.3 Nonexistence of regular lattice polygon ...... 403
11 Continued fractions 405 11.1 Simple continued fractions ...... 405 11.2 Finite simple continued fractions ...... 405 11.3 Convergents ...... 406√ 11.4 Continued fraction expansion of d ...... 407
12 The integer equations x2 − dy2 = ±1 409 12.1 Integer solutions of x2 − dy2 =1 ...... 409 12.2 Integer solutions of x2 − dy2 = −1 ...... 410 12.3 The equation x2 − 2y2 =1 ...... 411 12.4 Applications ...... 411 12.4.1 Triangular numbers which are squares ...... 411 CONTENTS v
12.4.2 Pythagorean triangles with consecutive legs . . . 411 12.4.3 ...... 412
13 Pythagorean triangles 501 13.1 Primitive Pythagorean triples ...... 501 13.1.1 Rational angles ...... 502 13.1.2 Some basic properties of primitive Pythagorean triples ...... 503 13.2 Pythagorean triangles with given sides ...... 503 13.3 Enumeration of primitive Pythagorean triangles ....503 13.4 A Pythagorean triangle with an inscribed square ....504 13.5 When are x2 − px ± q both factorable? ...... 505 13.6 Dissection of a square into Pythagorean triangles ....506
14 3-4-5 triangles in the square 507
15 Dissections 509 15.1 The tangram ...... 509 15.2 Dissection of the square ...... 510 15.2.1 Dissection of the square into 8 parts in arith- metic progression ...... 510 15.2.2 Dissection of a square into 7 rectangles . ....510
16 The classical triangle centers 601 16.1 The centroid ...... 601 16.2 The circumcircle ...... 602 16.3 The incenter and the incircle ...... 603 16.4 The orthocenter and the Euler line ...... 604 16.5 The excenters and the excircles ...... 605
17 Medians and angle bisectors 607 17.1 Stewart’s theorem ...... 607 17.2 The medians ...... 607 17.3 The angle bisectors ...... 608 17.4 The problem of three angle bisectors ...... 609
18 Isosceles triangles equal in perimeter and area 611 vi CONTENTS
19 The area of a triangle 701 19.1 Heron’s formula for the area of a triangle ...... 701 19.2 Heron triangles ...... 702 19.3 Heron triangles with consecutive sides ...... 702 19.4 Heron triangles with sides in arithmetic progression . . 704 19.5 Heron triangles with integer medians ...... 705
20 Heron triangles and incircles 707 20.1 Enumeration of Heron triangles by inradii ...... 707 20.2 Inradii in arithmetic progression ...... 708 20.3 Division of a triangle into two subtriangles with equal incircles ...... 709
21 More about Heron triangles 711 21.1 Heron triangle as lattice triangle ...... 711 21.2 The circumcircle of a Heron triangle ...... 711 21.3 Heron triangles with square areas ...... 712
22 The regular pentagon 801 22.1 The golden ratio ...... 801 22.2 The diagonal-side ratio of a regular pentagon ...... 802 22.3 Construction of a regular pentagon with a given diagonal 803 22.4 Some interesting constructions of the golden ratio . . . 804 22.4.1 Construction of 36◦, 54◦, and 72◦ angles . . . . . 804 22.4.2 Odom’s construction ...... 804 22.4.3 ϕ and arctan 2 ...... 805
23 Construction of regular polygons 807 23.1 The regular hexagon ...... 807 23.2 The regular octagon ...... 808 23.3 The regular dodecagon ...... 809 23.4 Construction of a regular 15-gon ...... 810 23.5 Construction of a regular 17-gon ...... 811
24 Hofstetter’s constructions on the golden section 813 24.1 A simple construction of the golden section ...... 813 24.2 A 5-step division of a segment in the golden section . . 815 24.3 Another 5-step division of a segment in the golden sec- tion ...... 816 CONTENTS vii
24.4 Divison of a segment in the golden section with ruler and rusty compass ...... 818 24.5 A 4-step construction of the golden ratio ...... 820
25 Prime and perfect numbers 901 25.1 Infinitude of prime numbers ...... 901 25.1.1 Euclid’s proof ...... 901 25.1.2 Fermat numbers ...... 901 25.1.3 Fibonacci numbers ...... 902 25.2 The prime numbers below 20000 ...... 902 25.3 Primes in arithmetic progression ...... 903 25.4 The prime number spirals ...... 903 25.4.1 The prime number spiral beginning with 17 . . . 904 25.4.2 The prime number spiral beginning with 41 . . . 905 25.5 Perfect numbers ...... 907 25.6 Charles Twigg on the first 10 perfect numbers . ....908 25.7 Mersenne primes ...... 909
26 Digit problems 911 26.1 Some intriguing division problems ...... 911 26.1.1 Problem E1 of the MONTHLY ...... 911 26.1.2 Problem E10 of the MONTHLY ...... 912 26.2 Problem E1111 of the MONTHLY ...... 913 26.3 k-right-transposable integers ...... 914 26.4 k-left-transposable integers ...... 914
27 The repunits 917 27.1 Recurring decimals ...... 917 27.2 The period length of a prime ...... 918 1 27.2.1 Decimal expansions of pn ...... 919 28 Routh and Ceva theorems 1001 28.1 A worked example on homogeneous barycentric coor- dinates ...... 1001 28.2 Routh theorem ...... 1002 28.3 Ceva Theorem ...... 1003
29 Equilateral triangle in a rectangle 1005 29.1 Equilateral triangle inscribed in a rectangle ...... 1005 viii CONTENTS
29.2 Construction of equilateral triangle inscribed in a rect- angle ...... 1006
30 The shoemaker’s knife 1007 30.1 Archimedes’ twin circles ...... 1007 30.2 Incircle of the shoemaker’s knife ...... 1008 30.2.1 Archimedes’ construction ...... 1008 30.2.2 Bankoff’s constructions ...... 1009 30.2.3 Woo’s three constructions ...... 1010 30.3 More Archimedean circles ...... 1010
31 Permutations 1101 31.1 The universal sequence of permutations ...... 1101 31.2 The position of a permutation in the universal sequence 1102
32 Cycle decompositions 1105 32.1 The disjoint cycle decomposition of a permutation . . . 1105 32.2 Dudeney’s puzzle ...... 1106 32.3 Dudeney’s Canterbury puzzle 3 ...... 1107
33 More card Games 1109 33.1 Perfect shuffles ...... 1109 33.1.1 In-shuffles ...... 1110 33.1.2 Out-shuffles ...... 1111 33.2 Monge’s shuffle ...... 1113
34 Figurate numbers 1201 34.1 Triangular numbers ...... 1201 34.1.1 Palindromic triangular numbers ...... 1201 34.2 Pentagonal numbers ...... 1202 34.2.1 Palindromic pentagonal numbers ...... 1202
34.3 The polygonal numbers Pk,n ...... 1202 34.4 Sums of powers of consecutive integes ...... 1203
35 Sums of consecutive squares 1205 35.1 The odd number case ...... 1205 35.2 The even number case ...... 1207 CONTENTS ix
36 Polygonal triples 1209 36.1 Double ruling of S ...... 1210 36.2 Primitive Pythagorean triple associated with a k-gonal triple ...... 1211 36.3 Triples of triangular numbers ...... 1211 36.4 k-gonal triples determined by a Pythagorean triple . . . 1212 36.5 Correspondence between (2h +1)-gonal and 4h-gonal triples ...... 1214
Chapter 1
The Nim game
1.1 Euclidean algorithm
The euclidean algorithm is the basis of everything in arithmetic. Given integers a and b>0, there are unique integers q and r so that a = bq + r, 0 ≤ r The integer q is the quotient of the division of a by b, and r is the a remainder. The quotient is sometimes written as b . It is the floor a of b . More generally, the ceiling and the floor of a real number α are defined as follows. x := max{n ∈ Z : n ≥ x}, x := min{n ∈ Z : n ≤ x}. 1.2 Binary representation of a number Given an integer n (in decimal form), to rewrite it in a different base b, keeping on dividing the number by 2, and record the remainders, which are 0 or 1, from right to left. The resulting sequence, which always begins with a nonzero leftmost digit, is the binary representation of n. 102 The Nim game Example 1.1. 123 = [1111011]2 divisor quotient remainder 2 123 1 61 1 30 0 15 1 7 1 3 1 1 The binary representation of a number expresses the number as a sum of distinct powers of 2. Example 1.2. 145 = 128 + 16 + 1 = [10010001]2. 1.2.1 A number from its binary representation Given the binary representation of an integer: n =[a0a1 ···ak−1ak]2, to find the integer in its decimal form, calculate a sequence of numbers n0, n1,...,nk as follows: (i) n0 = a0, (ii) for i =1, 2,...,k, ni = ai +2· ni−1. Then, n = nk. Example 1.3. [1111011]2 = 123. 1 1 1 1 0 1 1 2 2 6 14 30 60 122 1 3 7 15 30 61 123 1.3 The nim sum The nim sum of two nonnegative integers is the addition in their binary representations without carries. If we write 0 0=0, 0 1=1 0=1, 1 1=0, 1.4 The game Nim 103 then in terms of the binary representations of a and b, a b =[a1a2 ···an]2 [b1b2 ···bn]2 =[(a1 b1)(a2 b2) ···(an bn)]2. The nim sum is associative, commutative, and has 0 as identity ele- ment. In particular, a a =0for every natural number a. Example 1.4. 123 145 = [1111011]2 [10010001]2 = [11101010]2 = 234. Here are the nim sums of numbers ≤ 7: