|
We're glad you came by, but you might find what you're looking for elsewhere. TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it. Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope. |
Displays the Pythagorean triples.
C - how many triples you want to display
None
A, B, C
TI-83/84/+/SE
Weregoose
URL: United TI
:For(A,2,C
:For(B,1,A-1
:Disp {A²-B²,2AB,A²+B²
:If getKey:Pause
:End:EndA Pythagorean triple occurs when, while using the Pythagorean Theorem a2+b2=c2 to find the three sides of a right triangle, all three values are whole integers. For example, a common triple is 3,4,5 — in this case, 9 (32) + 16 (42) = 25 (52). The general formula that can be derived to figure out when a triple occurs is: a=(A2-B2) b=(2AB) c=(A2+B2).
Now that you know what a Pythagorean triple is, the routine should be pretty clear. We are essentially looping over the range of values that we want to find triples in, and then displaying the triples as a three element list using the above mentioned formula. Because there can be many triples found, and displaying all of them would just be like a blur on the screen, the Pause command allows you to temporarily halt the program so you can see the triples that are currently displayed.
.