I am sure there are other more subtle ways to go about it but this seems about as fast as I can make it for a general brute-force solution (0.11s)
This one seems to work for the large test case, too, although it is not a general solution [for size(p,1)>100 it only tests corner points].
733 Solvers
Count from 0 to N^M in base N.
220 Solvers
97 Solvers
Create a vector whose elements depend on the previous element
391 Solvers
Replace multiples of 5 with NaN
358 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!