@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
Finding Perfect Squares
Most nonzero elements in row
Is A the inverse of B?
Given a matrix, swap the 2nd & 3rd columns
Return fibonacci sequence do not use loop and condition version 2
Easy Sequences 29: Odd proper divisors of odd proper divisors
Easy Sequences 18: Set Bits of Triple Summations
Easy Sequences 54: Product of Products of Proper Divisors
Easy Sequences 19: Length of Prime-sided Rectangle with Maximum Area
Easy Sequences 44: Finding the Smallest Number whose Cube is divisible by a Factorial
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