Consider the integer number sequence N (1 to infinity).
After each iteration, take out the (k+1)th elements; where k is the number of iteration.
you've to find the nth number in the remaining sequence after k-th iteration.
- N= 1 2 3 4 5 6 7 8 9 10 11 12 ...
- for k=1, N becomes --- 1, 3, 5, 7, 9, 11, 13, 15, 17, …
- for k=2, N becomes --- 1, 3, 7, 9, 13, 15, 19, 21, 25, …
- so for [k=2,n=8], output should be 21.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers14
Suggested Problems
-
Return the 3n+1 sequence for n
8508 Solvers
-
10779 Solvers
-
Project Euler: Problem 10, Sum of Primes
2122 Solvers
-
Set the array elements whose value is 13 to 0
1445 Solvers
-
Add a row of zeros on top of a matrix
268 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!