Post Reply 
Pythagorean Triples
02-09-2017, 08:57 PM (This post was last modified: 02-09-2017 08:59 PM by Dieter.)
Post: #4
RE: Pythagorean Triples
(02-09-2017 02:49 PM)Joe Horn Wrote:  Pythagorean Triple Generator in RPL:

Here's a stack-only version for the '41:

Code:
01 LBL"TRIPLE"
02 x^2
03 STO Z
04 x<>y
05 x^2
06 STO T
07 -
08 ABS
09 RDN
10 ST* Z
11 +
12 x<>y
13 SQRT
14 ST+ X
15 R^
16 END

Input is N ENTER M, output is a, b and c in X, Y and Z.

This may also be used on the 42s.
Just make sure all registers refer to the stack, i.e. STO Z means STO ST Z.

And I am sure you can still squeeze out the one or other byte here. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Pythagorean Triples - Eddie W. Shore - 02-09-2017, 05:42 AM
RE: Pythagorean Triples - Dieter - 02-09-2017, 08:49 AM
RE: Pythagorean Triples - Joe Horn - 02-09-2017, 02:49 PM
RE: Pythagorean Triples - Dieter - 02-09-2017 08:57 PM



User(s) browsing this thread: 1 Guest(s)