Problem 44340. Recaman Sequence - III

I want to create a Recaman sequence where there is a "1" in the n-th position. So from which integer should I start the Recaman sequence? If there are more than one starting integer that generates a sequence with a 1 in the n-th position, return the lowest one.
For example if I want to place the digit 1 in the 7th place in the sequence then I should start the sequence from six as follow;
seq = [6 5 3 6 2 7 1 8 16]
You can also start the sequence with 12 and obtain a series where there is a 1 in 7th position;
seq = [12 11 9 6 2 7 1]
Related Challenges :
  1. Recaman Sequence - I
  2. Recaman Sequence - II
  3. Recaman Sequence - III

Solution Stats

45.7% Correct | 54.3% Incorrect
Last Solution submitted on Sep 07, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers84

Suggested Problems

More from this Author92

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!