Is there any particular reason why "1" should be a prime number? Since none of exampe in test suite pointing us to that direction. besides, I fail to figure out the necessity of that either.
Mathematically speaking, 1 is not a prime number. Primes are defined as number greater than 1. Also, the difference between 2 and 1 isn't two, so I don't see why [1 2] would be a valid output anyway.
James and bainhome, I apologise for making the two errors that you pointed out. I have corrected them and updated the problem.
261 Solvers
Project Euler: Problem 6, Natural numbers, squares and sums.
1018 Solvers
Create an index-powered vector
353 Solvers
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
298 Solvers
384 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!