When is the area of a triangle whose side lengths are consecutive integers also an integer?

Consider a triangle with side lengths 3, 4, and 5. By Heron's formula, its area is $\sqrt{6(6 - 5)(6-4)(6 - 3)} = \sqrt{6(1)(2)(3)} = \sqrt{36} = 6$. Are there any other triangles like this?

-
Why was this question closed? Although it was about finding Heronian triangles, it was about a specific subset of those triangles, with consecutive integer sides. This has considerably different implications from simply finding all triangles with integer sides and area. – Lee Sleek May 29 '13 at 22:45

Because of a liking for symmetry, we let the sides be $y-1$, $y$, and $y+1$. Using the Heron Formula, we find, exactly like you did, that $\frac{3}{16}y^2(y^2-4)$ should be a perfect square. Thus $y$ must be even, say $y=2s$. So we want $3(s^2-1)$ to be a perfect square, say $(3t)^2$. We arrive at the equation $$s^2-3t^2=1,$$ an instance of a Pell Equation.

In this case, the equation has the fundamental solution $s_1=2$, $t_1=1$. By general theory of the Pell equation, the positive solutions $(s,t)$ are given by $$s=\frac{(2+\sqrt{3})^n+(2-\sqrt{3})^n}{2},\qquad t=\frac{(2+\sqrt{3})^n-(2-\sqrt{3})^n}{2},$$ where $n$ ranges over the positive integers.

In our case we are primarily interested in $s$. Let $s_0=1$ and $s_1=2$. Define $s_n$ by the recurrence $$s_{n+2}=4s_{n+1}-s_n.$$ For suitable $t_n$, $(s_n,t_n)$ ranges over the positive solutions of the Pell equation. For example, $s_2=7$, giving $y=14$. This is your $x=13$. Continuing, we get $s_3=26$, and $s_4=97$. These give your computed values. There are infinitely many others.

Remark: The Pell equation is dealt with in most introductions to number theory. There is also a very nice book on the equation, by Ed Barbeau.

-
For clarity, the actual formula that generates the solutions as $f(x) = (2 + \sqrt{3})^x + (2 - \sqrt{3})^x - 1$. – Lee Sleek May 29 '13 at 18:41
The first 10 values are $3, 13, 51, 193, 723, 2701, 10083, 37633, 140451, 524173$. – Lee Sleek May 29 '13 at 18:51
@LeeSleek: Yes, I only gave explicit formula for the $s_n$. We have $y_n=2s_n$, and therefore we get $x_n=\dots$. Note that we can replace $(2+\sqrt{3})^n +(2-\sqrt{3})^n$ by $\lceil (2+\sqrt{3})^n\rceil$ (here I am ussing the ceiling function). By the way, the recurrence is computationally more tractable, can use exact integer arithmetic instead of relying on approximations to square roots. – André Nicolas May 29 '13 at 18:53

The general formula for the area of a triangle whose side lengths are consecutive integers can be derived as follows: let x equal the length of the smallest side. The other two sides are then x + 1 and x + 2, and s (half the sum of the sides) is $\frac{3x + 3}{2}$. Subtracting each of the three sides from s and multiplying out gives

$$\sqrt{\frac{(3x + 3)(x + 3)(x - 1)(x + 1)}{16}} = \frac{\sqrt{3(x+3)(x-1)(x+1)^2}}{4}.$$

As we are adding and subtracting only odd numbers in this expression, only odd numbers can possibly give an even number (i.e. divisible by 4) under the radical, and therefore only odd x can yield an integer.

Continuing on this line of reasoning, $(x + 1)^2$ will always be a square no matter what x is. Additionally, since it will always be even (i.e. divisible by 2 at the very least), squaring it will always give a number divisible by 4 (eliminating any risk that we will get a perfect square in the numerator that is not divisible by 4) This means that the other three factors determine the nature of the triangle's area. Obviously, they must be a square for the radical to yield an integer. So we can conclude:

Given a triangle whose side lengths are consecutive integers, in which x is the length of the shortest side, the area will be an integer only if x is odd and $3(x+3)(x-1)$ is a perfect square.

Having tried nearly every odd number under 200, I have found only four such triangles, with side lengths 3 (area 6), 13 (area 84), 51 (area 1170), and 193 (area 16296). It would still be good to know if there is something else that can generate these numbers.

-
Good analysis. Continuation leads to the Pell equation $u^2-3v^2=1$, which has infinitely many solutions, that can be generated in a systematic way. One can produce a recurrence that generates all solutions, and even find an explicit "closed form" formula. The solutions grow quite rapidly. – André Nicolas May 29 '13 at 17:29
How to arrive at and/or do any of those things isn't obvious to me. – Lee Sleek May 29 '13 at 17:38
I will write a sketch. – André Nicolas May 29 '13 at 17:39
I notice the ratio of the solutions is very close: $\frac{13}{3} = 3.3333..., \frac{51}{13} = 3.923..., \frac{193}{51} = 3.784...$ Does this eventually converge at about 3.5? – Lee Sleek May 29 '13 at 17:52
@LeeSleek Yes, exactly - the exact value is $2+\sqrt3\approx 3.732$, for reasons similar to why the ratio of Fibonacci numbers settles at the golden ratio. See Andre's answer for the precise details. – Steven Stadnicki May 29 '13 at 18:02