(41C) Sum of Two Squares
|
08-17-2019, 01:38 PM
Post: #1
|
|||
|
|||
(41C) Sum of Two Squares
Given a positive integer n, can we find two non-negative integers x and y such that:
n = x^2 + y^2 (x and y can be 0, n is assumed to be greater than 0) The program presented here is the use of iterations to find all possible pairs which fit n = x^2 + y^2. Some integers do not have representations, others have more than one. The program will show all possible combinations. Registers used: R00 = n R01 = counter R02 = temporary Code:
Examples Example 1: n = 325 325 = 1^2 + 18^2 325 = 6^2 + 17^2 325 = 10^2 + 15^2 Example 2: n = 530 530 = 1^2 + 23^2 530 = 13^2 + 19^2 Blog link: http://edspi31415.blogspot.com/2019/08/h...f-two.html |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)