@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
DNA N-Gram Distribution
Self-similarity 2 - Every third term
Find the Pattern 7
Temperature Conversion 1
Easy Sequences 23: Hat Guessing Game!
Easy Sequences 5: Project Euler Problem 1 - Again!
Easy Sequences 8: Triangles with integer sides and prime perimeters
Easy Sequences 30: Nearly Pythagorean Triangles
Easy Sequences 19: Length of Prime-sided Rectangle with Maximum Area
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