If you really want help with this problem, put together a small test suite that gives some inputs and some sample outputs (that you tabulate by hand) and wait for someone to produce a MATLAB function to do what you want.
This is an interesting problem. Acting as an administrator, I cleaned it up and added some tests.
4600 Solvers
Which values occur exactly three times?
3818 Solvers
The Goldbach Conjecture, Part 2
1286 Solvers
Wind outward from the center ...
67 Solvers
Calculate the area of a triangle between three points
879 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!