@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
Convert from Base 10 to base 5
Create an n-by-n null matrix and fill with ones certain positions
Easy Sequences 12: 50th Prime
Easy Sequences 23: Hat Guessing Game!
Easy Sequences 32: Almost Pythagorean Triples
Easy Sequences 19: Length of Prime-sided Rectangle with Maximum Area
Easy Sequences 50: Blocked Gaussian Integers
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