@Ramon, if you are submitting a question on Cody for everybody to solve, it is recommended you put atleast 3 test suites, mostly so that it encourages people to learn and not hard code solutions.
Thanks, @Dyuman. There are now 4 test suites.
-a+(1-(-1)^(n+1))/2 will be negative in the 4th test. I believe it should be: index(a-(1-(-1)^(n+1))/2).
This works fine in my MATLAB software. But not here.
Any comments, please?
function n = index(a)
for idx = 1:1000
b = idx*((-1)^(idx^3+1));
Because you are not doing what the question is asking
Remove any row in which a NaN appears
Triangle Numbers Below N
Volume of a Parallelepiped
Change the sign of even index entries of the reversed vector
Sum of big primes without primes
Easy Sequences 15: Pythagorean Area with maximum Hypotenuse
Easy Sequences 21: Combinatorial Summations
Easy Sequences 13: Average Speed of Spaceship
Easy Sequences 35: Cutting a donut to Semi-prime pieces
Easy Sequences 24: Number of Coprime Lattice Points
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