This is just a little algorithm I came up with for finding primitive Pythagorean triples. It does the same thing as the algorithm that finds Pythagorean triples in general, and then it checks if the triple is primitive by finding out what numbers from 1 to c/2 c is divisible by, and if b is also divisible by that number, and if a is as well. If the triple isn't simply a multiple of a past triple, it gets added to the list. The algorithm is pretty inefficient. I may try to optimize if I ever have time, but for now, I need to do my math homework rather than doing irrelevant math for fun.
All by me in 105 blocks! As far as I know, this is the only project on Scratch that finds only and all primitive Pythagorean triples. Update 3/23/2023: I made it set c to 1 at the beginning and changed the 1 in the "change c by 1" block to a 4 because apparently primitive Pythagorean triples are always at least 4 apart in terms of c, and c mod 4 of a triple is always 1. Now it goes literally 3 times faster and still works perfectly, just by changing a couple of numbers. To think it was that easy to improve, or in other words, that bad. Update 4/4/2023: I changed the variable "x" (looks for working "b" value) so that it only goes up to the floor of c/2. This roughly doubles the speed at which it finds triples. Update 4/4/2023: I removed the thing where it checks "a" in testing primitivity, because a is dependent on what b and c are, and thus you only need 2 of the 3 to know whether the triple is primitive or not.