Chris, there may be something I am missing, but it seems that the solutions in the test suite are only including every second correct value. e.g. I get 10 results for problem 1. I think it is clear that something is wrong because problems 1 and 2 don't contain any of the same numbers (they each contain the alternate ones of the full set for values less than 100), and none of the lists contain the number 1.
Oh, and BTW, the example of the number 35, which is given in the problem description, does not appear in the list for the solution of the first problem.
William, I don't consider 1 as a prime or composite number, and I've added that note to the problem. Also, rather than list all of the numbers, the test suite checks some of them. For example, the first problem has y(1:2:end), and the second has y(2:2:end). I haven't looked at your solutions, but I suspect the problem is including 1; there are nine numbers less than or equal to 100, not ten.
Thanks. I missed the fact that you were only checking alternate values. It's a clever problem!
How to add?
Combinations without using nchoosek
Fibonacci-Sum of Squares
(Linear) Recurrence Equations - Generalised Fibonacci-like sequences
Detect pair of equal values in a Matrix
Identify Wagstaff primes
Compute the effective conductivity of a heterogeneous aquifer
Find the last non-zero digit in a primorial
Guess the card in Fitch Cheney’s five-card trick
List prime anagrams of a number
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