I really don't see the point of that kind of problems where you can't use Matlab built-in functions.
which functions?
960 Solvers
Find the peak 3n+1 sequence value
1121 Solvers
841 Solvers
519 Solvers
364 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!