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 ;)
Convert a numerical matrix into a cell array of strings
Make an awesome ramp for a tiny motorcycle stuntman
Return unique values without sorting
Who invented zero?
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
Lychrel Number Test (Inspired by Project Euler Problem 55)
Make a 1 hot vector
The Dark Side of the Die
Return the 'Size' of a String of Code
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