Post Reply 
(41C) Pythagorean Triples
06-26-2022, 09:29 AM (This post was last modified: 06-26-2022 01:53 PM by C.Ret.)
Post: #3
RE: (41C) Pythagorean Triples
(06-25-2022 03:40 PM)Thomas Klemm Wrote:  But it should also work with the HP-41C after the obvious transformations.

As usual, Thomas Klemm produces an excellent algorithm. I particularly like how the GCD determination is efficiently incorporated into the code.

So I grabbed my HP-41C and its trusty 82240A to make the obvious transformations needed to aim and print:

01 LBL"PYTH"
02 STO 04  XEQ 04
04 LBL 01
05  RCL 04  STO 05
07  LBL 00
08   DSE 05  XEQ 02  DSE 05  GTO 00
12  DSE 04  GTO 01
14 GTO 04

15 LBL 02
16  RCL 04  RCL 05
18  LBL 03
19   STO Z  MOD  X≠0?  GTO 03
23  10^X  X≠Y?  RTN
26  +  CLA
28  RCL 04  ARCL X  "┝,"  ST* Y  X^2  STO Z
34  RCL 05  ARCL X  ACA   ST* Z  X^2  ST+ T
40  -  FMT  ACX  RDN  ACX  RDN  ACX
47  LBL 04
48   ADV
49 END


   

Shorter than the original code, this one just displays triples in a different order.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(41C) Pythagorean Triples - SlideRule - 10-15-2019, 12:57 PM
RE: (41C) Pythagorean Triples - C.Ret - 06-26-2022 09:29 AM
RE: (41C) Pythagorean Triples - John Keith - 07-01-2022, 11:55 AM
RE: (41C) Pythagorean Triples - C.Ret - 07-03-2022, 08:18 AM
RE: (41C) Pythagorean Triples - John Keith - 07-03-2022, 01:55 PM
RE: (41C) Pythagorean Triples - C.Ret - 07-03-2022, 01:41 PM



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