Question: MATLAB: In a file called mywhile.m, and using the keyword while, write
ID: 3663655 • Letter: Q
Question
Question: MATLAB: In a file called mywhile.m, and using the keyword while, write a function to find the first integer
larger than one (n) such that (2n)! > 5n.Then write a more general function, mywhile2.m, returning
the first integer such that (an)! > xn for any a and any x. Show your results for a = 3 and x = 32.
So far I have for part a i have:
%Description: This function would find the first integer larger than one
%such that (2n)! > 5^n
%Homework 1 Problem 4
num = 2;
while (num > 1)
if (factorial(2*num) <= 5^num)
break
end
num = num +1;
end
disp(num)
Please tell me where I went wrong.
Explanation / Answer
num=0
a=3
x=32
while (num > 1)
if (factorial(a*num) <= x*num)
break
end
num = num +1;
end
disp(num)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.