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 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 ...... 914 26.4 k-left-transposable integers ...... 914

27 The repunits 917 27.1 Recurring ...... 917 27.2 The period length of a prime ...... 918 1 27.2.1 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 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 a.

Example 1.4. 123 145 = [1111011]2 [10010001]2 = [11101010]2 = 234. Here are the nim sums of numbers ≤ 7:

01234567 0 01234567 1 10325476 2 23016745 3 32107654 4 45670123 5 54761032 6 67452301 7 76543210

1.4 The game Nim

Given three piles of marbles, with a, b, c marbles respectively, players A and B alternately remove a positive amount of marbles from any pile. The player who makes the last move wins. Theorem 1.1. In the game nim, the player who can balance the nim sum equation has a winning strategy. Therefore, provided that the initial position (a, b, c) does not satisfy a b c =0, the first player has a winning strategy. For example, suppose the initial position is (12, 7, 9). Since 12 9=5, the first player can remove 2 marbles from the second pile to maintain a balance of the nim sum equation, 12 5 9=0 thereby securing a winning position. This theorem indeed generalizes to an arbitrary number of piles. 104 The Nim game Chapter 2

The Josephus problem and its generalization

2.1 The Josephus problem

There are n people forming a circle. In succession, every second person is escorted out from the circle, and the last one is awarded a prize. Who is the prize winner?

Examples (1) n =10: 2 6

4 3 * 1 5 2

3 6 1 8

7 10 7 5 8 9

4 9 (2) n =21. After the removal of the 10 even numbered ones and then 106 The Josephus problem and its generalization the first, there are the 10 odd numbers 3, 5, ..., 19,21. The survivor is the 5-th of this list, which is 11. Theorem 2.1. Let J(n) be the “prize winner” in the Josephus problem for n people.

J(2n)=2J(n) − 1, J(2n +1)=2J(n)+1.

Example 2.1.

J(100) =2J(50) − 1 =2(2J(25) − 1) − 1=4J(25) − 3 =4(2J(12) + 1) − 3=8J(12) + 1 =8(2J(6) − 1) + 1 = 16J(6) − 7 =16(2J(3) − 1) − 7=32J(3) − 23 =32(2J(1) + 1) − 23 = 64J(1) + 9 =73.

There is an almost explicit expression for J(n):if2m is the largest power of 2 ≤ n, then

J(n)=2(n − 2m)+1.

Corollary 2.2. The binary expansion of J(n) is obtained by transferring the leftmost digit 1 of the binary expansion of n to the rightmost.

J(100) = J([1100100]2) = [1001001]2 =64+8+1=73.

Exercise 1. For what values of n is J(n)=n?

2. For what values of n is J(n)=n − 1? 2.2 The generalized Josephus problem J(n, k) 107

2.2 The generalized Josephus problem J(n, k)

The generalized Josephus problem J(n, k) asks for the “prize winner” J(n, k) when beginning with 1, every k-th member (counting cyclically) is escorted out from the circle originally formed by n people. Example 2.2. J(10, 3): J(10, 3) = 4. * 1

4 3 8 4 5 2

2 6 1 6

7 10 5 9 8 9

7 3 For n =10, here are the sequences of elimination depending on the values of k. The last column gives the prize winners.

k J(10,k) 1 123456789 10 2 2468103719 5 3 3692718510 4 4 4 8 2731091 6 5 5 5106298147 3 6 6 2 975 8 1104 3 7 7421361058 9 8 8657103294 1 9 9810253416 7 10 1013629574 8

Positions 2 and 6 are no-luck positions for the Josephus problem of 10 people and random choice of k. 108 The Josephus problem and its generalization

Exercise 1. Make a list of the no-luck positions of the Josephus problem for n =4, 5,...,9. 2. For n =7, there is only one no-luck position 1. This means that one other position is most likely to receive a prize? Which one is it? Chapter 3

Representation of a number in different bases

3.1 Base b-representation of a number

Let b be a fixed positive integer. To write an integer n (in decimal form) in base b, keep on dividing the number by b, and record the remainders, which are integers between 0 and b − 1, from right to left. The result- ing sequence, which always begins with a nonzero leftmost digit, is the representation of n in base b.

Examples

(1) 123 = [1111011]2

divisor quotient remainder 2 123 1 61 1 30 0 15 1 7 1 3 1 1 110 Representation of a number in different bases

(2) 123 = [11120]3

divisor quotient remainder 3 123 0 41 2 13 1 4 1 1

3.1.1 A number from its base b-representation

Given the base b representation of an integer:

n =[a0a1 ···ak−1ak]b,

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 + b · ni−1. Then, n = nk.

Examples

(1) [1111011]2 = 123.

1 1 1 1 0 1 1 2 2 6 14 30 60 122 1 3 7 15 30 61 123

(2) [23147]11 = 33447.

2 3 1 4 7 11 22 275 3036 33440 2 25 276 3040 33447 3.2 Balanced division by an odd number 111

Exercise 1. Complete the multiplication table in base 7. 1 2 3 4 5 6 1 1 2 3 4 5 6 2 2 3 3 12 4 4 5 5 6 6 15 51

2. Multiply in base 7:

[12346]7 × [06]7 =

[12346]7 × [15]7 =

[12346]7 × [24]7 =

[12346]7 × [33]7 =

[12346]7 × [42]7 =

[12346]7 × [51]7 =

3. Ask your friend to write down a polynomial f(x) with nonnegative integer coefficients. Ask her for the value of f(1). She returns 7. Ask her for the value of f(8). She returns 4305. What is the polynomial?

3.2 Balanced division by an odd number

Given a positive integer b and a string of b consecutive integers, for every integer a, there are unique integers q and r so that a = bq + r with r in the given string of b consecutive integers.

In particular, if b is odd, say b =2c +1, we may choose the string of remainders to be −c, −(c − 1), ..., −1, 0, 1, ..., c− 1,c. 112 Representation of a number in different bases

If we write a = bq + r, −c ≤ r ≤ c, we say that this is the balanced division of a by the odd number b.

3.3 Balanced base b representation of a number

Let b be a positive odd number. The balanced base b representation of an integer n is obtained by repeatedly performing balanced divisions by b and recording, from right to left, the remainders, which are integers in − b−1 ··· − b−1 the range 2 , , 1, 0, 1, ..., 2 .

We shall write

¾ ¿  ½, , , , ... in place of the negative remainders

−1, −2, −3, −4, ....

Examples

(1) 123 = 1 ½½½½0 3

divisor quotient remainder 3 123 0

41 ½

14 ½

5 ½

2 ½ 1

The balanced ternary form of a number expresses it as a sum and/or differences of distinct powers of 3:

123 = 35 − 34 − 33 − 32 − 3.

2 − · − (2) 1 ¾¿ 5 =5 +( 2) 5+( 3) = 12. 3.4 Arithmetic in balanced base 3 representations 113

3.4 Arithmetic in balanced base 3 representations × ½

+ ½ 01 01

½ ½ ½ ½ ½ 1 0 10

0 ½ 01 0 000 ½ 1 011½ 1 01

× ½ ½

Example 3.1. 1 ½½½1 3 11 1 3 = 1 000011 3.

½ ½ 1 ½ 1

× 11½ 1

½ ½

1 ½ 1 ½

½ 111

½ ½

1 ½ 1

½ ½ 1 ½ 1

1 ½ 000011 Chapter 4

A card trick

Let p and q be given odd numbers, say p =2h +1and q =2k +1. Arrange pq cards in the form of a p × q matrix. Ask a spectator to select one secret card and name the column containing the secret card. Then the cards are (i) picked up along columns in any order, except that the named one is the middle one, being preceded by k arbitrary columns and followed by the remaining k columns arbitrarily, (ii) rearranged into the p × q matrix along rows. Repeat a number of times, each time asking for the column which contains the secret card. The secret card will eventually appear exactly in the middle of the matrix. If p ≤ q, you can tell what the secret is after the first step. It is in the middle row. We shall henceforth assume p>qso that there are more rows than columns.

Example 4.1. In the arrangement below, the spectator chooses ♦2 and tells you that it is in the second column.

♣5 ♠6 ♦8 ♣J ♠Q ♠K ♥9 ♠A ♦6 ♦9 ♣6 ♥10 ♠10 ♦2 ♣9

Then you pick up, in order, the first, the second, and then the third columns, and deal the cards in rows: 202 A card trick

♣5 ♣J ♥9 ♦9 ♠10 ♠6 ♠Q ♠A ♥6 ♦2 ♦8 ♠K ♦6 ♥10 ♠9

Now ask the spectator which column contains the secret card. She will answer the first column. Then you pick up, in order, the third, the first, and the second column, and deal the cards in rows: ♥9 ♠6 ♥6 ♠K ♠9 ♣5 ♦9 ♠Q ♦2 ♦6 ♣J ♠10 ♠A ♦8 ♥10

Now, the spectator will tell you that the secret card is in the third column. You immediately know that the card is ♦2. How many times do you need to rearrange the cards before you can tell what the secret card is? This is what G. R. Sanchis [?]1 shows. We analyze this in a somewhat different notation. Label the rows −h, −(h − 1),...,0,...,h − 1, h so that the middle row is row 0. An application of (i) and (ii) will bring the i-th card in the column containing the secret card into row g(i), where g(i) is the quotient in the balanced division of i by q. Equivalently, g(i)=b if i = bq + r for − k ≤ i ≤ k.

It is easy to see that g is an odd function: under the same condition, −i = −bq − r, with −k ≤−r ≤ k, so that g(−i)=−b.Now,g(i) is decreasing for positive i, and increasing for i<0. Furthermore, if g(i)=0, then all subsequent iterates by g are stationary at 0. Therefore, if we write p =2+1, then the number of times to guarantee the secret card in the middle row is min{ : g(h)=0}.

The function g on positive integers can be easily described in terms of the base q representations of numbers.

1G. R. Sanchis, A card trick and the mathematics behind it, College Math. Journal, 37 (2006) 103–109. 203

Lemma 4.1. If n = amam−1 ...a1a0 q in balanced base q representa- tion, then g(n)= amam−1 ···a1 q. Proposition 4.2. The number of times for the secret card to move to the middle row is not more than the length of the balanced base q- p−1 representation of the integer 2 .

Examples

(1) 51 cards in 3 columns: p =17, q =3. Since 8= 10½ 3, three operations suffice.

(2) 35 cards in 5 columns: p =7, q =5. Since 3= 1 ¾ 5,two operations suffice.

Exercise Find the number of operations required to move the secret card to the middle row for 1. 45 cards in 5 columns; 2. 39 cards in three columns. 204 A card trick Chapter 5

Cheney’s card trick

You are the magician’s assistant. What he will do is to ask a spectator to give you any 5 cards from a deck of 52. You show him 4 of the cards, and in no time, he will tell everybody what the 5th card is. This of course depends on you, and you have to do things properly by making use of the following three basic principles.

5.1 Three basic principles

5.1.1 The pigeonhole principle

Among 5 cards at least 2 must be of the same suit. So you and the magician agree that the secret card has the same suit as the first card.

5.1.2 Arithmetic modulo 13

The distance of two points on a 13-hour clock is no more than 6. We decide which of the two cards to be shown as the first, and which to be kept secret. For calculations, we treat A, J, Q, and K are respec- tively 1, 11, 12, and 13 respectively. Now you can determine the distance between these two cards. From one of these, going clockwise, you get to the other by traveling this dis- tance on the 13-hour clock. Keep the latter as the secret card. 206 Cheney’s card trick

hours distance clockwise 2 and 7 5 2 to 7 3 and 10 6 10 to 3 2 and J 4 J to 2 A and 8 6 8 to A The following diagram shows that the distance between ♣3 and ♥10 is 6, not 7. ♣Q ♠K ♦A ♥J 6 ♣2 ♥10 ♣3 ♦9 ♦4 ♣8 ♥5 ♦7 ♣6

5.1.3 Permutations of three objects There are 6 arrangements of three objects The remaining three cards can be ordered as small, medium, and large. 1 Now rearrange them properly to tell the magician what number he should add (clockwise) to the first card to get the number on the secret card. Let’s agree on this:

arrangement distance sml 1 slm 2 msl 3 mls 4 lsm 5 lms 6

If you, the assistant, want to tell the magician that he should add 4 to the number (clockwise) on the first card, deal the medium as the second card, the large as the third, and the small as the fourth card.

1First by numerical order; for cards with the same number, order by suits: ♣ < ♦ < ♥ < ♠. 5.1 Three basic principles 207

Example 5.1. Suppose you have ♠5, ♣7, ♦J, ♣4, and ♠Q, and you decide to use the ♣ cards for the first and the secret ones. The distance between ♣7 and ♣4 is of course 3, clockwise from ♣4 to ♣7.You therefore show ♣4 as the first card, and arrange the other three cards, ♠5, ♦J, and ♠Q, in the order medium, small, large. The second card is ♦J, the third ♠5, and the fourth ♠Q. The secret card is ♣7.

4 ♣ J ♦ 5 ♠ Q ♠ ? ?

Example 5.2. Now to the magician. Suppose your assistant show you these four cards in order:

Q ♠ J ♦ 7 ♣ 4 ♣ ? ?

Then you know that the secret card is a ♠, and you get the number by adding to Q the number determined by the order large, medium, small, which is 6. Going clockwise, this is 5. The secret card is ♠5.

Exercise 1. For the assistant: (a) ♠5, ♠7, ♦6, ♣5, ♣Q. (b) ♥2, ♠J, ♥K, ♣2, ♠8. 208 Cheney’s card trick

2. For the magician: what is the secret card?

5 2 ♠ 7 ♥ J ♠ 6 ♠ 2 ♦ 5 ♣ 8 ♣ ? ♠ ? ? ? Chapter 6

Coin weighing

6.1 Coin weighing with 3 standard weights

Given three weights of 1, 3, and 9 units, it is possible to weigh up to 13 units in a beam balance.

Left Right Left Right 1 1 2, 13 3 3 4 1, 3 5, 1, 39 6, 39 7, 31, 9 8, 19 9 9 10 1, 9 11, 13, 9 12 3, 9 13 1, 3, 9

6.2 A twelve coin problem

Given twelve coins, one of which is defective, how can the defective coin be found out in three weighings in a beam balance, and be decided as overweight or underweight? 1

1H. D. Grossman, Ternary epitaph on coin problems, Scripta Math., 14 (1948) 69–71. 210 Coin weighing

+1 −1 +3 −3 +9 −9 122365 545487 10 7 7610 9 11 8 12 11 12 11

Tell your temptor that if you touch the coins you will certainly know. You, the magician, do not even have to look at them to find out the false one. Tell him to label the coins arbitrarily 1, 2,...,12, and follow your instructions. Start with a number W =0. (1) Put coins 1, 5, 10, 11 on the left pan and coins 2, 4, 7, 8 on the right pan, and tell which side is heavier. If the left pan is heavier, add 1 to W . If the right pan is heavier, add −1 to W . If they balance, keep the same W . (2) Put coins 2, 5, 7, 12 on the left pan and coins 3, 4, 6, 11 on the right pan, and tell which side is heavier. If the left pan is heavier, add 3 to W . If the right pan is heavier, add −3 to W . If they balance, keep the same W . (3) Put coins 6, 8, 10, 12 on the left pan and coins 5, 7, 9, 11 on the right pan, and tell which side is heavier. If the left pan is heavier, add 9 to W . If the right pan is heavier, add −9 to W . If they balance, keep the same W .

Now, the numerical value of W is the label of the false coin.

W positive negative even overweight underweight odd underweight overweight Chapter 7

Greatest common divisor

7.1 gcd(a, b) from the Euclidean algorithm

It is well known that the gcd of two (positive) integers a and b can be calculated efficiently by repeated divisions. Assume a>b. We form two sequences rk and qk as follows. Beginning with r−1 = a and r0 = b, for k ≥ 0, let rk−1 qk = ,rk+1 =mod(rk−1,rk):=rk−1 − qkrk. rk

These divisions eventually terminate when some rn divides rn−1. In that case, gcd(a, b)=rn.

Examples

(1) The repunit Rn is the numbers whose decimal representation con- sists of n ones: Rn =1n.

gcd(Rm,Rn)=Rgcd(m,n). This is easily explained by two parallel sequences of divisions:

m = qn + r, Rm = Q · Rn + Rr,   n = q r + s, Rn = Q · Rr + Rs, . . . .

(2) gcd(2m − 1, 2n − 1) = 2gcd(m,n) − 1. 302 Greatest common divisor

Proof. The binary expansion of 2m − 1 consists of m ones. Thus, m n gcd(m,n) gcd(2 − 1, 2 − 1) = gcd([1m]2, [1n]2)=[1gcd(m,n)]2 =2 − 1.

7.1.1 gcd(a, b) as an integer combination of a and b

If, along with these divisions, we introduce two more sequences (xk) and (yk) with the same rule but specific initial values, namely,

xk+1 =xk−1 − qkxk,x−1 =1,x0 =0;

yk+1 =yk−1 − qkyk,y−1 =0,y0 =1. then we obtain gcd(a, b) as an integer combination of a and b: 1

gcd(a, b)=rn = axn + byn.

k rk qk xk yk −1 a ∗∗∗ 1 0  a  0 b b 0 1 1 a −a b  b  x y b r1 1 1 . . n − 1 rn−1 qn−1 xn−1 yn−1 n rn qn xn yn n +1 0

It can be proved that |xn| b, there are unique integers h, k

7.2 gcd(a, b) by counting interior points of a lattice tri- angle

A lattice triangle has vertices at (0, 0), (a, 0), and (a, b).

1In each of these steps, rk = axk + byk. 7.2 gcd(a, b) by counting interior points of a lattice triangle 303

a

b

a

Counting in two ways, we obtain as

a−1 b−1 nb ma = . a b n=1 m=1 Note that each of these is the total number of interior points and those on the hypotenuse (except the two vertices). There are gcd(a, b) − 1 points in the latter group. If we put these two copies together to form a rectangle, we see that the interior points along the diagonal are counted twice. Since the rectangle has (a − 1)(b − 1) interior points, we have exactly (a − 1)(b − 1) − gcd(a, b)+1 2 lattice points in the interior of the triangle.

b

a 1 − − In particular, if gcd(a, b)=1, then the triangle has 2 (a 1)(b 1) interior points.

7.2.1 Calculation of gcd Note that we have an algorithm for computing the gcd of two integers:

b−1 ma gcd(a, b)=2 − (a − 1)(b − 1) + 1. b m=1 304 Greatest common divisor

7.3 Fibonacci numbers

The Fibonacci numbers Fn are defined recursively by

Fn+1 = Fn + Fn−1,F0 =0,F1 =1.

The first few Fibonacci numbers are n 0123456 7 8 9 101112 ... Fn 01123581321345589144...

It is easy to see that consecutive Fibonacci numbers are relatively prime.

gcd(Fn+1,Fn)=gcd(Fn,Fn−1)

=gcd(Fn−1,Fn−2) . .

=gcd(F2,F1)=1.

If we follow the Euclidean algorithm to compute gcd(Fn+1,Fn),we obtain the Cassini formula

− 2 − n Fn+1Fn−1 Fn =( 1) .

k rk qk xk yk

−1 Fn+1 ∗∗∗ 1 0 0 Fn 1 0 1 1 Fn−1 1 F1 −F2 2 Fn−2 1 −F2 F3 3 Fn−3 1 F3 −F4 . . n−2 n−1 n − 3 F3 1 (−1) Fn−3 (−1) Fn−2 n−1 n n − 2 F2 1 (−1) Fn−2 (−1) Fn−1 n n+1 n − 1 F1 1 (−1) Fn−1 (−1) Fn n 0 ∗∗∗ 7.3 Fibonacci numbers 305

Exercise Find the gcd of the following pairs of numbers by completing the sec- ond column of each table. In each case, express the gcd as an integer combination of the given numbers by completing the last two columns. 1.

rk qk xk yk 54321 ∗∗∗ 1 0 12345 0 1

2.

rk qk xk yk 267914296 ∗∗∗ 1 0 196418 0 1 306 Greatest common divisor Chapter 8

Lattice polygons

8.1 Pick’s Theorem: area of lattice polygon

A lattice point is a point with integer coordinates. A lattice polygon is one whose vertices are lattice points (and whose sides are straight line segments). For a lattice polygon, let I = the number of interior points, and B = the number of boundary points.

B − Theorem 8.1 (Pick). The area of a lattice polygon is I + 2 1.

If the polygon is a triangle, there is a simple formula to find its area in terms of the coordinates of its vertices. If the vertices are at the points 308 Lattice polygons

1 (x1,y1), (x2,y2), (x3,y3), then the area is x1 y1 1 1 x2 y2 1 . 2 x3 y3 1

In particular, if one of the vertices is at the origin (0, 0), and the other 1 | − | two have coordinates (x1,y1), (x2,y2), then the area is 2 x1y2 x2y1 . Given a lattice polygon, we can partition it into primitive lattice tri- angles, i.e., each triangle contains no lattice point apart from its three vertices. Two wonderful things happen that make it easy to find the area of the polygon as given by Pick’s theorem. (1) There are exactly 2I + B − 2 such primitive lattice triangles no matter how the lattice points are joined. This is an application of Euler’s polyhedral formula. 1 (2) The area of a primitive lattice triangle is always 2 . This follows from a study of the Farey sequences.

8.2 Counting primitive triangles

We shall make use of the famous Euler polyhedron formula.

Theorem 8.2. If a closed polyhedron has V vertices, E edges and F faces, then V − E + F =2.

8.2.1 The number of primitive triangles in a lattice polygon

Given a lattice polygon with a partition into primitive lattice triangles, we take two identical copies and glue them along their common bound- ary. Imagine the 2-sheet polygon blown into a closed polyhedron. The number of vertices is V =2I + B. Suppose there are T primitive tri- angles in each sheet. Then there are F =2T faces of the polyhedron. Since every face is a triangle, and each edge is contained in exactly two faces, we have 2E =3F . It follows that E =3T . Now, Euler’s poly- hedron formula gives (2I + B) − 3T +2T =2. From this, we have T =2I + B − 2.

1This formula is valid for arbitrary vertices. It is positive if the vertices are traversed counterclockwise, otherwise negative. If it is zero, then the points are collinear. 8.2 Counting primitive triangles 309

Exercise 1. Consider the lattice triangle ABC with A =(0, 0), B =(36, 15) and C =(16, 30). Calculate the lengths of the sides of the triangle. What is the area of the triangle? How many boundary and interior points does it have? 2. Repeat the same for the lattice triangle ABC with A =(0, 0), B = (24, 45) and C =(48, 55). 3. Give an example of a lattice triangle whose side lengths are 13, 14, 15. What is the area? How many interior and boundary points does the triangle have? 4. For B =3, 4, 6, 8, 9, give an example of a lattice triangle with exactly one interior point and B boundary points. 2 5. Give an example of an equilateral lattice hexagon.

2In [Weaver], it is shown that these are the only possible values of B if I =1. 310 Lattice polygons Chapter 9

The Farey sequences

9.1 The Farey sequence

Let n be a positive integer. The Farey sequence of order n is the sequence of rational numbers in [0, 1] of denominators ≤ n arranged in increasing 0 1 order. We write 0= 1 and 1= 1 .

F 0 1 1 : 1 , 1 .

F 0 1 1 2 : 1 , 2 , 1 .

F 0 1 1 2 1 3 : 1 , 3 , 2 , 3 , 1 .

F 0 1 1 1 2 3 1 4 : 1 , 4 , 3 , 2 , 3 , 4 , 1 .

F 0 1 1 1 2 1 3 2 3 4 1 5 : 1 , 5 , 4 , 3 , 5 , 2 , 5 , 3 , 4 , 5 , 1 .

F 0 1 1 1 1 2 1 3 2 3 4 5 1 6 : 1 , 6 , 5 , 4 , 3 , 5 , 2 , 5 , 3 , 4 , 5 , 6 , 1 . F 0 1 1 1 1 2 1 2 3 1 4 3 2 5 3 4 5 6 1 7 : 1 , 7 , 6 , 5 , 4 , 7 , 3 , 5 , 7 , 2 , 7 , 5 , 3 , 7 , 4 , 5 , 6 , 7 , 1 .

h h F Theorem 9.1. 1. If k and k are successive terms of n, then kh − hk =1 and k + k >n. h h h F 2. If k , k , and k are three successive terms of n, then h h + h = . k k + k 312 The Farey sequences

The rational numbers in [0, 1] can be represented by lattice points in the first quadrant (below the line y = x). Restricting to the left side of the vertical line x = n, we can record the successive terms of the Farey sequence Fn by rotating a ruler about 0 counterclockwise from the positive x-axis. The sequence of “visible” lattice points swept through corresponds to Fn.IfP and Q are two lattice points such that triangle OPQ contains no other lattice points in its interior or boundary, then the rational numbers corresponding to P and Q are successive terms in a Farey sequence (of order ≤ their denominators).

9.2 Primitive lattice triangles

A lattice triangle is one whose vertices are lattice points, i.e., points with integer coordinates. It is primitive if there are no lattice point inside or on the triangle except these vertices.

1 Theorem 9.2. A primitive lattice triangle has area 2 . Chapter 10 √ Irrationality of n

√ 10.1 Irrationality of 2 √ a Suppose 2 is a rational number. We write it in lowest terms as b . Here, a and b are positive integers without common divisor. Then

a2 =2b2.

10.1.1 Reasoning with units digits

Examine the units digits of the numbers a2 and 2b2. Now, the units digit of a square is one of 0, 1, 4, 5, 6,or9. The units digit of 2b2 must be one of 0, 2, 8. Therefore, if a2 =2b2, its units digit must be 0. This means that (i) the units digit of a must be 0, and a is divisible by 10, and (ii) the units digit of 2b2 being 0, that of b must be 0 or 5. This means that b must be divisible by 5. This is a contradiction since a and b are both divisible by 5.

10.1.2 Reasoning with even and odd

If a2 =2b2, then a2 is even, and a must be even. If we write a =2c, then 2b2 = a2 =4c2 and b2 =2c2. The same reasoning shows that b is also even, a contradiction. √ 402 Irrationality of n

10.1.3 Reasoning in a base 3 a2 =2b2 cannot have a nonzero solution in integers because the last nonzero digit of a square, written in base 3, must be 1, whereas the last nonzero digit of twice a square is 2.

10.1.4 Geometric proof √ If 2 were rational, there are smallest positive integers a and b so that a square of side a has the same area as two squares of side b. The diagram below shows two squares of side b inside a square of side a. The overlap of the yellow square has the same area as the two white squares in the corner. This then is a smaller square of integer side 2b − a which has the same area as two squares of side a − b. This contradicts the minimality of a and b.

√ 10.2 Irrationality of n

10.2.1 N. J. Fine’s proof √ Suppose n = x , with x, y positive integers, x smallest possible. Since √ y − x n is not an integer, there is an integer k such that k 1 < y

10.2.2 P. Ungar’s proof Lemma 10.1. A real number α is irrational if there are arbitrarly small positive numbers of the form m + nα for integers m and n. a c Proof. If α = b for b>0, then m + nα = b for some integer c. Its distance from 0 is at least 1 . b √ Proposition 10.2. If d is not the square of an integer, then d is irra- tional. √ Proof. The positive number α = d − d is strictly smaller√ than 1.For arbitrary ε>0, there is an integer k such√ that αk =(d − d)k <ε. Now, αn is a√ number of the form m + n d for integers m and n.It follows that d is irrational.

10.3 Nonexistence of regular lattice polygon

Proposition 10.3. There is no equilateral lattice triangle. Proof. If a lattice triangle is equilateral, with side length√ a, then a2 is 1 2 π a2 · an integer, and its area is given by 2 a sin 3 = 4 3, an irrational number. This is a contradiction since the area of a lattice triangle must be rational. Indeed, the same proof can be extended to show that there is no regu- lar lattice polygon of n ≥ 5 sides, by making use of the famous but deep π result that the only values of n for which sin n is rational is n =6.We present here a simple proof without invoking this nontrivial result on the 2π rationality of sin n , given by David Radcliffe of Purdue University. Theorem 10.4. There is no regular lattice n-gon for n =4 . We shall assume n>3. Suppose there is a regular lattice polygon P with vertices A1, A2,...,An and center O. Reflect each vertex about the diagonal joining its two neighbours. Thus,  − Ai = Ai−1 + Ai+1 Ai,

for i =1, 2,...,n. Here, the indices are taken modulo n, so that An+1 = A1. See Figure 1. Note that for each i =1, 2,...,n, √ 404 Irrationality of n

 (i) Ai is a lattice point on the line OAi; (ii) it coincides with one of the vertices of P (other than Ai−1, Ai, Ai+1) if and only if n =4; (iii) it coincides with O if and only if n =6. See Figure 2.

Ai Ai

Ai+1 Ai−1 Ai+1 Ai−1

A i O

O

(e) Figure 1 (f) Figure 2

 P Therefore, for n>4, each Ai is a point in the interior of , and   ···  OA1 = OA2 = = OAn.   ···  It follows that A1A2 An is a smaller regular lattice polygon of n sides. For n =6 , this has nonzero area which is an integer or a half- integer. This is a contradiction by infinite descent. Chapter 11

Continued fractions

11.1 Simple continued fractions

A simple continued fraction is one of the form

1 1 a + or a + . 1 1 1 1 a + a + 2 1 2 1 a3 + a3 + . 1 1 .. + a + 4 . an ..

For typographical convenience, we shall write these continued frac- tions as

[a1,a2,...,an]or[a1,a2,a3,a4,...].

11.2 Finite simple continued fractions

Finite continued fractions are rational numbers. Every rational num- p ber q can be uniquely represented as a finite simple continued fraction [a1,a2,...,an] with a2, ..., an positive, and an > 1. These are the 406 Continued fractions

quotients in the sequence of divisions beginning with p1 = p, p2 = q,

p1 = a1 × p2 + p3, 0

11.3 Convergents

The convergents of an infinite (simple) continued fraction [a0,a1,a2,...] are the finite continued fractions

cn =[a0,...,an]

Pn for n =0, 1, 2,.... Each of these is a rational number cn = Qn . These numerators and denominators can be computed recursively as follows.

Pn =Pn−1 + anPn−1,P−1 =0,P0 =1;

Qn =Qn−2 + anQn−1,Q−1 =1,Q0 =0.

a1 a2 ··· an ··· 01P1 P2 ··· Pn ··· 10Q1 Q2 ··· Qn ···

Examples [1, 1, 1 ...] Pn (1) The simplest continued fraction has convergents Qn given by

Pn =Pn−1 + Pn−1,P−1 =0,P0 =1;

Qn =Qn−2 + Qn−1,Q−1 =1,Q0 =0. √ 11.4 Continued fraction expansion of d 407

It is clear that Qn = Fn, and Pn = Fn+1 from the Fibonacci sequence (Fn). Thus, ··· Fn+1 [1, 1, 1, ] = lim/ = ϕ, n ∞ Fn the golden ratio. Pn (2) The continued fraction [1, 2, 3, 4,...,n,...] has convergents Qn given by

Pn n n nP Q Qn 11 1 1 23 2 1.51 310 7 1.428571428571428571 ··· 443 30 1.433333333333333333 ··· 5 225 157 1.433121019108280254 ··· 6 1393 972 1.433127572016460905 ··· 7 9976 6961 1.433127424220657951 ··· 8 81201 56660 1.433127426756088951 ··· 9 740785 516901 1.433127426721944821 ··· 10 7489051 5225670 1.433127426722315033 ··· 11 83120346 57999271 1.433127426722311733 ··· 12 1004933203 701216922 1.433127426722311758 ··· 13 13147251985 9173819257 1.433127426722311758 ··· 14 185066460993 129134686520 1.433127426722311758 ··· . .

√ 11.4 Continued fraction expansion of d

Let d be a positive, non-square integer, and √ d =[a0, a1,a2,...,al−2,al−1,al].

√ • a0 =  d and al =2a0.

• The sequence a1, a2, ..., al−2, al−1 is palindromic, i.e., ak = al−k for each k =1,2,...,l − 1. 408 Continued fractions √ Continued fraction expansion of d for small d

√ √ √2∗ =[1, 2]; √3=[1, 1, 2]; √5∗ =[2, 4]; √6=[2, 2, 4]; √7=[2, 1, 1, 1, 4]; √8=[2, 1, 4]; √10∗ =[3, 6]; √11 = [3, 3, 6]; √12 = [3, 2, 6]; √13∗ =[3, 1, 1, 1, 1, 6]; √14 = [3, 1, 2, 1, 6]; √15 = [3, 1, 6]; √17∗ =[4, 8]; √18 = [4, 4, 8]; √19 = [4, 2, 1, 3, 1, 2, 8]; √20 = [4, 2, 8]; 21 = [4, 1, 1, 2, 1, 1, 8]; 22 = [4, 1, 2, 4, 2, 1, 8]. Those with ∗ have odd period lengths. Chapter 12

The integer equations x2 − dy2 = ±1

12.1 Integer solutions of x2 − dy2 =1

Let d be a positive, non-square integer, and √ d =[a0, a1,a2,...,al−2,al−1,al].

All positive solutions of the Pell equation

x2 − dy2 =1

1 form a sequence (xk,yk) which can be obtained recursively by x adb x x a k+1 = k , 1 = , yk+1 ba yk y1 b where

⎧ √ ⎪ ⎨(Pl−1,Ql−1), if d has even period length, (a, b)= ⎩⎪ √ (P2l−1,Q2l−1), if d has odd period length, is the fundamental solution.

1These are also given by (xk,yk)=(Pkl−1,Qkl−1). 410 The integer equations x2 − dy2 = ±1

Fundamental solution (a, b) of x2 − dy2 =1for small d

da b dab dab 2 3 2 321 5 9 4 6 5 2 783 8 3 1 10 19 6 11 10 3 12 7 2 13 649 180 14 15 4 15 4 1 17 33 8 18 17 4 19 170 39 20 9 2 21 55 12 22 197 42

12.2 Integer solutions of x2 − dy2 = −1 √ The equation x2 − dy2 = −1 has integer solutions if and only if d has odd period length. The solutions are given recursively x adb x x P − k+1 = k , 1 = l 1 . yk+1 ba yk y1 Ql−1

Smallest positive solution (a, b) of x2 − dy2 = −1

dab dab dab 2 1 1 521 1031 13 18 5 17 4 1 26 5 1 29 70 13 37 6 1 41 32 5 12.3 The equation x2 − 2y2 =1 411

12.3 The equation x2 − 2y2 =1

The fundamental solution of the Pell equation x2−2y2 =1is (3, 2). This generates an infinite sequence of nonnegative solutions (xn,yn) defined by

xn+1 =3xn +4yn,yn+1 =2xn +3yn; x0 =1,y0 =0. The beginning terms are

n 12 3 4 5 6 7 8 9 10... xn 3 17 99 577 3363 19601 114243 665857 3880899 22619537 ... yn 2 12 70 408 2378 13860 80782 470832 2744210 15994428 ...

12.4 Applications

12.4.1 Triangular numbers which are squares − 1 Suppose the k th triangular number Tk = 2 k(k +1)is the square of n. 2 1 2 2 2 − 2 n = 2 k(k +1); 4k +4k +1=8n +1; (2k +1) 8n =1. The smallest positive solution of the Pell equation x2 − 8y2 =1being (3, 1), we have the solutions (ki,ni) of the equation given by

2ki+1 +1 = 3(2ki +1)+8ni, ni+1 =(2ki +1)+3ni,k0 =1,n0 =1. This means

ki+1 =3ki +4ni +1, ni+1 =2ki +3ni +1,k0 =1,n0 =1. The beginning values of k and n are as follows.

i 012345678910... ki 1 8 49 288 1681 9800 57121 332928 1940449 11309768 65918161 ... ni 1 6 35 204 1189 6930 40391 235416 1372105 7997214 46611179 ...

12.4.2 Pythagorean triangles with consecutive legs Let x and x +1be the two shorter sides of a Pythagorean triangle, with hypotenuse y. Then y2 = x2 +(x +1)2 =2x2 +2x +1. From this, 2y2 =(2x +1)2 +1. The equation With z =2x +1, this reduces to 412 The integer equations x2 − dy2 = ±1 the Pell equation z2 − 2y2 = −1, which we know has solutions, with the of this equations are (zn,yn) given recursively by smallest positive one (1, 1), and the equation z2 − 2y2 =1has smallest positive solution (3, 2). It follows that the solutions are given recursively by

zn+1 =3zn +4yn, yn+1 =2zn +3yn,z0 =1,y0 =1.

If we write zn =2xn +1, these become

xn+1 =3xn +2yn +1, yn+1 =4xn +3yn +2,x0 =0,y0 =1.

The beginning values of xn and yn are as follows.

n 12 3 4 5 6 7 8 9 10 ... xn 3 20 119 696 4059 23660 137903 803760 4684659 27304196 ... yn 5 29 169 985 5741 33461 195025 1136689 6625109 38613965 ...

12.4.3 Find all integers n so that the mean and the standard deviation of n con- secutive integers are both integers. If the mean of n consecutive integers is an integer, n must be odd. We may therefore assume the numbers to be −m ,−(m − 1), ...,−1,0,1, − 1 ...,m 1, m. The standard deviation of these number is 3 m(m +1). 1 2 For this to be an integer, we must have 3 m(m+1) = k for some integer k. m2 = m =3k2; n2 =(2m +1)2 =12k2 +1. The smallest positive solution of the Pell equation n2 − 12k2 =1being (7,2), the solutions of this equations are given by (ni,ki), where

ni+1 =7ni +24ki, ki+1 =2ni +7ki,n0 =1,k0 =0. The beginning values of n and k are i 12 3 4 5 6 7 8 ... ni 7 97 1351 18817 262087 3650401 50843527 708158977 ... ki 2 28 390 5432 75658 1053780 14677262 204427888 ... Chapter 13

Pythagorean triangles

13.1 Primitive Pythagorean triples

A Pythagorean triangle is one whose sidelengths are integers. An easy way to construct Pythagorean triangles is to take two distinct positive integers m>nand form

(a, b, c)=(2mn, m2 − n2,m2 + n2).

Then, a2 + b2 = c2. We call such a triple (a, b, c) a Pythagorean triple. The Pythagorean triangle has perimeter p =2m(m + n) and area A = mn(m2 − n2).

B

2 n + 2 2mn m

A m2 − n2 C

A Pythagorean triple (a, b, c) is primitive if a, b, c do not have a common divisor (greater than 1). Every primitive Pythagorean triple is constructed by choosing m, n to be relatively prime and of opposite parity. Here are the smallest primitive Pythagorean triangles. 502 Pythagorean triangles

m, n a, b, c m, n a, b, c m, n a, b, c 2, 1 4, 3, 5 3, 2 12, 5, 13 4, 1 8, 15, 17 4, 3 24, 7, 25 5, 2 20, 21, 29 5, 4 40, 9, 41

13.1.1 Rational angles The (acute) angles of a primitive Pythagorean triangle are called rational angles, since their trigonometric ratios are all rational.

sin cos tan 2mn m2−n2 2mn A m2+n2 m2+n2 m2−n2 m2−n2 2mn m2−n2 B m2+n2 m2+n2 2mn

A B More basic than these is the fact that tan 2 and tan 2 are rational: A n B m − n tan = , tan = . 2 m 2 m + n

This is easily seen from the following diagram showning the incircle of the right triangle, which has r =(m − n)n.

B

n ) n + m ( (m + n)n

) n I r − m ( m r (m − n)n

A m(m − n) (m − n)n C 13.2 Pythagorean triangles with given sides 503

13.1.2 Some basic properties of primitive Pythagorean triples

1. Exactly one leg is even.

2. Exactly one leg is divisible by 3.

3. Exactly one side is divisible by 5.

4. The area is divisible by 6.

Theorem 13.1 (Fermat). The area of a Pythagorean triangle cannot be a square (number).

13.2 Pythagorean triangles with given sides

Proposition 13.2. Every integer ≥ 3 is the length of a side of a Pythagorean triangle.

Theorem 13.3. A positive integer n is the length of the hypotenuse of a Pythagorean triangle if and only if it contains a prime divisor of the form 4k +1.

Proof. (1) Every prime number of the form 4k+1 is a sum of two squares in a unique way. In particular, a prime number of the form 4k +1is the hypotenuse of a unique Pythagorean triangle. (2) If a number is a sum of two squares, it contains a prime divisor of the form 4k +1.

13.3 Enumeration of primitive Pythagorean triangles

Given a positive integer r which contains k distinct odd prime divisors, there are exactly 2k primitive Pythagorean triangles with inradius r. This follows from r =(m − n)n, in which m − n and n are relatively prime, and m − n must be odd. There are precisely 2k choices of m − n, each determining the pair (n, m) and hence the primitive Pythagorean triangle. Here is an enumeration of the primitive Pythagorean triangles with r ≤ 15: 504 Pythagorean triangles

r (n, m)(a, b, c) r (n, m)(a, b, c) 1(1, 2) (4, 3, 5) 2(2, 3) (12, 5, 13) 3(1, 4) (8, 15, 17) 3(3, 4) (24, 7, 25) 4(4, 5) (40, 9, 41) 5(1, 6) (12, 35, 37) 5(5, 6) (60, 11, 61) 6(2, 5) (20, 21, 29) 6(6, 7) (84, 13, 85) 7(1, 8) (16, 63, 65) 7(7, 8) (112, 15, 113) 8(8, 9) (144, 17, 145) 9(1, 10) (20, 99, 101) 9(9, 10) (180, 19, 181) 10 (2, 7) (28, 45, 53) 10 (10, 11) (220, 21, 221) 11 (1, 12) (24, 143, 145) 11 (11, 12) (264, 23, 265) 12 (4, 7) (56, 33, 65) 12 (12, 13) (312, 25, 313) 13 (1, 14) (28, 195, 197) 13 (13, 14) (364, 27, 365) 14 (2, 9) (36, 77, 85) 14 (14, 15) (420, 29, 421) 15 (1, 16) (32, 255, 257) 15 (3, 8) (48, 55, 73) 15 (5, 8) (80, 39, 89) 15 (15, 16) (480, 31, 481)

13.4 A Pythagorean triangle with an inscribed square

How many matches of equal lengths are required to make up the follow- ing configuration?

Suppose the shape of the right triangle is given by a primitive Pythagorean triple (a, b, c). The length of a side of the square must be a common mul- tiple of a and b. The least possible value is the product ab. There is one such configuration consisting of (i) two Pythagorean triangles obtained by magnifying (a, b, c) a and b times, (ii) a square of side ab. The total number of matches is (a + b)(a + b + c)+2ab =(a + b + c)c +4ab. 13.5 When are x2 − px ± q both factorable? 505

The smallest one is realized by taking (a, b, c)=(3, 4, 5). It requires 108 matches. How many matches are required in the next smallest configuration?

13.5 When are x2 − px ± q both factorable?

For integers p and q, the quadratic polynomials x2−px+q and x2−px−q both factorable (over integers) if and only if p2 − 4q and p2 +4q are both squares. Thus, p and q are respectively the hypotenuse and area of a Pythagorean triangle.

b a

p p b b − a

b − a q

a

q

a b c = p q x2 − px + q x2 + px − q 3 4 5 6 (x − 2)(x − 3) (x − 1)(x +6) 5 12 13 30 (x − 3)(x − 10) (x − 2)(x + 15) 8 15 17 60 (x − 5)(x − 12) (x − 3)(x + 20)

The roots of x2−px+q are s−a and s−b, while those of x2+px−q are s − c and −s. Here, s is the semiperimeter of the Pythagorean triangle. 506 Pythagorean triangles

13.6 Dissection of a square into Pythagorean triangles

Here is the smallest square which can be dissected into three Pythagorean triangles and one with integer sides and integer area.

255 105

136 289

375 360 424 224

360 Chapter 14

3-4-5 triangles in the square 508 3-4-5 triangles in the square Chapter 15

Dissections

15.1 The tangram

It is known that exactly 13 convex polygons can be formed from the tangram. 1 Show them. 2

Challenging problem Show how to dissect a 3-4-5 triangle into 4 pieces that may be rearranged into a square. 3

1F. T. Wang and C. C. Hsiung, A theorem on the tangram, American Math. Monthly, 49 (1942) 596–599. 2There are 1 triangle, 6 quadrilaterals, 2 pentagons, and 4 hexagons. 3S. Rabinowitz, Problem 1299, Journal Recreational Math., 16 (1983–1984) 139. 510 Dissections

15.2 Dissection of the square

15.2.1 Dissection of the square into 8 parts in arithmetic progres- sion Since 1+2+3+4+5+6+7+8=62, it is reasonable to look for a dissection of a 6 × 6 square into eight pieces with areas 1, 2, ..., 8 square units.

1. 5 cuts by. 4

2. 4 straight cuts. How should we choose the point A precisely?

B

A

3. 5 straight cuts. How should we choose the point B precisely?

15.2.2 Dissection of a square into 7 rectangles Dissect a square into seven rectangles of different shapes but all having the same area. 5 4Problem 2565, Journal of Recreational Math., 30 (2002) 310. 5Problem 2567, Journal of Recreational Math., . A dissection into seven rectangles was given by Hess and Ibstedt. Markus G¨otz showed that no solution with n rectangles exists for 2 ≤ n ≤ 6. 15.2 Dissection of the square 511

R4

R5

R7

R2 R3

R6

R1

Suppose each side of the square has length 7, and the rectangles have dimensions ai ×bi for i =1, 2,...,7. Setting a1 = r, we compute easily in succession, b1, b2, a2, a3, b3, b4, a4, a5, b5, using aibi =7.Now,

a6 =7 − a2 − a3,

b6 =7 − b1 − b5,

a7 =7 − a2 − a3 − a5,

b7 =7 − b1 − b4 − b6.

rectangle ai bi R 7 1 r r R r 7(r−1) 2 r−1 r R − 7 3 7 r 7−r R 7−r 7(6−r) 4 6−r 7−r R 5(7r−7−r2) 7(6−r)(r−1)3 5 (6−r)(r−1) 5(7r−7−r2 R r(r−2) 7(r−1)(29r−35−4r2 ) 6 r−1 5r(7r−7−r2) R (7−r)(6−r)(28−27r+4r2 ) 7(6−r) 7 5−r 5(7−r)(7r−7−r2)

The relations a6b6 =7and a7b7 =7both reduce to

(2r − 7)(2r2 − 14r + 15) = 0. 512 Dissections

√ 7 7− 19 Since√ r = 2 or 2 would make a7, b7 negative, we must have r = 7+ 19 2 . The dimensions of the rectangles are as follows. rectangle a b √i √i R 7+ 19 77− 19 1 2√ 15√ R 7(8+ 19) 8− 19 2 15√ √3 R 7(7+ 19) 7− 19 3 15√ 2√ R 8+ 19 7(8− 19) 4 3 15 R 5 21 5 3√ 5√ R 5(1+ 19) 7(−1+ 19) 6 6√ 15√ R 5(−1+ 19) 7(1+ 19) 7 6 15 Chapter 16

The classical triangle centers

The following triangle centers have been known since ancient times. We shall adopt the following notations. Let ABC be a given triangle. The lengths of the sides BC, CA, AB opposite to A, B, C are denoted by a, b, c.

16.1 The centroid

The centroid G is the intersection of the three medians. It divides each median in the ratio 2:1. A

F E

G

B C D The triangle DEF is called the medial triangle of ABC. Itisthe h − 1 image of ABC under the homothety (G, 2 ). The lengths of the medians are given by Apollonius’ theorem: 1 m2 = (2b2 +2c2 − a2), a 4 etc. 602 The classical triangle centers

16.2 The circumcircle

The perpendicular bisectors of the three sides of a triangle are concurrent at the circumcenter of the triangle. This is the center of the circumcircle, the circle passing through the three vertices of the triangle.

A A

F O E O

B C B C D D

Theorem 16.1 (The law of sines). Let R denote the circumradius of a triangle ABC with sides a, b, c opposite to the angles A, B, C respec- tively. a b c = = =2R. sin A sin B sin C  1 Since the area of a triangle is given by = 2 bc sin A, the circumra- dius can be written as abc R = . 4 16.3 The incenter and the incircle 603

16.3 The incenter and the incircle

The internal angle bisectors of a triangle are concurrent at the incenter of the triangle. This is the center of the incircle, the circle tangent to the three sides of the triangle. If the incircle touches the sides BC, CA and AB respectively at X, Y , and Z, AY = AZ = s − a, BX = BZ = s − b, CX = CY = s − c.

A

s − a

s − a

Y

Z I s − c

s − b

B C s − b X s − c

Denote by r the inradius of the triangle ABC. 2  r = = . a + b + c s 604 The classical triangle centers

16.4 The orthocenter and the Euler line

The orthocenter H is the intersection of the three altitudes of triangle ABC. These altitudes can be seen as the perpendicular bisectors of the antimedial triangle XY Z of ABC, which is bounded by the three lines each passing through A, B, C parallel to their respective opposite sides.

A Y Z

O

H G

B C

X

XY Z is the image of triangle ABC under the homothety h(G, −2). It follows that H is the image of O under the same homothety. We conclude that O, G, and H are collinear, and OG : GH =1:2. The line containing O, G, H is the famous Euler line of triangle ABC. 16.5 The excenters and the excircles 605

16.5 The excenters and the excircles

The internal bisector of each angle and the external bisectors of the re- maining two angles are concurrent at an excenter of the triangle. An excircle can be constructed with this as center, tangent to the lines con- taining the three sides of the triangle.

Ib

A

Ic

X

B C

Y

Z

Ia

The exradii of a triangle with sides a, b, c are given by    r = ,r= ,r= . a s − a b s − b c s − c 606 The classical triangle centers Chapter 17

Medians and angle bisectors

17.1 Stewart’s theorem

Let A, B, C be three collinear points, and P a point outside the line containing them. With signed distances of points on the line,

PA2 · BC + PB2 · CA + PC2 · AB + BC · CA · AB =0.

P

A B C

17.2 The medians

Given a triangle with sides a, b, c, the triangle formed by the medians 3a 3b 3c ma, mb. mc has medians 4 , 4 , 4 . Theorem 17.1 (Apollonius). The lengths of the medians are given by 1 m2 = (2b2 +2c2 − a2), a 4 etc. The triangle with sides 136, 170, 174 have integer medians , , . 608 Medians and angle bisectors

A

A

m a F E G

B C D B D C

K

17.3 The angle bisectors

The length of the internal bisector of angle A is 2bc A w = cos , a b + c 2

A

wa wa

Q B P C

and that of the external bisector of angle A is 2bc A w = sin . a |b − c| 2

Example 17.1. The triangle (a, b, c) = (125, 154, 169) is a Heron tri- angle with rational angle bisectors. Its area is 9240. The lengths of the bisectors are , , and .

The famous Steiner-Lehmus theorem asserts that a triangle is isosce- les if it has two equal internal angle bisectors. However, if two external 17.4 The problem of three angle bisectors 609 bisectors have equal lengths, the triangle may not be isosceles. 1

17.4 The problem of three angle bisectors

The formula for the angle bisector wa can be rewritten, solely in terms of lengths, as 2bc s(s − a) w = . a b + c bc It follows easily from this that 2 − 2 2 − 2 b + c = wa +(s b) + wa +(s c) .

Writing u = s − a, v = s − b, w = s − c, we translate (ii) into w2 + v2 − v w2 + w2 − w u = a + a . (17.1) 2 2 √ u2+v2−u 2 If we define f(u, v):= 2 , (17.1) becomes

x = f(y,wa)+f(z, wa).

Now given three numbers ua,wb,wc > 0, let

F (x, y, z)=(f(y,wa)+f(z, wa),f(z, wb)+f(x, wb),f(x, wc)+f(y,wc)). (17.2) This mapping F happens to be a contraction mapping of a compact metric space. It has a unique fixed point, which can be obtained by iterating from any triple of values of (x, y, z), say (0, 0, 0). Theorem 17.2 (Mironescu and Panaitopol). Given three positive num- bers wa, wb, wc, there is a triangle whose angle bisectors has lengths wa, wb, wc. More precisely, if (u, v, w) is the fixed point of the mapping F , then (a, b, c)=(v + w, w + u, u + v).

1 s−a s−b s−c wa = wc if and only if a , b , and c are in geometric progression. 2Note that f(u, v) > 0 unless v =0. 610 Medians and angle bisectors

Examples

(1) With (wa,wb,wc)=(1, 2, 3), we obtain in 12 iterations, the fixed point (u, v, w)=(0.27804, 1.23595, 2.37174), which gives the triangle (a, b, c)=(3.60769, 2.64978, 1.51399).

(2) With (wa,wb,wc)=(3, 4, 5), we obtain in 18 iterations, the fixed point (u, v, w)=(1.27985, 2.36338, 3.5242), which gives the triangle (a, b, c)=(5.88757, 4.80405, 3.64322).

A few more examples:

(wa,wb,wc) steps (u, v, w) (a, b, c) (1, 2, 4) 12 (0.259097, 1.15252, 3.37975) (4.53227, 3.63884, 1.41162) (1, 3, 9) 11 (0.167698, 1.68573, 8.15232) (9.83805, 8.32002, 1.85343) (2, 3, 4) 16 (0.75241, 1.7986, 2.95245) (4.75105, 3.70486, 2.55101) (13, 14, 15) 22 (6.95846, 8.09993, 9.26214) (17.3621, 16.2206, 15.0584) (1,ϕ,ϕ2) 12 (0.330632, 0.938517, 2.07543) (3.01394, 2.40606, 1.26915) √ 5+1 In the last example, ϕ = 2 is the golden ratio. Chapter 18

Isosceles triangles equal in perimeter and area

Isaac Newton 1 has given an elegant solution to the so-called Roberval problem: To find two (rational) isosceles triangles which shall be equal in area and perimeter. Let the triangles be ABC, DEF; their bases AB =2p, DE =2x; their slant sides AC = q, DF = y. Then p+q = x+y and p q2 − p2 = x y2 − x2, that is p2q2−p4 = x2y2 − x4. Divide by the equals p + q and x + y and there will be p2q − p3 = x2y − y3. In place of y write p + q − x and there follows p3 + px2 − 2x3 p2q − p3 = px2 + qx2 − 2x3 and so q = . p2 − x2 − p2+px+2x2 Divide through by p x and there comes q = p+x . Since this solution gives q in terms of p and x, it does not construct an isosceles triangle equal in perimeter and area to a given one. The last expression for q, however, can be construed as an equation in x: 2x2 − (q − p)x − p(q − p)=0. Since q>p, it is clear that this quadratic equation has exactly one positive root given by 1 x = (q − p)+ (q − p)(q +7p) . (18.1) 4

1D.T.Whiteside, The Mathematical Papers of Issac Newton, vol. IV,pp. 105 – 107, Cambridge University Press, 1971. 612 Isosceles triangles equal in perimeter and area

Note that this positive root is p if and only if q =2p, i.e., the given triangle is equilateral. On the other hand, since (q − p)(q +7p) < q +3p,wehave 1 1 y = p + q − x>p+ q − ((q − p)+(q +3p)) = (p + q) > 0. 4 2 We conclude, therefore, that to every non-equilateral, isosceles triangle, there corresponds a unique, non-congruent isosceles triangle equal in perimeter and area.

We shall construct pairs of such isosceles triangles with integer sides. Suppose, then, that in (18.1) above, p and q are integers. The base 2x of the second isosceles triangle is an integer if and only if (q − p)(q +7p) is a square integer. Writing q − p = dh2 and q +7p = dk2 for integers d, h, k, with gcd(h, k)=1,wehave d d p = (k2 − h2),q= (k2 +7h2). 8 8 Note that d gcd(2p, q)= · gcd(2(k2 − h2),k2 +7h2) 8 d = · gcd(k2 +7h2, 16h2) 8 d = · gcd(k2 +7h2, 16) 8 d, if k and h are both odd, = d 8 , if k and h are of different parity. For the second isosceles triangle, we have, from (18.1) and the rela- tion y = p + q − x, d d x = · h(h + k),y= · (k2 − hk +2h2). 4 4 Note also that

d gcd(2x, y)= · gcd(2h(h + k),k2 − hk +2h2) 4 d = · gcd(2(h + k),k2 − hk +2h2) 4 613

1,kodd and h even, = 2,keven and h odd, or k − h ≡ 0(mod4), 4,k− h ≡ 2(mod4). To obtain a pair of isosceles triangles of integer sides without com- mon divisors, we choose, for given relatively prime integers h

Example. With h+k ≤ 10, we obtain the following pairs of isosceles triangles equal in perimeter and area.

(h, k) (h ,k ) (h, k) (h ,k ) perimeter area√ (1, 2) (1, 5) (11, 11, 6) (8, 8, 12) 28 12√ 7 (1, 4) (3, 7) (23, 23, 30) (28, 28, 20) 76 60√19 (2, 3) (1, 9) (37, 37, 10) (22, 22, 40) 84 40 √21 (1, 6) (5, 9) (43, 43, 70) (64, 64, 28) 156 140√39 (2, 5) (3, 11) (53, 53, 42) (46, 46, 56) 148 168√ 37 (3, 4) (1, 13) (79, 79, 14) (44, 44, 84) 172 84√ 43 (1, 7) (3, 5) (7, 7, 12) (11, 11, 4) 26 6 √13 (1, 8) (7, 11) (71, 71, 126) (116, 116, 36) 268 252√67 (2, 7) (5, 13) (77, 77, 90) (86, 86, 72) 244 360√61 (4, 5) (1, 17) (137, 137, 18) (74, 74, 144) 292 144 73 It is interesting to note that none of these “beginning” examples have integer area for the triangles. Indeed, Newton went on to find triangles subject to the same conditions so that their perpendiculars also are ra- tional, ([2; pp. 106 – 107]). He gave two solutions, the first of which is similar to the solution by Schooten reported in Dickson’s History of the Theory of Numbers, vol. II, [1; p.201]. In the second solution, for given b2−t2 rational numbers b and t, Newton chooses s = 2t−b . This will make b2 + bs + s2 = a2 for a rational number a. Then, the isosceles triangles 614 Isosceles triangles equal in perimeter and area with sides (a2 +b2,a2+b2, 2(a2−b2)) and (a2+s2,a2+s2, 2(a2−s2)) are equal in perimeter and area. Newton did not give numerical examples.

To obtain pairs of such triangles with integer sides (without common divisor), it is enough, by the above analysis, to choose h and k so that k2 +3h2 is the square or an integer. It is well known that k and h must be of the form m2 − 3n2 2mn k = ,h= g g for relatively prime integers m and n, and g =gcd(m2 − 3n2, 2mn). With m+n ≤ 10, we obtain the following pairs of isosceles triangles with integer sides and integer areas, equal in perimeter and area.

(m, n) (h, k) (h,k) (h, k) (h,k) perimeter area (4, 1) (8, 13) (5, 37) (617, 617, 210) (386, 386, 672) 1444 63840 (6, 1) (4, 11) (7, 23) (233, 233, 210) (218, 218, 240) 676 21840 (8, 1) (16, 61) (45, 109) (5513, 5513, 6930) (6514, 6514, 4928) 17956 14857920 (7, 2) (28, 37) (9, 121) (6857, 6857, 1170) (3802, 3802, 7280) 14884 3996720 (9, 1) (3, 13) (5, 11) (29, 29, 40) (37, 37, 24) 98 420 Chapter 19

The area of a triangle

19.1 Heron’s formula for the area of a triangle

Theorem 19.1. The area of a triangle of sidelengths a, b, c is given by  = s(s − a)(s − b)(s − c),

1 where s = 2 (a + b + c).

B

Ia

I ra

r

C A Y s − b s − c Y s − a

Proof. Consider the incircle and the excircle on the opposite side of A. From the similarity of triangles AIZ and AI Z, r s − a = . ra s From the similarity of triangles CIY and I CY ,

r · ra =(s − b)(s − c). 702 The area of a triangle

From these, (s − a)(s − b)(s − c) r = , s and the area of the triangle is  = rs = s(s − a)(s − b)(s − c).

19.2 Heron triangles

A Heron triangle is one whose sidelengths and area are both integers. It can be constructed by joining two integer right triangles along a common leg. For example, by joining the two Pythagorean triangles (9, 12, 15) and (5, 12, 13), we obtain the Heron triangle (13, 14, 15) with area 84.

15 13 12

5 9

Some properties of Heron triangles 1. The semiperimeter is an integer. 2. The area is always a multiple of 6.

19.3 Heron triangles with consecutive sides

If (b − 1,b,b+1, ) is a Heron triangle, then b must be an even integer. We write b =2m. Then s =3m, and 2 =3m2(m − 1)(m +1). This requires m2 − 1=3k2 for an integer k, and  =3km. The solutions of m2 − 3k2 =1can be arranged in a sequence m 23 m m 2 n+1 = n , 1 = . kn+1 12 kn k1 1 19.3 Heron triangles with consecutive sides 703

From these, we obtain the side lengths and the area. The middle sides form a sequence (bn) given by

bn+2 =4bn+1 − bn,b0 =2,b1 =4. The areas of the triangles form a sequence

n+2 =14n+1 −n,T0 =0,T1 =6.

n bn Tn Heron triangle 0 2 0 (1, 2, 3, 0) 1 4 6 (3, 4, 5, 6) 2 14 84 (13, 14, 15, 84) 3 4 5 704 The area of a triangle

19.4 Heron triangles with sides in arithmetic progres- sion

We write s − a = u, s − b = v, and s − c = w. a, b, c are in A.P. if and only if u, v, w are in A.P. Let u = v − d and w = v + d. Then we require 3v2(v − d)(v + d) to be a square. This means v2 − d2 =3t2 for some integer t. Proposition 19.2. Let d be a squarefree integer. If gcd(x, y, z)=1and x2+dy2 = z2, then there are integers m and n satisfying gcd(dm, n)=1 such that (i)

x = m2 − dn2,y=2mn, z = m2 + dn2

if m and dn are of different parity, or (ii) m2 − dn2 m2 + n2 x = ,y= mn, z = , 2 2 if m and dn are both odd.

For the equation v2 = d2 +3t2, we take v = m2 +3n2, d = m2 −3n2, and obtain u =6n2, v = m2 +3n2, w =2m2, leading to

a =3(m2 + n2),b=2(m2 +3n2),c= m2 +9n2,

for m, n of different parity and gcd(m, 3n)=1.

mna− daa+ d area 1 2 15 14 13 84 1 4 51 38 25 456 2 1 15 26 37 156 2 5 87 74 61 2220 3 2 39 62 85 1116 3 4 75 86 97 3096 4 1 51 98 145 1176 4 5 123 146 169 8760 5 2 87 158 229 4740 5 4 123 182 241 10920

If m and n are both odd, we obtain 19.5 Heron triangles with integer medians 705

mna− daa+ d area 11 3 4 5 6 1 5 39 28 17 210 3 1 15 28 41 126 3 5 51 52 53 1170 5 1 39 76 113 570

19.5 Heron triangles with integer medians

It is an unsolved problem to find Heron triangles with integer medians. The triangle (a, b, c) = (136, 170, 174) has three integer medians. But it is not a Heron triangle. It has an area . Buchholz and Rathbun have found an infinite set of Heron triangles with two integer medians. Here is the first one. Let a =52, b = 102, c = 146. This is a Heron triangle with area and two integer medians mb = and mc = . The third one, however, has irrational length: ma = . 706 The area of a triangle

Appendix: Heron triangles with sides < 100

(a, b, c, )(a, b, c, )(a, b, c, )(a, b, c, )(a, b, c, ) (3, 4, 5, 6) (5, 5, 6, 12) (5, 5, 8, 12) (5, 12, 13, 30) (10, 13, 13, 60) (4, 13, 15, 24) (13, 14, 15, 84) (9, 10, 17, 36) (8, 15, 17, 60) (16, 17, 17, 120) (11, 13, 20, 66) (7, 15, 20, 42) (10, 17, 21, 84) (13, 20, 21, 126) (13, 13, 24, 60) (12, 17, 25, 90) (7, 24, 25, 84) (14, 25, 25, 168) (3, 25, 26, 36) (17, 25, 26, 204) (17, 25, 28, 210) (20, 21, 29, 210) (6, 25, 29, 60) (17, 17, 30, 120) (11, 25, 30, 132) (5, 29, 30, 72) (8, 29, 35, 84) (15, 34, 35, 252) (25, 29, 36, 360) (19, 20, 37, 114) (15, 26, 37, 156) (13, 30, 37, 180) (12, 35, 37, 210) (24, 37, 37, 420) (16, 25, 39, 120) (17, 28, 39, 210) (25, 34, 39, 420) (10, 35, 39, 168) (29, 29, 40, 420) (13, 37, 40, 240) (25, 39, 40, 468) (15, 28, 41, 126) (9, 40, 41, 180) (17, 40, 41, 336) (18, 41, 41, 360) (29, 29, 42, 420) (15, 37, 44, 264) (17, 39, 44, 330) (13, 40, 45, 252) (25, 25, 48, 168) (29, 35, 48, 504) (21, 41, 50, 420) (39, 41, 50, 780) (26, 35, 51, 420) (20, 37, 51, 306) (25, 38, 51, 456) (13, 40, 51, 156) (27, 29, 52, 270) (25, 33, 52, 330) (37, 39, 52, 720) (15, 41, 52, 234) (5, 51, 52, 126) (25, 51, 52, 624) (24, 35, 53, 336) (28, 45, 53, 630) (4, 51, 53, 90) (51, 52, 53, 1170) (26, 51, 55, 660) (20, 53, 55, 528) (25, 39, 56, 420) (53, 53, 56, 1260) (33, 41, 58, 660) (41, 51, 58, 1020) (17, 55, 60, 462) (15, 52, 61, 336) (11, 60, 61, 330) (22, 61, 61, 660) (25, 52, 63, 630) (33, 34, 65, 264) (20, 51, 65, 408) (12, 55, 65, 198) (33, 56, 65, 924) (14, 61, 65, 420) (36, 61, 65, 1080) (16, 63, 65, 504) (32, 65, 65, 1008) (35, 53, 66, 924) (65, 65, 66, 1848) (21, 61, 68, 630) (43, 61, 68, 1290) (7, 65, 68, 210) (29, 65, 68, 936) (57, 65, 68, 1710) (29, 52, 69, 690) (37, 37, 70, 420) (9, 65, 70, 252) (41, 50, 73, 984) (26, 51, 73, 420) (35, 52, 73, 840) (48, 55, 73, 1320) (19, 60, 73, 456) (50, 69, 73, 1656) (25, 51, 74, 300) (25, 63, 74, 756) (35, 44, 75, 462) (29, 52, 75, 546) (32, 53, 75, 720) (34, 61, 75, 1020) (56, 61, 75, 1680) (13, 68, 75, 390) (52, 73, 75, 1800) (40, 51, 77, 924) (25, 74, 77, 924) (68, 75, 77, 2310) (41, 41, 80, 360) (17, 65, 80, 288) (9, 73, 80, 216) (39, 55, 82, 924) (35, 65, 82, 1092) (33, 58, 85, 660) (29, 60, 85, 522) (39, 62, 85, 1116) (41, 66, 85, 1320) (36, 77, 85, 1386) (13, 84, 85, 546) (41, 84, 85, 1680) (26, 85, 85, 1092) (72, 85, 85, 2772) (34, 55, 87, 396) (52, 61, 87, 1560) (38, 65, 87, 1140) (44, 65, 87, 1386) (31, 68, 87, 930) (61, 74, 87, 2220) (65, 76, 87, 2394) (53, 75, 88, 1980) (65, 87, 88, 2640) (41, 50, 89, 420) (28, 65, 89, 546) (39, 80, 89, 1560) (21, 82, 89, 840) (57, 82, 89, 2280) (78, 89, 89, 3120) (53, 53, 90, 1260) (17, 89, 90, 756) (37, 72, 91, 1260) (60, 73, 91, 2184) (26, 75, 91, 840) (22, 85, 91, 924) (48, 85, 91, 2016) (29, 75, 92, 966) (39, 85, 92, 1656) (34, 65, 93, 744) (39, 58, 95, 456) (41, 60, 95, 798) (68, 87, 95, 2850) (73, 73, 96, 2640) (37, 91, 96, 1680) (51, 52, 97, 840) (65, 72, 97, 2340) (26, 73, 97, 420) (44, 75, 97, 1584) (35, 78, 97, 1260) (75, 86, 97, 3096) (11, 90, 97, 396) (78, 95, 97, 3420) Chapter 20

Heron triangles and incircles

20.1 Enumeration of Heron triangles by inradii

Let r be the inradius of a triangle with w = s − a, v = s − b, u = s − c. uvw r2 = . u + v + w

From this, r2(u + v) w = . uv − r2 Note that uv > r2. ≤ ≤ ≥ ≥ ≥ π We shall assume u v w. Note that C√ B A, and C 3 . It follows that r =tanC ≥ √1 , and u ≤ 3r. Also, u =cotC = u 2 3 r 2 A+B ≤ · B 2rv 2 − 2 ≤ 2 tan 2 tan 2 2 = v2−r2 . From this, u(v r ) 2r v, and √ r2 + r r2 + u2 v ≤ . u

If T (r) denotes the number of distinct Heron triangles with inradius r, the beginning values of T (r) are as follows.

r 123456789101112 T (r)15131815452445515226139 708 Heron triangles and incircles

r (a, b, c)  (u, v, w) r (a, b, c)  (u, v, w) 1 (3, 4, 5) 6 (1, 2, 3) 2 (6, 25, 29) 60 (1, 5, 24) 2 (7, 15, 20) 42 (1, 6, 14) 2 (9, 10, 17) 36 (1, 8, 9) 2 (5, 12, 13) 30 (2, 3, 10) 2 (6, 8, 10) 24 (2, 4, 6) 3 (11, 100, 109) 330 (1, 10, 99) 3 (12, 55, 65) 198 (1, 11, 54) 3 (13, 40, 51) 156 (1, 12, 39) 3 (15, 28, 41) 126 (1, 14, 27) 3 (16, 25, 39) 120 (1, 15, 24) 3 (19, 20, 37) 114 (1, 18, 19) 3 (7, 65, 68) 210 (2, 5, 63) 3 (8, 26, 30) 96 (2, 6, 24) 3 (11, 13, 20) 66 (2, 9, 11) 3 (7, 24, 25) 84 (3, 4, 21) 3 (8, 15, 17) 60 (3, 5, 12) 3 (9, 12, 15) 54 (3, 6, 9) 3 (10, 10, 12) 48 (4, 6, 6) 4 (18, 289, 305) 1224 (1, 17, 288) 4 (19, 153, 170) 684 (1, 18, 152) 4 (21, 85, 104) 420 (1, 20, 84) 4 (25, 51, 74) 300 (1, 24, 50) 4 (33, 34, 65) 264 (1, 32, 33) 4 (11, 90, 97) 396 (2, 9, 88) 4 (12, 50, 58) 240 (2, 10, 48) 4 (14, 30, 40) 168 (2, 12, 28) 4 (15, 26, 37) 156 (2, 13, 24) 4 (18, 20, 34) 144 (2, 16, 18) 4 (9, 75, 78) 324 (3, 6, 72) 4 (10, 35, 39) 168 (3, 7, 32) 4 (11, 25, 30) 132 (3, 8, 22) 4 (15, 15, 24) 108 (3, 12, 12) 4 (9, 40, 41) 180 (4, 5, 36) 4 (10, 24, 26) 120 (4, 6, 20) 4 (12, 16, 20) 96 (4, 8, 12) 4 (13, 14, 15) 84 (6, 7, 8) 5 (27, 676, 701) 3510 (1, 26, 675) 5 (28, 351, 377) 1890 (1, 27, 350) 5 (31, 156, 185) 930 (1, 30, 155) 5 (36, 91, 125) 630 (1, 35, 90) 5 (39, 76, 113) 570 (1, 38, 75) 5 (51, 52, 101) 510 (1, 50, 51) 5 (15, 377, 388) 1950 (2, 13, 375) 5 (17, 87, 100) 510 (2, 15, 85) 5 (27, 29, 52) 270 (2, 25, 27) 5 (12, 153, 159) 810 (3, 9, 150) 5 (13, 68, 75) 390 (3, 10, 65) 5 (17, 28, 39) 210 (3, 14, 25) 5 (11, 60, 61) 330 (5, 6, 55) 5 (12, 35, 37) 210 (5, 7, 30) 5 (15, 20, 25) 150 (5, 10, 15)

20.2 Inradii in arithmetic progression

(1) Triangle ABC below has sides 13, 14, 15. The three inradii are 2, 3, 4. B

C A D 20.3 Division of a triangle into two subtriangles with equal incircles 709

(2) The following four inradii are in arithmetic progression. What is the shape of the large triangle?

20.3 Division of a triangle into two subtriangles with equal incircles

Let P be a point on the side BC of triangle ABC. If the inradii of triangles ABP and ACP are equal, then (i) AP 2 = s(s − a); √ c2+a2−b2±2(b−c) s(s−a) (ii) BP = 2a for an appropriate choice of sign. Here are two examples of Heron triangles with subdivision into two Heron triangles with equal inradii. (1) (a, b, c)=(15, 17, 8); BP =6, CP =15. AP =10. The two small triangles have the same inradius 2.

A

B P C 710 Heron triangles and incircles

(2) (a, b, c)=(51, 65, 20); BP =33, CP =18. AP =34. The two small triangles have the same inradius 4.

A

B P C Chapter 21

More about Heron triangles

21.1 Heron triangle as lattice triangle

A Heron triangle is decomposable if it can be decomposable into (the union or difference of) two Pythagorean triangles. It is decomposable if one or more heights are integers. A decomposable Heron triangle can clearly be realized as a lattice triangle. It turns out that this is also true of the indecomposable one. For example, the Heron triangle (25, 34, 39; 420) is indecomposable, but can be realized at vertices (0, 0), (−20, 15), (16, 30).

Theorem 21.1. Every Heron triangle can be realized as a lattice trian- gle.

21.2 The circumcircle of a Heron triangle

The circumradius of a Heron triangle is in general not an integer. If p is a prime of the form 4k +1, then there are unique integers m>n satisfying p = m2 + n2. The Pythagorean triangle

a =4mn, b =2(m2 − n2),c=2(m2 + n2)=2p

clearly has circumradius p. The converse is also true.

Proposition 21.2. If the circumradius of a Heron triangle is a prime number p, then p ≡ 1mod4, and the triangle is congruent to the Pythagorean triangle above. 712 More about Heron triangles

21.3 Heron triangles with square areas

Fermat has shown that there does not exist a Pythagorean triangle whose area is a perfect square. However, the triangle with sides 9, 10, 17 has area 36. In fact, there infinitely many primitive Heron triangles whose ar- eas are perfect squares. Here is one family constructed by C. R. Maderer. 1 For each positive integer k, define

4 2 ak =20k +4k +1, 6 4 2 bk =8k − 4k − 2k +1, 6 4 2 ck =8k +8k +10k .

Here, ak,bk

N. D. Elkies has constructed 2 an infinite sequence of solutions of the Diophantine equation A4 + B4 + C4 = D4,

with gcd(A, B, C, D)=1. The triangle with a = B4 + C4,b= C4 + A4,c= A4 + B4

is a Heron triangle with area (ABCD)2. The first example which Elkies constructed is A =2682440, B =15365639, C =18796760, D =20615673.

1American Mathematical Monthly, 98 (1991). 2On A4 + B4 + C4 = D4, Math. Comp., 51 (1988) 825 – 835. Chapter 22

The regular pentagon

22.1 The golden ratio

The construction of the regular pentagon is based on the division of a segment in the golden ratio. 1 Given a segment AB, to divide it in the golden ratio is to construct a point P on it so that the area of the square on AP is the same as that of the rectangle with sides PB and AB, i.e., AP 2 = AB · PB. A construction of P is shown in the second diagram.

M

A P B A P B

Suppose PB has unit length. The length ϕ of AP satisfies ϕ2 = ϕ +1.

1In Euclid’s Elements, this is called division into the extreme and mean ratio. 802 The regular pentagon

This equation can be rearranged as 1 2 5 ϕ − = . 2 4 Since ϕ>1,wehave 1 √ ϕ = 5+1 . 2 Note that √ AP ϕ 1 2 5 − 1 = = = √ = . AB ϕ +1 ϕ 5+1 2 This explains the construction above.

22.2 The diagonal-side ratio of a regular pentagon

Consider a regular pentagon ACBDE. It is clear that the five diagonals all have equal lengths. Note that (1) ∠ACB = 108◦, (2) triangle CAB is isosceles, and (3) ∠CAB = ∠CBA = (180◦ − 108◦) ÷ 2=36◦. In fact, each diagonal makes a 36◦ angle with one side, and a 72◦ angle with another. C

A B P

E D

It follows that (4) triangle PBC is isosceles with ∠PBC = ∠PCB =36◦, (5) ∠BPC = 180◦ − 2 × 36◦ = 108◦, and (6) triangles CAB and PBC are similar. 22.3 Construction of a regular pentagon with a given diagonal 803

Note that triangle ACP is also isosceles since (7) ∠ACP = ∠AP C =72◦. This means that AP = AC. Now, from the similarity of CAB and PBC,wehaveAB : AC = BC : PB. In other words AB · AP = AP · PB,orAP 2 = AB · PB. This means that P divides AB in the golden ratio.

22.3 Construction of a regular pentagon with a given diagonal

Given a segment AB, we construct a regular pentagon ACBDE with AB as a diagonal. (1) Divide AB in the golden ratio at P . (2) Construct the circles A(P ) and P (B), and let C be an intersection of these two circles. (3) Construct the circles A(AB) and B(C) to intersect at a point D on the same side of BC as A. (4) Construct the circles A(P ) and D(P ) to intersect at E. Then ACBDE is a regular pentagon with AB as a diameter. C

A B P

E D 804 The regular pentagon

22.4 Some interesting constructions of the golden ratio

22.4.1 Construction of 36◦, 54◦, and 72◦ angles Each of the following constructions begins with the division of a segment AB in the golden ratio at P .

C

◦ ◦ 36 36 B A P

C C

72◦ 54◦

◦ 36 B A P

◦ 54 ◦ 72 B A P

D

22.4.2 Odom’s construction Let D and E be the midpoints of the sides AB and AC of an equilateral triangle ABC. If the line DE intersects the circumcircle of ABC at F , then E divides DF in the golden ratio. A

D E F

B C 22.4 Some interesting constructions of the golden ratio 805

22.4.3 ϕ and arctan 2 Given a segment AB, erect a square on it, and an adjacent one with base BC.IfD is the vertex above A, construct the bisector of angle ADC to intersect AB at P . Then P divides AB in the golden ratio.

D

A P B C

Proof. If AB =1, then √ AP : PC =1 : 5, √ AP : AC =1 : 5+1 √ AC :2AB =1 : 5+1 √ AB : AP = 5+1:2 =ϕ :1.

This means that P divides AB in the golden ratio. 806 The regular pentagon Chapter 23

Construction of regular polygons

A regular polygon of n sides can be constructed (with ruler and compass) if it is possible to divides the circle into n equal parts by dividing the 360◦ at the center into the same number of equal parts. This can be easily done for n =6(hexagon) and 8 (octagon). 1 We give some easy alternatives for the regular hexagon, octagon and dodecagon.

23.1 The regular hexagon

A regular hexagon can be easily constructed by successively cutting out chords of length equal to the radius of a given circle.

1Note that if a regular n-gon can be constructed by ruler and compass, then a regular 2n-gon can also be easily constructed. 808 Construction of regular polygons

23.2 The regular octagon

(1) Successive completion of rhombi beginning with three adjacent 45◦- rhombi.

(2) We construct a regular octagon by cutting from each corner of a given square (of side length 2√) an isosceles right triangle√ of (shorter)√ side x. This means 2 − 2x : x = 2:1, and 2 − 2x = 2x; (2 + 2)x =2, √ 2 2(2 − 2) √ x = √ = √ √ =2− 2. 2+ 2 (2 + 2)(2 − 2)

D C D C

O

Q Q x

A x 2 − 2x P x B A P B

√ Therefore AP =2− x = 2, which is half of the diagonal of the square. The point P , and the other vertices, can be easily constructed by intersecting the sides of the square with quadrants of circles with centers at the vertices of the square and passing through the center O. 23.3 The regular dodecagon 809

23.3 The regular dodecagon

(1) Trisection of right angles.

(2) A regular dodecagon can be formed from 4 equilateral triangles inside a square. 8 of its vertices are the intersections of the sides of these equilateral triangles, while the remaining 4 are the midpoints of the sides of the squares formed by the vertices of the equilateral triangles inside the square.

3 An easy dissection shows that the area of the regular dodecagon is 4 of that of the (smaller) square containing it. 810 Construction of regular polygons

(3) Successive completion of rhombi beginning with five adjacent 30◦-rhombi.

This construction can be extended to other regular polygons. If an an- 360 ◦ gle of measure θ := 2n can be constructed with ruler and compass, be- ginning with n−1 adjacent θ-rhombi, by succesively completing rhombi, we obtain a regular 2n-gons tesellated by

1 (n − 1) + (n − 2) + ···+2+1= n(n − 1) 2

rhombi.

23.4 Construction of a regular 15-gon

Let A1A2A3A4A5 be a regular pentagon inscribed in a circle (O). Con- struct equilateral triangles A1A2B5, A2A3B5, A3A4B1, A4A5B2, A5A1B3 with the extra vertices inside the circle. Extend the sides of these equilat- eral triangles to intersect the circle again. The 10 intersections, together the vertices of the regular pentagon, form the vertices of a regular 15-gon inscribed in the circle. 23.5 Construction of a regular 17-gon 811

A2

A3

B2

B3

O B1 A1

B4

B5

A4

A5

23.5 Construction of a regular 17-gon

The following construction 2 of a regular 17-gon makes use of Gauss’ computation 360◦ 1 √ √ cos = 17 − 1+ 34 − 2 17 17 16 1 √ √ √ + 17 + 3 17 − 34 − 2 17 − 2 34 + 2 17. 8 Consider a circle (O) with two perpendicular diameters PQand RS. 1 (1) On the radius OR, mark a point A such that OA = 4 OP. (2) Construct the internal and external bisectors of angle OAP to inter- sect the line OP at B and C respectively. (3) Mark D and E on PQsuch that CD = CA and BE = BA. (4) Mark the midpoint M of QD. (5) Mark F on OS such MF = MQ. (6) Construct the semicircle on OE and mark a point G on it such that

2J. J. Callagy, The central angle of the regular 17-gon, Math. Gaz., 67 (1983) 290–292. 812 Construction of regular polygons

OG = OF. (7) Mark H on OP such that EH = EG, and construct the perpendicu- lar to OP at H to intersect the circle at P1. ∠ 360◦ Then POP1 = 17 , and P1 is a vertex of the regular 17-gon adja- cent to P on the circle.

R

P1

A

Q P M C O D B E H

F G

S Chapter 24

Hofstetter’s constructions on the golden section

This chapter collects some short papers by Kurt Hofstetter in Forum Ge- ometricorum on the golden section.

24.1 A simple construction of the golden section

We construct the golden section by drawing 5 circular arcs. 1

We denote by P (Q) the circle with P as center and PQ as radius. Figure 24.1 shows two circles A(B) and B(A) intersecting at C and D. The line AB intersects the circles again at E and F . The circles A(F ) and B(E) intersect at two points X and Y . It is clear that C, D, X, Y are on a line. It is much more interesting to note that D divides the segment CX in the golden ratio, i.e., √ CD 5 − 1 = . CX 2 √ This is easy√ to verify.√ If we assume AB of length 2, then CD =2 3 and CX = 15 + 3. From these, √ √ CD 2 3 2 5 − 1 = √ √ = √ = . CX 15 + 3 5+1 2

1Forum Geom., 2 (2002) 65–66. 814 Hofstetter’s constructions on the golden section

X

D

E AFB

C

Y Figure 24.1:

This shows that to construct three collinear points in golden section, we need four circles and one line. It is possible, however, to replace the line AB by a circle, say C(D). See Figure 24.2. Thus, the golden section can be constructed with compass only, in 5 steps.

X

D

A B E F

C

Y Figure 24.2:

It is interesting to compare this with Figure 24.3 which also displays the golden section. 2 Here, ABC is an equilateral triangle. The line joining the midpoints D, E of two sides intersects the circumcircle at F .

2See D. H. Fowler, The Mathematics of Plato’s Academy, Oxford University Press, 1988, p.105, note on 3.5(b); and G. Odom and J. van de Craats, Elementary Problem 3007, American Math. Monthly, 90 (1983) 482; solution, 93 (1986) 572. I am indebted to a referee for these references. 24.2 A 5-step division of a segment in the golden section 815

Then E divides DF in the golden section, i.e., √ DE 5 − 1 = . DF 2 However, it is unlikely that this diagram can be constructed in fewer than 5 steps, using ruler and compass, or compass alone.

A

D E F

B C

Figure 24.3:

24.2 A 5-step division of a segment in the golden sec- tion

Using ruler and compass only in five steps, we divide a given segment in the golden section. 3

Inasmuch as we have given in §24.1 a construction of the golden sec- tion by drawing 5 circular arcs, we present here a very simple division of a given segment in the golden section, in 5 euclidean steps, using ruler and compass only. For two points P and Q, we denote by P (Q) the circle with P as center and PQas radius. Construction 24.1. Given a segment AB, construct

1. C1 = A(B),

2. C2 = B(A), intersecting C1 at C and D,

3. C3 = C(A), intersecting C1 again at E,

4. the segment CD to intersect C3 at F ,

5. C4 = E(F ) to intersect AB at G.

3Forum Geom., 3 (2003) 205–206. 816 Hofstetter’s constructions on the golden section

C3

C4

E C

G G

H A B F

C1 C2

D

Figure 24.4:

The point G divides the segment AB in the golden section. √ √Proof. Suppose AB has unit length. Then CD = 3 and EG = EF = 2. Let H be the orthogonal projection of E on the line AB. Since 1 2 2 − 2 − 3 5 HA = 2 , and HG√ = EG EH =2 4 = 4 ,wehaveAG = − 1 − HG HA = 2 ( 5 1). This shows that G divides AB in the golden section.

 Remark. The other√ intersection G of C4 and the line AB is such that  1 G A : AB = 2 ( 5+1):1.

24.3 Another 5-step division of a segment in the golden section

We give one more 5-step division of a segment into golden section, using ruler and compass only. 4

4Forum Geom., 4(2004) 21–22. 24.3 Another 5-step division of a segment in the golden section 817

Inasmuch as we have given in §§24.1,24.2 5-step constructions of the golden section we present here another very simple method using ruler and compass only. It is fascinating to discover how simple the golden section appears. For two points P and Q, we denote by P (Q) the circle with P as center and PQas radius.

C3

F D C2

C1

E G

A B

C

Figure 24.5:

Construction 24.2. Given a segment AB, construct

1. C1 = A(B),

2. C2 = B(A), intersecting C1 at C and D,

3. the line AB to intersect C1 at E (apart from B),

4. C3 = E(B) to intersect C2 at F (so that C and F are on opposite sides of AB), 5. the segment CF to intersect AB at G. The point G divides the segment AB in the golden section. Proof.√ Suppose AB has unit length. It is enough to show that AG = 1 − 2 ( 5 1). Extend BA to intersect C3 at H. Let CD intersect AB at I, and let J be the orthogonal projection of F on AB. In the right triangle HFB, 2 × 1 BH =4, BF =1. Since BF =√BJ BH, BJ = 4 . Therefore, 1 1 IJ = 4 . It also follows that JF = 4 15. 818 Hofstetter’s constructions on the golden section

F D

G

H E A I B G J

C

Figure 24.6:

√ 1 IG IC 2√ 3 √2 √ 2 · Now, GJ = JF = 1 = . It follows that IG = IJ = √ 4 15 √ 5 5+2 5−2 1 5−1 2 , and AG = 2 + IG = 2 . This shows that G divides AB in the golden section.

  Remark. If FD√is extended to intersect AH at G , then G is such that  1 G A : AB = 2 ( 5+1):1. After the publication of §24.2, Dick Klingens and Marcello Tarquini have kindly written to point out that the same construction had appeared almost one century ago in the following references. (i) E. Lemoine, Geom´ etrographie´ ou Art des Constructions Geom´ etriques´ , C. Naud, Paris, 1902; p.51. (ii) J. Reusch, Planimetricsche Konstruktionen in Geometrographischer Ausfuhrung¨ , Teubner, Leipzig, 1904; S.37.

24.4 Divison of a segment in the golden section with ruler and rusty compass

We give a simple 5-step division of a segment into golden section, using ruler and rusty compass. 5

5Forum Geom., 5 (2005) 135–136. 24.4 Divison of a segment in the golden section with ruler and rusty compass 819 In §24.3 we have given a 5-step division of a segment in the golden section with ruler and compass. We modify the construction by using a rusty compass, i.e., one when set at a particular opening, is not permitted to change. For a point P and a segment AB, we denote by P (AB) the circle with P as center and AB as radius.

F

D C2 C1

C3

A M G B

C

Figure 24.7:

Construction 24.3. Given a segment AB, construct

1. C1 = A(AB),

2. C2 = B(AB), intersecting C1 at C and D, 3. the line CD to intersect AB at its midpoint M,

4. C3 = M(AB) to intersect C2 at F (so that C and D are on opposite sides of AB), 5. the segment CF to intersect AB at G. The point G divides the segment AB in the golden section.

Proof. Extend BA to intersect C1 at E. According to §24.3, it is enough to show that EF =2· AB. Let F  be the orthogonal projection of F on AB. It is the midpoint of MB. Without loss of generality, assume AB = 4, so that MF = F B =1and EF =2· AB −F B =7. Applying the Pythagorean theorem to the right triangles EFF  and MFF,wehave 820 Hofstetter’s constructions on the golden section

F C D 2 C1

E F

A M G B

C3

C

Figure 24.8:

EF2 =EF2 + FF2 =EF2 + MF2 − MF2 =72 +42 − 12 =64. This shows that EF =8=2· AB.

24.5 A 4-step construction of the golden ratio

We construct, in 4 steps using ruler and compass, three points two of the distances among which bear the golden ratio. 6

We present here a 4-step construction of the golden ratio using ruler and compass only. More precisely, we construct, in 4 steps using ruler and compass, three points two of the distances among which bear the golden ratio. It is fascinating to discover how simple the golden ratio appears. We denote by P (Q) the circle with center P , passing through Q, and by P (XY ) that with center P and radius XY . Construction 24.4. Given two points A and B, construct

6Forum Geom., 6 (2006) 179–180. 24.5 A 4-step construction of the golden ratio 821

H

F

E C A B D

C1 C3 C2 G

Figure 24.9:

1. the circle C1 = A(B),

2. the line AB to intersect C1 again at C and extend it long enough to intersect

3. the circle C2 = A(BC) at D and E,

4. the circle C3 = E(BC) to intersect C1 at F and G, and C2 at H and I. √ GH 5+1 Then CH = 2 . Proof. Without loss of generality let AB =1, so that BC = AE = AH = EH =2. Triangle AEH is equilateral. Let C4 = H(A), in- tersecting C1 at J. By symmetry, AGJ is an equilateral triangle. Let C5 = J(A)=J(AG)=J(AB), intersecting C1 at K. Finally, let C6 = J(H)=J(BC). See Figure 24.10. With C1, C5, C2, C6, following [1], K√divides GH in the golden sec- tion. It suffices to prove CH = GK = 3. This is clear for GK since the equilateral triangles AGK and AJK have sides of length 1. On the other hand, in the right triangle√ ACH, AC =1and AH =2. By the Pythogorean theorem CH = 3. 822 Hofstetter’s constructions on the golden section

C4

H

F K

C D E A B

J C1

C3 C2 G C6 C5

Figure 24.10:

√ CG 2 Remark. CH = 2 . Chapter 25

Prime and perfect numbers

25.1 Infinitude of prime numbers

25.1.1 Euclid’s proof If there were only finitely many primes: 2, 3, 5, 7, ...,P, and no more, consider the number Q =(2· 3 · 5 ···P )+1. Clearly it is divisible by any of the primes 2, 3,...,P , it must be itself a prime, or be divisible by some prime not in the list. This contradicts the assumption that all primes are among 2, 3, 5,...,P .

25.1.2 Fermat numbers

n The Fermat numbers are F := 22 +1. Note that n 2n 2n−1 2n−1 Fn − 2=2 − 1= 2 +1 2 − 1 = Fn−1(Fn−1 − 2). By induction,

Fn = Fn−1Fn−2 ···F1 · F0 +2,n≥ 1.

From this, we see that Fn does not contain any factor of F0, F1, ..., Fn−1. Hence, the Fermat numbers are pairwise relatively prime. From this, it follows that there are infinitely primes. 1

1It is well known that Fermat’s conjecture of the primality of Fn is wrong. While F0 =3, F1 =5, 32 F2 =17, F3 =257, and F4 = 65537 are primes, Euler found that F5 =2 + 1 = 4294967297 = 641 × 6700417. 902 Prime and perfect numbers

25.1.3 Fibonacci numbers

Since gcd(Fm,Fn)=Fgcd(m,n), if there are only finitely many primes p1,

...,pk, then the primes in Fp1 ,...,Fpk are distinct, and each one of them has only one prime divisors. This contradicts F19 = 4181 = 37 × 113.

25.2 The prime numbers below 20000

The first 2262 prime numbers:

10 20 30 40 50 60 70 80 90 100 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 25.3 Primes in arithmetic progression 903

25.3 Primes in arithmetic progression

B. Green and T. Tao (2004) have proved that there are arbitrarily long arithmetic progressions of prime numbers. For k =0, 1, 2,...,21, the numbers 376859931192959 + 18549279769020k are all primes.

25.4 The prime number spirals

The first 1000 prime numbers arranged in a spiral. = prime of the form 4n +1; = prime of the form 4n +3.

2 904 Prime and perfect numbers

25.4.1 The prime number spiral beginning with 17

17

The numbers on the 45 degree line are n2 + n +17. Let f(n)=n2 + n +17. The numbers f(0), f(1), ...f(15) are all prime.

nf(n) nf(n) nf(n) nf(n) 017119223329 437547659773 8 89 9 107 10 127 11 149 12 173 13 199 14 227 15 257 25.4 The prime number spirals 905

25.4.2 The prime number spiral beginning with 41

41

The numbers on the 45 degree line are f(n)=n2 + n +41. f(n)=n2 + n +41is prime for 0 ≤ n ≤ 39.

nf(n) nf(n) nf(n) nf(n) nf(n) 0 41 1 43 2 47 3 53 4 61 5 71 6 83 7 97 8 113 9 131 10 151 11 173 12 197 13 223 14 251 15 281 16 313 17 347 18 383 19 421 20 461 21 503 22 547 23 593 24 641 25 691 26 743 27 797 28 853 29 911 30 971 31 1033 32 1097 33 1163 34 1231 35 1301 36 1373 37 1447 38 1523 39 1601 906 Prime and perfect numbers

Prime number spiral beginning with 41: A closer look

41 25.5 Perfect numbers 907

25.5 Perfect numbers

A number is perfect is the sum of its proper divisors (including 1) is equal to the number itself. Theorem 25.1 (Euclid). If 1+2+22 + ···+2k−1 =2k − 1 is a prime number, then 2k−1(2k − 1) is a perfect number. Note: 2k − 1 is usually called the k-th Mersenne number and denoted by Mk.IfMk is prime, then k must be prime. Theorem 25.2 (Euler). Every even perfect number is of the form given by Euclid.

Open problem Does there exist an odd perfect number? Theorem-joke 25.1 (Hendrik Lenstra). Perfect squares do not exist. 2 Proof. Suppose n is a perfect square. Look at the odd divisors of n. They all divide the largest of them, which is itself a square, say d2. This shows that the odd divisors of n come in pairs a, b where a·b = d2. Only d is paired to itself. Therefore the number of odd divisors of n is also odd. In particular, it is not 2n. Hence n is not perfect, a contradiction: perfect squares don’t exist.

2Math. Intelligencer, 13 (1991) 40. 908 Prime and perfect numbers

25.6 Charles Twigg on the first 10 perfect numbers

There are only 39 known Mersenne primes, and therefore 39 known per- fect numbers. See Appendix. Let Pn be the n-th perfect number.

k−1 nkMk Pn =2 Mk 123 6 237 28 3531 496 4 7 127 8128 5 13 8191 33550336 6 17 131071 8589869056 7 19 524287 137438691328 8 31 2147483647 2305843008139952128 9 61 2305843009213693951 26584559915698317446 54692615953842176 10 89 61897001964269013744 19156194260823610729 9562111 47933780843036381309 97321548169216

• P1 is the difference of the digits of P2.InP2, the units digit is the cube of the of tens digit.

• P3 and P4 are the first two perfect numbers prefaced by squares. The first two digits of P3 are consecutive squares. The first and last digits of P4 are like cubes. The sums of the digits of P3 and P4 are the same, namely, the prime 19.

3 • P4 terminates both P11 and P14.

• Three repdigits are imbedded in P5.

• P7 contains each of the ten decimal digits except 0 and 5.

• P9 is the smallest perfect number to contain each of the nine nonzero digits at least once. It is zerofree.

• P10 is the smallest perfect number to contain each of the ten decimal digits at least once.

3These contain respectively 65 and 366 digits. 25.7 Mersenne primes 909

25.7 Mersenne primes

k Primes of the form Mk =2 − 1 are called Mersenne prime. The only known Mersenne primes are listed below.

k Year Discoverer k Year Discoverer 17 1588 P.A.Cataldi 19 1588 P.A.Cataldi 31 1750 L.Euler 61 1883 I.M.Pervushin 89 1911 R.E.Powers 107 1913 E.Fauquembergue 127 1876 E.Lucas 521 1952 R.M.Robinson 607 1952 R.M.Robinson 1279 1952 R.M.Robinson 2203 1952 R.M.Robinson 2281 1952 R.M.Robinson 3217 1957 H.Riesel 4253 1961 A.Hurwitz 4423 1961 A.Hurwitz 9689 1963 D.B.Gillies 9941 1963 D.B.Gillies 11213 1963 D.B.Gillies 19937 1971 B.Tuckerman 21701 1978 C.Noll, L.Nickel 23209 1979 C.Noll 44497 1979 H.Nelson, D.Slowinski 86243 1982 D.Slowinski 110503 1988 W.N.Colquitt, L.Welsch 132049 1983 D.Slowinski 216091 1985 D.Slowinski 756839 1992 D.Slowinski,P.Gage 859433 1993 D.Slowinski 1257787 1996 Slowinski and Gage 1398269 1996 Armengaud, Woltman et al. 2976221 1997 Spence, Woltman, et.al. 3021377 1998 Clarkson, Woltman, Kurowski et. al. 6972593 1999 Hajratwala, Woltman, 13466917 2001 Cameron, Woltman, Kurowski et. al. Kurowski et. al. 20996011 2003 Michael Shafer 24036583 2004 Findlay 25964951 2005 Nowak 30402457 2005 Cooper, Boone et al

M30402457 has 9152052 digits and is the largest known prime. 910 Prime and perfect numbers Chapter 26

Digit problems

26.1 Some intriguing division problems

26.1.1 Problem E1 of the MONTHLY x 7 xxx xxx) xxxxxxxx xxxx xxx xxx xxxx xxx xxxx xxxx

Clearly, the last second digit of the quotient is 0. Let the divisor be the 3-digit number d. Consider the 3-digit number in the seventh line, which is a multiple of d. Its difference from the 4-digit number in the sixth line is a 2-digit number. This must be 9xx. This cannot be the same as the 3-digit number in the fifth line, since the difference between the 3-digit numbers in the fourth and fifth lines is a 3-digit number. Therefore, in the quotient, the digit after 7 is a larger one, which must be smaller than the first and the last digits, since these give 4-digit multiples of d. It follows that the quotient is 97809. Since 8d is a 3-digit number 9xx, the 4-digit number in the third and 912 Digit problems bottom lines is 9d =10xx or 11xx. From this 8d must be 99x, and therefore 992 = 8 × 124.

97809 124)12128316 1116 968 868 1003 992 1116 1116

26.1.2 Problem E10 of the MONTHLY

This is Problem E10 of the MONTHLY, by Fitch Cheney. In this case, not even one single digit is given.

xxxxxx xxx) xxxxxxxx xxx xxxx xxx xxxx xxx xxxx xxxx 26.2 Problem E1111 of the MONTHLY 913

26.2 Problem E1111 of the MONTHLY

This is said to be the most popular Monthly problem. It appeared in the April issue of 1954. Our good friend and eminent numerologist, Professor Euclide Paracelso Bombasto Umbugio, has been busily engaged test- ing on his desk calculator the 81 · 109 possible solutions to the problem of reconstructing the following exact long division in which the digits indiscriminately were each replaced by x save in the quotient where they were almost entirely omitted.

xx8xx xxx)xxxxxxxx xxx xxxx xxx xxxx xxxx

Deflate the Professor! That is, reduce the possibilities to (18 · 109)0.

Martin Gardner’s remark: Because any number raised to the power of zero is one, the reader’s task is to discover the unique reconstruction of the problem. The 8 is in correct position above the line, making it the third digit of a five-digit answer. The problem is easier than it looks, yielding readily to a few elementary insights. 914 Digit problems

26.3 k-right-transposable integers

Let k be a given positive integer. A positive integer X is k-right-transposable if in moving the leftmost digit to the rightmost, the number is multiplied by k. Note that X is a repdigit if and only if k =1. We shall assume k>1. Theorem 26.1. The only right-transposable numbers are the repdigits (which aretriviallly 1-right transposable, and

(142857)m, (285714)m,

which are 3-right-transposable. Proof. Suppose the number X has n digits, with leftmost digit a.We have 10(X − a · 10n−1)+a = kX.

n From this, (10 − k)X = a(10 − 1) = 9a · Rn. If k =3 , 10 − k can only have prime divisors 2, 3, 5. The equation will reduce to X = a repdigit, which is clearly impossible. For k =3,wehave7X = a(10n − 1).Ifa =7, then again X is a repdigit. Therefore, we must have 7 dividing 10n − 1. This is possible · 106m−1 only if n is a multiple of 6. Therefore X = a 7 and has first digit a. Now, 106m − 1 = (142857) . 7 m It is easy to see that a can only be 1 or 2. Therefore, the only k- transposable numbers are (142857)m and (285714)m with k =3.

26.4 k-left-transposable integers

Let k be a given positive integer. A positive integer X is k-left-transposable if in moving the rightmost digit to the leftmost, the number is multiplied by k. Note that X is a repdigit if and only if k =1. We shall assume k>1. Suppose the number X has n digits, and its rightmost digit is b. We have X − b b · 10n−1 + = kX. 10 26.4 k-left-transposable integers 915

From this, b · 10n + X − b =10kX, and (10k − 1)X = b(10n − 1).

Since X is has n digits, b(10n − 1) > (10k − 1)10n−1, and b> n−1 10 (10k−1) − 1 ≥ 10n−1 = k 10 . This shows that b k. kn 219X = b(10n − 1) 18m 329X = b(10n − 1) 28m 439X = b(10n − 1) 12m 549X = b(10n − 1) 42m 659X = b(10n − 1) 58m 769X = b(10n − 1) 22m 879X = b(10n − 1) 13m 989X = b(10n − 1) 44m These lead to the following numbers:

X(2) =105263157894736842, X(3) =1034482758620689655172413793, X(4) =102564102564, X(5) =102040816326530612244897959183673469387755, X(6) =10169491525423728813559322033898305084745762711864 40677966, X(7) =1014492753623188405797, X(8) =1012658227848, X(9) =10112359550561797752808988764044943820224719.

b · Each of these X(k)k can be replaced by k Xk for k = b,...,9. Every k-left-transposable number is of the form (X(k))m for X(k) given above and m ≥ 1. 916 Digit problems Chapter 27

The repunits

27.1 Recurring decimals

The decimal expansion of a rational number is eventually periodic. It is finite if and only if the denominator has no prime divisors other than 2 and 5. 1 The decimal expansion of n is purely periodic if and only if n is a prime. For p =3, this is the most well known recurring decimal

1 =0.333 ···=0.3. 3

with period length 1. Here are the periods of the reciprocals of the first few primes, together with their period lengths.

p period λ(p) 33 1 7 142857 6 11 09 2 13 076923 6 17 0588235294117647 16 19 052631578947368421 18 23 0434782608695652173913 22 29 0344827586206896551724137931 28 31 032258064516129 15 37 027 3 41 0243902439 10 43 023255813953488372093 21 47 0212765957446808510638297872340425531914893617 46 918 The repunits

27.2 The period length of a prime

The period length of a prime number p means the length of the shortest 1 repeating block of digits in the decimal expansion of p . 1 Suppose p has period length λ:

1 =0.a ···a . p 1 λ

Then moving the decimal places n places to the right, we have

10λ = a ···a .a ···a , p 1 λ 1 λ

and 10λ 1 − = a ···a p p 1 λ

is an integer. This means that p divides 10λ − 1. Clearly, p cannot be 2 or 5. It is known that if p =2 , 5, then 10p−1 − 1 is divisible by p, and any number λ for which 10λ − 1 is divisible by p divides p − 1.

Theorem 27.1. (a) If p =2 , 5, the period length of p is the smallest divisor λ of p − 1 such that p divides 10λ − 1. (b) Let p>5 be a prime. The period length of p is the smallest divisor n of p−1 such that p divides Rn.

n Proof. (b) Note that 10 − 1=9n =9× Rn.Ifp =3 , then p divides Rn.

We say that p is a primitive prime divisor the repunit Rn. Thus, for a prime p>5, the period length of p is the number n for which p is primitive prime divisor. A table of primitive prime divisors of repunits is given in an Appendix. Except for p =2, 5, the decimal expansion of the reciprocal of a prime p is purely periodic. The period is a divisor of p − 1. It is the smallest positive integer n for which p divides 10n − 1. 27.2 The period length of a prime 919

1 p p period length 20.50 30.31 50.20 7∗ 0.142857 6 11 0.09 2 13 0.076923 6 17∗ 0.0588235294117647 16 19 0.052631578947368421 18 23∗ 0.0434782608695652173913 22 29∗ 0.0344827586206896551724137931 28 31 0.032258064516129 15 37 0.027 3 41 0.02439 5 43 0.023255813953488372093 22 47∗ 0.0212765957446808510638297872340425531914893617 46

The only prime number with period 1 is p =3. On the other hand, there are many full period primes with period p − 1. Conjecture (E. Artin). There are infinitely many primes p with period p − 1.

1 27.2.1 Decimal expansions of pn

1 n−1 The decimal expansion of pn has period p times the period of p unless p =3or is a Wieferich prime for base 10 satisfying 10p−1 ≡ 1modp2. 1 The only known Wieferich prime for base 10 is p = 487. Both 487 1 and 4872 have period 486. 920 The repunits

Appendix: Factorizations of repunits Rn for n ≤ 50

nRn 211. 33× 37. 411× 101. 541× 271. 63× 7 × 11 × 13 × 37. 7239× 4649. 811× 73 × 101 × 137. 932 × 37 × 333667. 10 11 × 41 × 271 × 9091. 11 21649 × 513239. 12 3 × 7 × 11 × 13 × 37 × 101 × 9901. 13 53 × 79 × 265371653. 14 11 × 239 × 4649 × 909091. 15 3 × 31 × 37 × 41 × 271 × 2906161. 16 11 × 17 × 73 × 101 × 137 × 5882353. 17 2071723 × 5363222357. 18 32 × 7 × 11 × 13 × 19 × 37 × 52579 × 333667. 19 prime 20 11 × 41 × 101 × 271 × 3541 × 9091 × 27961. 21 3 × 37 × 43 × 239 × 1933 × 4649 × 10838689. 22 112 × 23 × 4093 × 8779 × 21649 × 513239. 23 prime 24 3 × 7 × 11 × 13 × 37 × 73 × 101 × 137 × 9901 × 99990001. 25 41 × 271 × 21401 × 25601 × 182521213001. 26 11 × 53 × 79 × 859 × 265371653 × 1058313049. 27 33 × 37 × 757 × 333667 × 440334654777631. 28 11 × 29 × 101 × 239 × 281 × 4649 × 909091 × 121499449. 29 3191 × 16763 × 43037 × 62003 × 77843839397. 30 3 × 7 × 11 × 13 × 31 × 37 × 41 × 211 × 241 × 271 × 2161 × 9091 × 2906161. 31 2791 × 6943319 × 57336415063790604359. 32 11 × 17 × 73 × 101 × 137 × 353 × 449 × 641 × 1409 × 69857 × 5882353. 33 3 × 37 × 67 × 21649 × 513239 × 1344628210313298373. 34 11 × 103 × 4013 × 2071723 × 5363222357 × 21993833369. 35 41 × 71 × 239 × 271 × 4649 × 123551 × 102598800232111471. 36 32 × 7 × 11 × 13 × 19 × 37 × 101 × 9901 × 52579 × 333667 × 999999000001. 37 2028119 × 247629013 × 2212394296770203368013. 38 11 × 909090909090909091 × R19. 39 3 × 37 × 53 × 79 × 265371653 × 900900900900990990990991. 40 11 × 41 × 73 × 101 × 137 × 271 × 3541 × 9091 × 27961 × 1676321 × 5964848081. 41 83 × 1231 × 538987 × 201763709900322803748657942361. 42 3 × 72 × 11 × 13 × 37 × 43 × 127 × 239 × 1933 × 2689 × 4649 × 459691 × 909091 × 10838689. 43 173 × 1527791 × 1963506722254397 × 2140992015395526641. 44 112 × 23 × 89 × 101 × 4093 × 8779 × 21649 × 513239 × 1052788969 × 1056689261. 45 32 × 31 × 37 × 41 × 271 × 238681 × 333667 × 2906161 × 4185502830133110721. 46 11 × 47 × 139 × 2531 × 549797184491917 × R23. 47 35121409 × 316362908763458525001406154038726382279. 48 3 × 7 × 11 × 13 × 17 × 37 × 73 × 101 × 137 × 9901 × 5882353 × 99990001 × 9999999900000001. 49 239 × 4649 × 505885997 × 1976730144598190963568023014679333. 50 11 × 41 × 251 × 271 × 5051 × 9091 × 21401 × 25601 × 182521213001 × 78875943472201. 27.2 The period length of a prime 921

Appendix: Primitive prime divisors of repunits

n Primitive prime divisors of Rn 211. 33, 37. 4 101. 541, 271. 67, 13. 7 239, 4649. 873, 137. 9 333667. 10 9091. 11 21649, 513239. 12 9901. 13 53, 79, 265371653. 14 909091. 15 31, 2906161. 16 17, 5882353. 17 2071723, 5363222357. 18 19, 52579. 19 1111111111111111111. 20 3541, 27961. 21 43, 1933, 10838689. 22 23, 4093, 8779. 23 11111111111111111111111. 24 99990001. 25 21401, 25601, 182521213001. 26 859, 1058313049. 27 757, 440334654777631. 28 29, 281, 121499449. 29 3191, 16763, 43037, 62003, 77843839397. 30 211, 241, 2161. 31 2791, 6943319, 57336415063790604359. 32 353, 449, 641, 1409, 69857. 33 67, 1344628210313298373. 34 103, 4013, 21993833369. 35 71, 123551, 102598800232111471. 36 999999000001. 37 2028119, 247629013, 2212394296770203368013. 38 909090909090909091. 39 900900900900990990990991. 40 1676321, 5964848081. 41 83, 1231, 538987, 201763709900322803748657942361. 42 127, 2689, 459691. 43 173, 1527791, 1963506722254397, 2140992015395526641. 44 89, 1052788969, 1056689261. 45 238681, 4185502830133110721. 46 47, 139, 2531, 549797184491917. 47 35121409, 316362908763458525001406154038726382279. 48 9999999900000001. 49 505885997, 1976730144598190963568023014679333. 50 251, 5051, 78875943472201. Chapter 28

Routh and Ceva theorems

28.1 A worked example on homogeneous barycentric coordinates

Given a triangle ABC, X, Y , Z are points on the side lines specified by the ratios of divisions BX : XC =2:1,CY: YA=5:3,AZ: ZB =3:2.

The lines AX, BY , CZ bound a triangle PQR. Suppose triangle ABC has area . Find the area of triangle PQR. A

3 3 Y

R Z 5 P 2 Q

B 2 X 1 C We make use of homogeneous barycentric coordinates with respect to ABC.

X =(0:1:2),Y=(5:0:3),Z=(2:3:0).

Those of P , Q, R can be worked out easily: 1002 Routh and Ceva theorems

P = BY ∩ CZ Q = CZ ∩ AX R = AX ∩ BY Y =(5:0:3) Z =(2:3:0) X =(0:1:2) Z =(2:3:0) X =(0:1:2) Y =(5:0:3) P = (10 : 15 : 6) Q =(2:3:6) R =(10:3:6) This means that the absolute barycentric coordinates of X, Y , Z are

1 1 1 = (10 +15 +6 ) = (2 +3 +6 ) = (10 +3 +6 ) P 31 A B C ,Q 11 A B C ,R 19 A B C .

The area of triangle PQR 10 15 6 1 · 576  = · · 236 = . 31 11 19 1036 6479

28.2 Routh theorem

A 1 ν Y R

Z µ 1 P Q

B λ X 1 C We make use of homogeneous barycentric coordinates with respect to ABC. X =(0:1:λ),Y=(µ :0:1),Z=(1:ν :0). Those of P , Q, R can be worked out easily: P = BY ∩ CZ Q = CZ ∩ AX R = AX ∩ BY Y =(µ :0:1) Z =(1:ν :0) X =(0:1:λ) Z =(1:ν :0) X =(0:1:λ) Y =(µ :0:1) P =(µ : µν :1) Q =(1:ν : νλ) R =(λµ :1:λ) This means that the absolute barycentric coordinates of X, Y , Z are 28.3 Ceva Theorem 1003

1 P = (µA + µνB + C), µν + µ +1 1 Q = (A + νB + νλC), νλ + ν +1 1 R = (λµA + B + λC). λµ + λ +1 From these,

µµν1 1 ννλ λµ 1 λ Area(PQR)= · (µν + µ +1)(νλ + ν +1)(λµ + λ +1) (λµν − 1)2 = ·. (µν + µ +1)(νλ + ν +1)(λµ + λ +1)

Exercise Calculate the area of triangle PQRgiven

1. λ = µ = ν =2.

2. λ =1, µ =7, ν =4;

3. λ =3, µ =7, ν =6.

28.3 Ceva Theorem

Theorem 28.1 (Ceva). Let X, Y , Z be points on the lines BC, CA, AB respectively. The lines AX, BY , CZ are concurrent if and only if BX CY AZ · · =1. XC YA ZB If this condition is satisfied, the homogeneous barycentric coordi- nates of the common point of AX, BY , CZ can be written down by combining the coordinates of X, Y , Z. 1004 Routh and Ceva theorems

A

1 1

Z Y

G 1 1

B 1 X 1 C Example: centroid If AX, BY , CZ are the medians, the intersection is the centroid G:

X = (0:1:1) Y = (1:0:1) Z = (1:1:0) G = (1:1:1)

Example: incenter If AX, BY , CZ are the angle bisectors, the intersection is the incenter I: A

c b

Y

Z I a a

B c X b C

X =(0:b : c) Y =(a :0:c) Z =(a : b :0) I =(a : b : c) Chapter 29

Equilateral triangle in a rectangle

29.1 Equilateral triangle inscribed in a rectangle

Given a rectangle ABCD, how can we choose a point P on BC and a point Q on CD such that triangle AP Q is equilateral?

a − x D x Q C

b − y b

P y

A a B

Suppose AB = DC = a, BC = AD = b, DQ = x, and BP = y. These satisfy

a2 + y2 = b2 + x2 =(a − x)2 +(b − y)2.

From these, 2(ax + by)=a2 + y2 = b2 + x2, and we have

(x2 − 2ax + b2)2 =4b2(b2 + x2) − 4a2b2. 1006 Equilateral triangle in a rectangle

This can be rewritten as (x2 + b2)((x2 + b2) − 4ax − 4b2)=0,

from which √ x =2a − 3b. √ Similarly, y =2b − 3a.

29.2 Construction of equilateral triangle inscribed in a rectangle

What is more interesting is that the above calculation leads to a very easy construction of the equilateral triangle AXY . Construction 29.1. Construct equilateral triangles BCY and CDX so that X and Y are in the interior of the rectangle. 1 Join AX to intersect BC at P and AY to intersect CD at Q. Then AXY is equilateral.

D Q C

Y N

X P

A M B

1 a This is not always possible. What is the range of the ratio b for X and Y to be in the interior of the rectangle? Chapter 30

The shoemaker’s knife

30.1 Archimedes’ twin circles

Let P be a point on a segment AB. The region bounded by the three semicircles (on the same side of AB) with diameters AB, AP and PBis called a shoemaker’s knife. Suppose the smaller semicircles have radii a and b respectively. Let Q be the intersection of the largest semicircle with the perpendicular through P to AB. This perpendicular is an internal common tangent of the smaller semicircles.

Q

H U R V K

A O1 O P O2 B A O1 O P O2 B

Theorem 30.1 (Archimedes). The two circles each tangent to CP, the largest semicircle AB and one of the smaller semicircles have equal ab radii t, given by t = a+b .

Q

A O1 O P O2 B A O1 O P O2 B 1008 The shoemaker’s knife

30.2 Incircle of the shoemaker’s knife

30.2.1 Archimedes’ construction

Theorem 30.2 (Archimedes). The circle tangent to each of the three semicircles has radius given by

ab(a + b) ρ = . a2 + ab + b2

C

X

Y

A O1 O P O2 B

Construction

Z

G H Y X

ABG C H 30.2 Incircle of the shoemaker’s knife 1009

30.2.2 Bankoff’s constructions Theorem 30.3 (Leon Bankoff). If the incircle C(ρ) of the shoemaker’s knife touches the smaller semicircles at X and Y , then the circle through the points P , X, Y has the same radius as the Archimedean circles.

Z

C

X

Y

A O1 O P O2 B Proof. The circle through P , X, Y is clearly the incircle of the triangle CO1O2, since

CX = CY = ρ, O1X = O1P = a, O2Y = O2P = b.

The semiperimeter of the triangle CO1O2 is ab(a + b) (a + b)3 a + b + ρ =(a + b)+ = . a2 + ab + b2 a2 + ab + b2 The inradius of the triangle is given by abρ ab · ab(a + b) ab = = . a + b + ρ (a + b)3 a + b This is the same as t, the common radius of Archimedes’ twin circles.

First construction

Z

C Q1

X Q2

C3 Y

A O1 O P O2 B 1010 The shoemaker’s knife

Second construction

Z

Q P Y X

ABC

30.2.3 Woo’s three constructions

Z Z

Y X Q AB C P Y S X

ABC M

Z

Y X

ABC

30.3 More Archimedean circles

Let UV be the external common tangent of the semicircles O1(a) and O2(b), which extends to a chord HK of the semicircle O(a + b). Let C4 30.3 More Archimedean circles 1011

be the intersection of O1V and O2U. Since

O1U = a, O2V = b, and O1P : PO2 = a : b,

ab C4P = a+b = t. This means that the circle C4(t) passes through P and touches the common tangent HK of the semicircles at N.

C5 H U M N V

K

C4

A O1 O P O2 B Let M be the midpoint of the chord HK. Since O and P are sym- metric (isotomic conjugates) with respect to O1O2,

OM + PN = O1U + O2V = a + b. it follows that (a + b) − QM = PN =2t. From this, the circle tangent to HK and the minor arc HK of O(a + b) has radius t. This circle touches the minor arc at the point Q. Theorem 30.4 (Thomas Schoch). The incircle of the curvilinear triangle bounded by the semicircle O(a+b) and the circles A(2a) and B(2b) has ab radius t = a+b .

S

A O1 O P O2 B Proof. Denote this circle by S(x). Note that SO is a median of the triangle SO1O2. By Apollonius theorem, (2a + x)2 +(2b + x)2 =2[(a + b)2 +(a + b − x)2].

ab From this, x = a+b = t. Chapter 31

Permutations

31.1 The universal sequence of permutations

For convenient programming we seek an enumeration of the permuta- tions. Regard each permutation of 1, 2, . . . n as a bijection π : N /N which is “eventually” constant, i.e., f(m)=m for m>n. The enu- meration begins with the identity permutation. The permutations of 1, 2, ...n are among the first n! of them, and each of the first (n − 1)! permutations ends with n. Given an integer m, we write

m − 1=r2 × 1! + r3 × 2! + ···+ rk × (k − 1)!

for 0 ≤ ri

qi−1 = i × qi + ri.

In other words, qi−1 (q ,r)= , mod(q − ,i) . i i i i 1 Along with these, we construct a sequence of lists which ends at the desired permutation. Let L1 =(1).Fori ≥ 2, form Li by inserting i into Li−1 so that there are exactly ri members smaller than i on its right hand side. Then Lk is the permutation corresponding to m. 1102 Permutations

Example To find the 12345th permutation, we write 12344 = 0 × 1! + 1 × 2! + 1 × 3! + 4 × 4! + 0 × 5! + 3 × 6! + 2 × 7!. The corresponding sequences are

k Lk 1 (1) 2 (1, 2) 3 (1, 3, 2) 4 (1, 3, 4, 2) 5 (5, 1, 3, 4, 2) 6 (5, 1, 3, 4, 2, 6) 7 (5, 1, 3, 7, 4, 2, 6) 8 (5, 1, 3, 7, 4, 8, 2, 6) The permutation is (5,1,3,7,4,8,2,6).

31.2 The position of a permutation in the universal se- quence

Given a permutation Ln, we want to determine its position in the enu- meration scheme above. For j = n, n − 1,...,2, let (i) rj be the number of elements in Lj on the right hand side of j, (ii) Lj−1 be the sequence Lj with j deleted. Then, the position number of the permutation Ln is

1+r2 × 1! + r3 × 2! + ···+ rn × (n − 1)!. This number can be computed recursively as follows.

sn =rn,

sn−1 =sn × (n − 1) + rk−1, . .

sj−1 =sj × (j − 1) + rj−1, . .

s2 =s2 × 2+r2,

s1 =s2 × 1+1. 31.2 The position of a permutation in the universal sequence 1103

Example Consider the permutation L =(1, 4, 6, 2, 3, 7, 9, 8, 5).

jLj rj sj 9(1, 4, 6, 2, 3, 7, 9, 8, 5) 2 2 8(1, 4, 6, 2, 3, 7, 8, 5) 1 17 7(1, 4, 6, 2, 3, 7, 5) 1 120 6(1, 4, 6, 2, 3, 5) 3 723 5(1, 4, 2, 3, 5) 0 3615 4(1, 4, 2, 3) 2 14462 3(1, 2, 3) 0 43386 2(1, 2) 0 86772 1 (1) 1 86773

This permutation appears as the 86773-th in the universal sequence. 1104 Permutations Chapter 32

Cycle decompositions

32.1 The disjoint cycle decomposition of a permutation

Theorem 32.1. Every permutation can be decomposed into a product of disjoint cycles. For example, the permutation 123456 7 8 9 XJQK 698342K 7 Q 51JX

decomposes into the two disjoint cycles (1629QJ)(387KX54). Theorem 32.2. Every cycle decomposes into a product of transpositions. Theorem 32.3. A permutation can be decomposed into a product of transpositions. The parity (of the number of transpositions) of the per- mutation is independent of the decomposition. Thus, permutations are classified into even and odd permutations. Even (respectively odd) permutations are said to have parity +1 (respec- tively −1). Corollary 32.4. A cycle of length k has parity (−1)k−1. More generally, a permutation of n objects has parity (−1)n− number of disjoint cycles in a decomposition. In using this formula, the fixed points are counted as 1-cycles, though we usually do not write them in the cycle decomposition of a permuta- tion. 1106 Cycle decompositions

32.2 Dudeney’s puzzle

Take nine counters numbered 1 to 9, and place them in a row in the natural order. It is required in as few exchanges of pairs as possible to convert this into a square number. As an example in six moves we give the following: (7846932), which give the number 139854276, which is the square of 11826. But it can be done in much fewer moves. 1

The square of 12543 can be found in four moves, as follows. 123456789 (25) 153426789 (37) 157426389 (38) 157426839 (34) 157326849

The squares of 25572, 26733, and 27273 can also be obtained in four moves. • 123456789

653927184

• 123456789

714653289

• 123456789

743816529

1Puzzle 128 of [Dudeney] 32.3 Dudeney’s Canterbury puzzle 3 1107

However, there is one, namely, 523814769, which can be made in three moves.

123456789

32.3 Dudeney’s Canterbury puzzle 3

7 × 2 8 = 1 9 6 = 3 4 × 5 .

While 7 × 28 = 196, it is not true that 34 × 5 = 196. Move as few

counters as possible to make the equations valid. 2

. to 4 39 = 156 = 78 2 (27)(495)

× 2 × 1108 Cycle decompositions Chapter 33

More card Games

33.1 Perfect shuffles

Consider a deck of an even number of cards, say, 2n. Separates the top half (of n cards) from the bottom half, and perfectly interlaces them. It is called the out-shuffle if the top and bottom cards remain respectively on top and in bottom. Otherwise it is called the in-shuffle. These are called perfect shuffles.

1 2 3 4

5 6 7 8

Figure 33.1: The out-shuffle ω8

More generally, the out-shuffle on 2n cards is the permutation

ω2n =(1,n+1, 2,n+2, ..., n− 1, 2n − 1,n,2n). While it demands great skill to actually do an out-faro shuffle, we achieve this in the following leisurely way. Align the two halves of cards in two rows and n columns, the first half in the top row, and the second half in the bottom row. Collect the cards along the columns, from top to bottom, then left to right. This gives the out-shuffle ω2n. If you want to do the in-shuffle, put the first half in the bottom row and the second half in the top row instead. 1110 More card Games

5 6 7 8

1 2 3 4

Figure 33.2: The in-shuffle ρ8

ρ2n =(n +1, 1,n+2, 2, ..., 2n − 1,n− 1, 2n, n).

33.1.1 In-shuffles Where is the first card after a number of perfect shuffles? We do this by working out formulas for ω2n(k) and ρ2n(k). It is easier with in-shuffles. If k is an even number, then ρ(k) is simply k k−1 2 . If, k is odd, then we add n +1to 2 . In terms of binary representations of numbers, this can be described as follows: drop the rightmost digit, and add n if this deleted digit is 1. Let verify this rule with two examples.

Examples (1) Take a complete suit of spade put an extra heart at the end to form a row of 14 cards. What are the positions of the heart under repeated in-shuffles? Here, 2n =14and n + 1 = 8 = 10002. We consider every number ≤ 14 with 4 binary digits. In this case, ρ14 is simply transferring the rightmost binary digit of k to the leftmost positions. This is why after 4 in-shuffles, every card is restored. This applies to any n which is one less than a power of 2: if the number of cards is 2 less than a power of 2, after an in-shuffle, the card in position k has number obtained by transferring the rightmost binary digit of k to the leftmost. Example:

ρ14(7) = ρ14(01112) = 10112 =11. 33.1 Perfect shuffles 1111

Where does card 18 go after 3 in-shuffles of 30 cards? Here, we work with 5 binary digits, and keep track of this by transferring the leftmost binary digit to the rightmost:

−3 −3 −2 −1 ρ (18) = ρ (100102)=ρ (001012)=ρ (010102) = 101002 =20.

(2) For an ordinary deck of 52 cards, n + 1 = 27 = 110112. What is the 11-th card after 4 in-shuffles? Note that 11 = 10112.

4 3 3 ρ (10112)=ρ (110112 + 10112)=ρ (1000002) 2 =ρ (100002)

=ρ(10002)

=1002 This is 4. In the natural order, this is ♣4. The positions of a particular card under repeated in-shuffles has an easy description in terms of congruences. 2k, if k ≤ n, ρ−1(k)= 2n 2k − 2n − 1, if k>n, or we simply say

−1 ρ2n (k)=2k mod (2n +1).

This means that ρ2n can be obtained by dividing by 2 modulo 2n+1.If is the smallest positive integer with 2 ≡ 1mod2n+1, then  in-shuffles restore every card in their original positions.

33.1.2 Out-shuffles

For the out-shuffle ω2n,wehave 2k − 1ifk ≤ n, ω−1(k)= 2n 2(k − n)ifk>n,

or simply −1 − − ω2n (k)=2k 1mod(2n 1). 1112 More card Games

How do we describe ω2n directly? k+1 If k is odd, ω2n(k) is 2 .Ifk is even, ω2n(k) is obtained by adding k n to 2 . This can be described in terms of binary digits as follows. ω2n(k) is found by deleting the rightmost binary digit from k, and to the resulting number add this digit if it is nonzero, otherwise, add n. Example 33.1. Take an ordinary deck of 2n =52cards and out-shuffle 3 times. Where does card 13 appear −3 ≡ −2 ≡ −1 ≡ −1 − ≡− ≡ ω52 (13) ω52 (25) ω52 (49) ω52 ( 2) 5 46 mod 51.

On the other hand, what is the 13th card after 3 out-shuffles? With n = 26 = 110102,wehave

3 2 ω52(11012)=ω (1112) =ω(1002)

=110102 +102

=111002 =28.

If the orignal order is natural, then this is ♥2. 33.2 Monge’s shuffle 1113

33.2 Monge’s shuffle

The Monge shuffle of n cards puts card 2 above 1, card 3 beneath the pair, card 4 above the three, card 5 below the four, and proceed by putting a card alternatively above and below the pile that precedes it. We denote the Monge shuffle of n cards by µn.

2 4 1 6 3 8 5 7

Figure 33.3: The Monge shuffle µ8

In practice, we put the cards in a line, and move successively every second card to the leftmost position. To write down the permutation, we simply write the even numbers in descending order, followed by the odd numbers in ascending order. Thus,

µ2k =(2k, 2k − 2,...,4, 2, 1, 3,...,2k − 3, 2k − 1), and

µ2k+1 =(2k, 2k − 2,...,4, 2, 1, 3,...,2k − 3, 2k − 1, 2k +1). Chapter 34

Figurate numbers

34.1 Triangular numbers

··· 1 The nth triangular number is Tn =1+2+3+ + n = 2 n(n +1). The first few of these are 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ....

34.1.1 Palindromic triangular numbers

nTn nTn nTn 11 109 5995 3185 5073705 23 132 8778 3369 5676765 36 173 15051 3548 6295926 10 55 363 66066 8382 35133153 11 66 1111 617716 11088 61477416 18 171 1287 828828 18906 178727871 34 595 1593 1269621 57166 1634004361 36 666 1833 1680861 102849 5289009825 77 3003 2662 3544453 111111 6172882716 1202 Figurate numbers

34.2 Pentagonal numbers

The pentagonal numbers are the sums of the arithmetic progression 1+4+7+···+(3n − 2) + ··· 1 − The nth pentagonal number is Pn = 2 n(3n 1).

34.2.1 Palindromic pentagonal numbers

nPn nPn nPn 11 101 12521 6010 54177145 25 693 720027 26466 1050660501 4222173 7081807 26906 1085885801 26 1001 2229 7451547 31926 1528888251 44 2882 4228 26811862 44059 2911771192

34.3 The polygonal numbers Pk,n

More generally, for a fixed k, the k-gonal numbers are the sums of the arithmetic progression 1+(k − 1) + (2k − 3) + ···. The nth k-gonal 1 − − − number is Pk,n = 2 n((k 2)n (k 4)). 34.4 Sums of powers of consecutive integes 1203

34.4 Sums of powers of consecutive integes

Consider the sum of the k-powers of the first natural numbers:

k k k Sk(n):=1 +2 + ···+ n .

Theorem 34.1 (Bernoulli). Sk(n) is a polynomial in n of degree k +1 without constant term. It can be obtained recursively as

Sk+1(n)= (k +1)Sk(n)dn + cn,

where c is determined by the condition that the sum of the coefficients is 1.

Examples

1 (1) S2(n)= 6 n(n + 1)(2n +1). 3 3 ··· 3 1 2 2 (2) S3(n)=1 +2 + + n = 4 n (n +1) . 4 3 2 (3) Since 4S3(n)=n +2n + n ,wehave 1 1 1 S (n)= n5 + n4 + n3 + cn, 4 5 2 3 − 1 1 1 −1 where c =1 5 + 2 + 3 = 30 . Therefore, 1 1 1 1 14 +24 + ···+ n4 = n5 + n4 + n3 − n. 5 2 3 30 1204 Figurate numbers Chapter 35

Sums of consecutive squares

35.1 The odd number case

Suppose the sum of the squares of 2k +1consecutive positive integers is a square. If the integers are b, b ± 1,...,b± k. We require 1 (2k +1)b2 + k(k + 1)(2k +1)=a2 3 for an integer a. From this we obtain the equation 1 a2 − (2k +1)b2 = k(k + 1)(2k +1). (E ) 3 k

1. Suppose 2k +1is a square. Show that (Ek) has solution only when k =6m(m + ) for some integers m>1, and = ±1. In each case, the number of solutions is finite.

Number of solutions of (Ek) when 2k +1is a square 2k + 1 25 49 121 169 289 361 529 625 841 961 ... 01127353310... 2. Find the unique sequence of 49 (respectively 121) consecutive pos- itive integers whose squares sum to a square. 1206 Sums of consecutive squares

3. Find the two sequences of 169 consecutive squares whose sums are squares.

4. Suppose 2k +1is not a square. If k +1is divisible 9=32 or by any prime of the form 4k +3≥ 7, then the equation (Ek) has no solution. Verify that for the following values of k<50, the equation (Ek) has no solution:

k =6, 8, 10, 13, 17, 18, 20, 21, 22, 26, 27, 30, 32, 34, 35, 37, 40, 41, 42, 44, 45, 46, 48,... − 1 3 k(k+1) 5. Suppose p =2k+1 is a prime. If the Legendre symbol p = −1, then the equation (Ek) has no solution. Verify that for the fol- lowing values of k<50, the equation (Ek) has no solution:

1, 2, 3, 8, 9, 14, 15, 20, 21, 26, 33, 39, 44.

6. For k ≤ 50, it remains to consider (Ek) for the following values of k: 5, 7, 11, 16, 19, 23, 25, 28, 29, 31, 36, 38, 43, 47, 49.

Among these, only for k =5, 11, 16, 23, 29 are the equations (Ek) solvable.

7. Work out 5 sequences of 23 consecutive integers whose squares add up to a square in each case. Answer:

72 +82 + ···+292 =922; 8812 + 8822 + ···+ 9032 = 42782; 427872 + 427882 + ···+ 428092 = 2052522; 20534012 + 20534022 + ···+ 20534232 = 98478182; ········· 35.2 The even number case 1207

2 2 8. Consider the equation (E36): u −73v =12·37·73. This equation does in fact have solutions (u, v) = (4088, 478), (23360, 2734). The fundamental solution of the Pell equation x2 − 73y2 =1being (a, b) = (2281249, 267000), we obtain two sequences of solutions of (E73): Answer:

(4088, 478), (18642443912, 2181933022), (85056113063608088, 9955065049008478),... (23360, 2734), (106578370640, 12474054766), (486263602888235360, 56912849921762734),...

This means, for example, the sum of the squares of the 73 numbers with center 478 (respectively 2734) is equal to the square of 4088 (respectively 23360).

35.2 The even number case

Suppose the sum of the squares of the 2k consecutive numbers b − k +1,b− k +2,...,b,...,b+ k − 1,b+ k, is equal to a2. This means 2k (2a)2 − 2k(2b +1)2 = (4k2 − 1). (E ) 3 k Note that the numbers 2k, 4k2 − 1 are relatively prime.

 1. Show that the equation (Ek) has no solution if 2k is a square. 2. Suppose 2k is not a square. Show that if 2k +1is divisible by 9,  or by any prime of the form 4k +1, then the equation (Ek) has no solution. ≤  3. For k 50, the equation (Ek) has no solution for the following values of k: k =3, 4, 5, 9, 11, 13, 15, 17, 21, 23, 24, 27, 29, 31, 33, 35, 38, 39, 40, 41, 45, 47, 49.

 4. Let k be a prime. The equation (Ek) can be written as 4k2 − 1 (2b +1)2 − 2ky2 = − . 3 1208 Sums of consecutive squares

 By considering Legendre symbols, the equation (Ek) has no solu- tion for the following values of k ≤ 50: k =5, 7, 17, 19, 29, 31, 41, 43.

 5. Excluding square values of 2k<100, the equation (Ek) has solu- tions only for k =1, 12, 37, 44.

6. Show that (34, 0), (38, 3), (50, 7) are solutions of (E”12). Construct from them three infinite sequences of expressions of the sum of 24 consecutive squares as a square.

 7. The equation (E37) has solutions (185, 2), (2257,261), and (2849, 330). From these we construct three infinite sequences of expres- sions of the sum of 74 consecutive squares as a square. Answer: 2252 + 2262 + ···+ 2982 = 22572; 2942 + 2952 + ···+ 3672 = 28492; 130962 + 130972 + ···+ 131792 = 7638652.

 8. The equation (E44) has solutions (242, 4) and (2222,235). From these we obtain two infinite sequences of expressions of the sum of 88 consecutive squares as a square. 1922 + 1932 + ···+ 2792 = 22222; 59252 + 59262 + ···60122 = 559902. Chapter 36

Polygonal triples

We consider polygonal numbers of a fixed shape. For a given positive integer k, the sequence of k-gonal numbers consists of the integers 1 P := (k − 2)n2 − (k − 4)n . (36.1) k,n 2 By a k-gonal triple, we mean a triple of positive integers (a, b, c) satis- fying Pk,a + Pk,b = Pk,c. (36.2) A 4-gonal triple is simply a Pythagorean triple satisfying a2 + b2 = c2. We shall assume that k =4 . By completing squares, we rewrite (36.2) as (2(k − 2)a − (k − 4))2 +(2(k − 2)b − (k − 4))2 =(2(k − 2)c − (k − 4))2 +(k − 4)2, (36.3) and note, by dividing throughout by (k − 4)2, that this determines a rational point on the surface S: x2 + y2 = z2 +1, (36.4) namely, P (k; a, b, c):=(ga − 1,gb− 1,gc− 1), (36.5) 2(k−2) where g = k−4 . This is always an integer point for k =3, 5, 6, 8, with corresponding g = −2, 6, 4, 3.Fork =3(triangular numbers), we shall change signs, and consider instead the point P (3; a, b, c):=(2a +1, 2b +1, 2c +1). (36.6) The coordinates of P (3; a, b, c) are all odd integers exceeding 1. 1210 Polygonal triples

36.1 Double ruling of S

The surface S, being the surface of revolution of a rectangular hyperbola about its conjugate axis, is a rectangular hyperboloid of one sheet. It has a double ruling, i.e., through each point on the surface, there are two straight lines lying entirely on the surface.

Figure 36.1:

Let P (x0,y0,z0) be a point on the surface S. A line  through P with direction numbers p : q : r has parametrization

 : x = x0 + pt, y = y0 + qt, z = z0 + rt. Substitution of these expressions into (36.4) shows that the line  is entirely contained in the surface S if and only if

px0 + qy0 = rz0, (36.7) p2 + q2 = r2. (36.8) It follows that 2 2 2 2 − 2 r = r (x0 + y0 z0 ) 2 2 2 − 2 = r (x0 + y0) (px0 + qy0) 2 2 2 2 − 2 =(p + q )(x0 + y0) (px0 + qy0) 2 =(qx0 − py0) . This means qx0 − py0 = r, = ±1. (36.9) Solving equations (36.7) and (36.9), we determine the direction numbers of the line. We summarize this in the following proposition. 36.2 Primitive Pythagorean triple associated with a k-gonal triple 1211

Proposition 36.1. The two lines lying entirely on the hyperboloid S : 2 2 2 x + y = z +1and passing through P (x0,y0,z0) have direction num- bers − 2 2 x0z0 y0 : y0z0 + x0 : x0 + y0 for = ±1. In particular, if P is a rational point, these direction numbers are ra- tional.

36.2 Primitive Pythagorean triple associated with a k- gonal triple

Let P be the rational point determined by a k-gonal triple (a, b, c),as given by (36.5), for k ≥ 5 and (36.6) for k =3(triangular numbers). We first note that the coordinates of P all exceed 1. This is clear for ≥ 2(k−2) k =3, and for k 5, it follows from the fact that g = k−4 > 2. The direction numbers of the ruling lines on S through the point P ,as given in Proposition 1, are all positive. In view of (36.8), we may there- fore choose a primitive Pythagorean triple (p, q, r) for these direction numbers. As is well known, every such triple is given by p = m2 − n2,q=2mn, r = m2 + n2 (36.10) for relatively prime integers m>nof different parity. We study the converse question of determining k-gonal triples from (primitive) Pythagorean triples.

36.3 Triples of triangular numbers

Given a primitive Pythagorean triple (p, q, r) as in (36.10), we want to determine a triangular triple (a, b, c) corresponding to it. Given an odd integer z0 > 1, we obtain, from (36.7) and (36.9), pz + q qz − p x = 0 ,y= 0 . (36.11) 0 r 0 r

We claim that it is possible to choose z0 > 1 so that x0 and y0 are also odd integers > 1. By the euclidean algorithm, there are odd integers u and v such that qu + rv =1. (Note that v must be odd, since q is even. If u is even, we 1212 Polygonal triples replace (u, v) by (u − r, v + q), in which both entries are odd). Clearly, the integer z0 = pu is such that qz0 − p = p(qu − 1) is divisible by r. This makes y0 an integer. The corresponding x0 is also an integer. Replacing z0 by z0 + rt for a positive integer t if necessary, the integers z0, x0, and y0 can be chosen greater than 1. From (36.11), the integers x0 and y0 are both odd, since p and q are of different parity and z0 is odd. We summarize this in the following theorem. Theorem 36.2. Let (p, q, r) be a primitive Pythagorean triple. There are two infinite families of triangular triples (a(t),b(t),c(t)), = ±1,  such that one of the lines (P ), P = P (3; a(t),b(t),c(t)), has direc- tion numbers p : q : r.

Triangular triples from primitive Pythagorean triples

(m, n) (p, q, r) (a+(0),b+(0),c+(0)) (a−(0),b−(0),c−(0)) (2, 1) (3, 4, 5) (2, 2, 3) (3, 5, 6) (4, 1) (15, 8, 17) (9, 4, 10) (5, 3, 6) (3, 2) (5, 12, 13) (4, 9, 10) (5, 14, 15) (6, 1) (35, 12, 37) (20, 6, 21) (14, 5, 15) (5, 2) (21, 20, 29) (6, 5, 8) (14, 14, 20) (4, 3) (7, 24, 25) (6, 20, 21) (7, 27, 28) (8, 1) (63, 16, 65) (35, 8, 36) (27, 7, 28) (7, 2) (45, 28, 53) (35, 21, 41) (9, 6, 11) (5, 4) (9, 40, 41) (8, 35, 36) (9, 44, 45)

36.4 k-gonal triples determined by a Pythagorean triple

Now, we consider k ≥ 5. We shall adopt the notation  h if h is odd, h := h 2 if h is even, for an integer h. ≥ 2(k−4) Theorem 36.3. Let k 5 and g = k−2 . The primitive Pythagorean triple (p, q, r) defined in (36.10) by relatively prime integers m>nwith 2n different parity corresponds to a k-gonal triple if and only if one of g 2(m−n) and g is an integer. Since m and n are relatively prime, the integer (k − 2) > 1 cannot divide both n and m − n. This means that a primitive Pythagorean triple 36.4 k-gonal triples determined by a Pythagorean triple 1213

(p, q, r) corresponds to at most one line on S associated with k-gonal triples (for k ≥ 5). Indeed, if k =4h +2, (k − 2) is the even number 2h, and cannot divide the odd integer m−n. It follows that only those pairs (m, n), with n a multiple of 2h give (4h +2)-gonal pairs. For example, by choosing m =2h +1, n =2h,wehave p =4h +1,q=8h2 +4h, r =8h2 +4h +1, 2 2 a0 =4h +1,b0 =8h +2h +1,c0 =8h +2h +2.

These give an infinite family of (4h +2)-gonal triples:

at =(4h +1)(t +1), 2 2 bt =8h +2h +1+(8h +4h)t, 2 2 ct =8h +2h +2+(8h +4h +1)t.

(4h +2)− gonal triples

(h, k, g) (m, n) (p, q, r) (a, b, c) (1, 6, 4) (3, 2) (5, 12, 13) (5, 11, 12) (5, 2) (21, 20, 29) (14, 13, 19) (5, 4) (9, 40, 41) (9, 38, 39) (7, 2) (45, 28, 53) (18, 11, 21) (7, 4) (33, 56, 65) (11, 18, 21) (7, 6) (13, 84, 85) (13, 81, 82) (9, 2) (77, 36, 85) (11, 5, 12) (9, 4) (65, 72, 97) (13, 14, 19) (9, 8) (17, 144, 145) (17, 140, 141) (11, 2) (117, 44, 125) (104, 39, 111) (11, 4) (105, 88, 137) (60, 50, 78) (11, 6) (85, 132, 157) (68, 105, 125) (11, 8) (57, 176, 185) (38, 116, 122) (11, 10) (21, 220, 221) (21, 215, 216) (2 10 8 ) (5 4) (9 40 41) (9 37 38) , , 3 , , , , , (7, 4) (33, 56, 65) (33, 55, 64) (9, 4) (65, 72, 97) (52, 57, 77) (9, 8) (17, 144, 145) (17, 138, 139) (11, 4) (105, 88, 137) (90, 75, 117) (11, 8) (57, 176, 185) (57, 174, 183) (3 14 12 ) (7 6) (13 84 85) (13 79 80) , , 5 , , , , , (11, 6) (85, 132, 157) (85, 131, 156) 1214 Polygonal triples

36.5 Correspondence between (2h +1)-gonal and 4h- gonal triples

Let k1

k1 =2h +1,k2 =4h, for some h ≥ 2. (36.12)

   In this case, (k1 − 2) =(k2 − 2) =2h − 1, while (k1 − 4) =2h − 3,  and (k2 −4) =2h−2. The (2h+1)-gonal triple (a, b, c) and a 4h-gonal triple (a,b,c) are related by n (m − n)(c − c) ≡ (mod m2 + n2). 2h − 1

(2h +1)− gonal and 4h − gonal triples

(2h +1)− gonal 4h − gonal (h, 2h +1, 4h) (m, n) (p, q, r) (a, b, c) (a,b,c) (2, 5, 8) (4, 1) (15, 8, 17) (7, 4, 8) (14, 8, 16) (4, 3) (7, 24, 25) (7, 23, 24) (7, 22, 23) (5, 2) (21, 20, 29) (5, 5, 7) (10, 10, 14) (7, 4) (33, 56, 65) (4, 7, 8) (8, 14, 16) (7, 6) (13, 84, 85) (13, 82, 83) (13, 80, 81) (8, 3) (55, 48, 73) (22, 19, 29) (44, 38, 58) (8, 5) (39, 80, 89) (35, 72, 80) (31, 64, 71) (10, 1) (99, 20, 101) (48, 10, 49) (96, 20, 98) (10, 3) (91, 60, 109) (26, 17, 31) (52, 34, 62) (10, 7) (51, 140, 149) (40, 110, 117) (29, 80, 85) (10, 9) (19, 180, 181) (19, 177, 178) (19, 174, 175) (3, 7, 12) (6, 1) (35, 12, 37) (16, 6, 17) (33, 12, 35) (6, 5) (11, 60, 61) (11, 57, 58) (11, 56, 57) (7, 2) (45, 28, 53) (33, 21, 39) (44, 28, 52) (8, 3) (55, 48, 73) (27, 24, 36) (36, 32, 48) (8, 5) (39, 80, 89) (39, 79, 88) (26, 52, 58) (9, 4) (65, 72, 97) (24, 27, 36) (32, 36, 48) (4, 9, 16) (8, 1) (63, 16, 65) (29, 8, 30) (60, 16, 62) (8, 7) (15, 112, 113) (15, 107, 108) (15, 106, 107) (9, 2) (77, 36, 85) (18, 9, 20) (37, 18, 41) (10, 3) (91, 60, 109) (75, 50, 90) (90, 60, 108) (10, 7) (51, 140, 149) (17, 45, 48) (51, 138, 147) (5, 11, 20) (10, 1) (99, 20, 101) (46, 10, 47) (95, 20, 97) (10, 9) (19, 180, 181) (19, 173, 174) (19, 172, 173)