Pythagorean triples up to Z without loops
Show older comments
I've been struggling with this problem for a while now and am looking for some insight.
The problem is in the form of a function: [A] = pyth(Z).
The problem is to find pythagorean triples where an output [A] is a [? x 3] matrix like:
a b c
3 4 5
6 8 10
5 12 13
where the highest value of c is a number Z.
The tricky part is not using loops.
I've been thinking of using meshgrid and reshape but can't quite put together how to use them. If anyone thinks of anything let me know! I'll be continuing to work on it in the meantime.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!