A Pythagorean triplet is, of course, a set {a, b, c} of three integers such that a[Sup]2[/sup] + b[Sup]2[/Sup] = c[Sup]2[/Sup]
Is there a name for Pythagorean triplets where the difference between a and b is exactly 1? For example, {3, 4, 5} or {20, 21, 29}.

Is there an “easy” way to generate triplets of this form?

Easy in what sense? It’s really easy to code: give me an upper bound k, and for every integer i in [0, k - 1], I’ll see if i[sup]2[/sup] + (i + 1)[sup]2[/sup] is a perfect square. It’s not real fast, but it’s a simple algorithm.

In playing around with numbers a bit while bored in high school math classes, I happened across a simple method to, for a given number, find a pythagorean triple containing that number. It was pretty easy to identify a pattern for odd numbers just from examples I knew such as (3,4,5) and (7,24,25). Square the given number, divide it in half, and round up and down to find the other two numbers. This does only find triples for which the given number is the smallest of the three, but they do satisfy your condition of two of the numbers differing by 1.

I found I could extend this pattern to even numbers by dividing the square of the number by 4 rather than 2, and then taking plus or minus one rather than one half. This results in the larger two numbers in the triple differing by two, however, so they will not work.

Yeah, I know… I was bored. And I had to at least pretend I was paying attention, so it had to be stuff I could do in my head. I was pretty good at squaring numbers in my head, it was my parlor trick in 8th grade. Despite the obvious uselessness of my little discoveries, I was curious enough to spend some time outside of class (when I don’t have to worry about paying no attention to my surroundings) working out the algebra behind it.

For a given positive odd integer n:
(n[sup]2[/sup]/2 - 1/2)[sup]2[/sup] - (n[sup]2[/sup]/2 + 1/2)[sup]2[/sup] --> (n[sup]4[/sup]/4 + n[sup]2[/sup]/2 + 1/4) - (n[sup]4[/sup]/4 - n[sup]2[/sup]/2 + 1/4) --> n[sup]2[/sup]
So, we have a set of three numbers [n, (n[sup]2[/sup]/2 - 1/2), (n[sup]2[/sup]/2 + 1/2)] that obeys the Pythagorean Theorem and whose two largest elements differ by one.

I see no way to extend this little trick to find triples such as your example, in which the smaller two values differ by one, or to find triples containing a given even number. But if you just need a way to find an indefinite number of such triples rather than all such triples, then I guess this math-class occupation wasn’t quite so useless as I thought it was back then.

Hmm, all that proofreading and I didn’t bother to check my equations :smack: . In the little algebra bit I did I reversed the two terms I was subtracting. So for all two of you who didn’t skip right past the poorly formatted math, subtract those in the other direction, please.

Finding Pythagorean triples whose legs differ by one, n[sup]2[/sup]+(n+1)[sup]2[/sup]=m[sup]2[/sup], is closely related to a family of Diophantine equations sometimes called Pell’s equation (which has general form a[sup]2[/sup]-Db[sup]2[/sup]=c, though often it’s called Pell’s equation only for c=1). You can see this by rewriting the equation as (2n+1)[sup]2[/sup]+1=2m[sup]2[/sup], which is of the generalized Pell form with a=2n+1, b=m, D=2, c=-1.

For c=+/-1, as is the case here, a relatively straightforward algorithm exists to find solutions. By further rewriting the equation as ((2n+1)/m)[sup]2[/sup] = 2 - 1/m[sup]2[/sup] you can see that the values (2n+1)/m are good rational approximations to sqrt(2). In fact they are among the best rational approximations possible (among all rationals with positive denominators less than or equal to m), a result known as Hurwitz’s Theorem. All of these good rational approximations are easy to find efficiently, as the convergents to the continued fraction expansion of sqrt(2). (There are simple recursion relations for computing these convergents, but I won’t state them here in case you want to try to find them.) Not every convergent gives a solution of the form you’re looking for (the convergent 17/12, for example, gives n=8, m=12, but 8[sup]2[/sup]+9[sup]2[/sup]=145 --close but not quite). But you can generate as many of these convergents as you like (and test each one). This is substantially quicker than a brute-force search.

As in most Diophantine analysis, solutions involve a lot more number theory than you might expect on first glance.

As in Wintermute’s case, I screwed around with Pythagoras’ theorem, and found that you could easily find triples in which the longer leg and the hypoteneuse differ by one (not what you’re asking, I know). In that case the legs had the equations 2n + 1, 2n^2 + 2n and 2n^2 + 2n + 1. In iother words, every odd integer is the short leg in such a triplet, since n can take on all integral values. Furthermore, n is the radius of the circle inscribed in such a triangle, and the place where it touches each side separates that side into portions of integral length.

Using the ruile that you can generate Pythagorean triples using 2mn, m^2-n^2 and m^2+n^2, yopu can calculate that you can generate such pair by chooising values of n that generate integral values of m in((2n+1)+(4n+1)^(1/2))/2 or ((2n+1)-(4n+1)^(1/2))/2.

Looking at my results a little more closely, I can prove that every even continued-fraction convergent to sqrt(2) (but none of the odd ones) generates such a Pythagorean triple (numbering the convergents (1/1, 3/2, 7/5, 17/12, 41/29, 99/70, …) starting with 0). Because only the convergents can generate such triples (by Hurwitz’ theorem), this now provides a convenient form for generating all such triples. Using the closed form for the 2kth convergent to r=sqrt(2) gives the closed form (spoiled for your mathematical puzzling pleasure!)n[sub]2k[/sub]=((1+r)[sup]2k+1[/sup]+(1-r)[sup]2k+1[/sup]-2) / 4
m[sub]2k[/sub]=((1+r)[sup]2k+1[/sup]-(1-r)[sup]2k+1[/sup]) / 2rfor the kth triple (n,n+1;m) satisfying n[sup]2[/sup]+(n+1)[sup]2[/sup]=m[sup]2[/sup].

I think that this last bit is true for all Pythagorean triplets: That is to say, given a right triangle with all three sides integers, the inscribed circle will divide each side into integral lengths. At least, that’s what I think I remember proving once upon a time.

Yes, and even the restriction to a right triangle is hardly necessary: for any triangle with all sides integers, the inscribed circle will divide the sides into either all integral lengths or all half-integral lengths (but in the non-right case, the incircle’s radius will not generally be rational).

Come to think of it, this is fairly simple to prove, but one has to jump through a few hoops to show that they’re always integers (as opposed to half-integers) for the right triangle case.