(11C) Sums of Three Squares
01-07-2019, 12:09 PM (This post was last modified: 01-07-2019 12:10 PM by Gamo.)
Post: #1
 Gamo Senior Member Posts: 513 Joined: Dec 2016
(11C) Sums of Three Squares
Which whole numbers are expressible as sums of three (integer) squares?

This program solve the Sums of Three Squares. [ X^2 + Y^2 + Z^2 = N ]

Given N program will find pair of X,Y and Z that equal to N

where X ≤ Y ≤ Z

-------------------------------------------------------------------

Procedure:

1.) N [A] display Z [Rv] Y [Rv] X [R/S] if it is more than one solution and continue until steps 2.) shown mean finish.

2.) N [A] display 0.000000000 then 0.00 indicate that "No Solution"

------------------------------------------------------
Example:

X^2 + Y^2 + Z^2 = 9876543210

9876543210 [A] display 99380 [Rv] 391 [Rv] 77

[R/S] 99380 [Rv] 359 [Rv] 173

[R/S] "0.000000000" 0.00

X=77 Y=391 Z=99380
X=173 Y=359 Z=99380
----------------------------------------------------
Program:
Code:
 LBL A STO 4 √X INT STO 1 RCL 4 3 ÷ √X STO 2 RCL 4 RCL 1 X^2 - STO 3 2 ÷ √X STO 5 RCL 3 √X INT STO 0 ------------------------- LBL 1 RCL 1 RCL 2 X≤Y GTO 2 CLx FIX 9 PSE FIX 4 RTN ------------------------ LBL 2 RCL 0 RCL 5 X≤Y GTO 3 RCL 1 1 - STO 1 GTO 1 --------------------- LBL 3 RCL 3 RCL 0 X^2 - √X ENTER INT X=Y GTO 5 ------------------- LBL 4 RCL 0 1 - STO 0 GTO 2 ------------------ LBL 5 RCL 0 RCL 1 R/S GTO 4

Gamo
 « Next Oldest | Next Newest »

 Messages In This Thread (11C) Sums of Three Squares - Gamo - 01-07-2019 12:09 PM RE: (11C) Sums of Three Squares - Albert Chan - 01-07-2019, 05:06 PM

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