I am getting error after submitting as,
"We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly"
But completion bar has been incremented.
Thanks and Have a Good DaY
function c = right_triangle_sides(p)
N = round(p/2);
A = 1:N;
A = A.^2;
B = sqrt(A + A');
C = arrayfun(@(t) t/floor(t) == 1,B);
[i j] = find(triu(C));
k = p - i - j;
x = (i.^2 + j.^2 - k.^2 == 0);
R = [i(x) j(x) k(x)];
R = sortrows(R);
R = R';
[~,col] = size(R);
c = mat2cell(R(:)',1,3*ones(1,col));
I think, the statement of the problem is not complete. The reference problem is not available. I know very well about right angle triangles but I do not have the idea on how to find the solutions. Please help me out.
it is just iteration of 3 sides using perimeter and summing up the three iteration variable for perimeter check then for right angle triangle check (Pythagoras)...
Hope this helped you...(:
while B < 1000
B = B+1;
C = sqrt((A^2) + (B^2));
perimeter = A+B+C;
c(end+1,:) = [A,B,C];
Thank you :)
Works, but is horribly inefficient especially for higher p...
solution using a Neural Network Toolbox function ;)
Indexed Probability Table
Is the Point in a Triangle?
Reverse the elements of an array
02 - Vector Variables 4
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
Next Higher Power of B
Generalized N-Cards Problem
Give the Shortest Path Through The Maze
Multiples of a Number in a Given Range
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office