Inspired by Project Euler problem #539
You'll be given a vector from 1 to n;
Going from left to right, remove the first number and every other number afterward until the end of the list.
Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.
Example with n=9
1 2 3 4 5 6 7 8 9
2 4 6 8
2 6
6
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers67
Suggested Problems
-
Remove the polynomials that have positive real elements of their roots.
1740 Solvers
-
Convert a numerical matrix into a cell array of strings
2383 Solvers
-
Find the maximum number of decimal places in a set of numbers
3375 Solvers
-
Convert Two Character String into a Binary Vector
232 Solvers
-
540 Solvers
More from this Author12
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Similar to, though simpler than, James's decimation problem: https://www.mathworks.com/matlabcentral/cody/problems/1092-decimation.