# Dividing list into smaller list using a set of rules?

Suppose we have the list for $$n\in\mathbb{N}$$

Range[1,n]

1. We choose the number in the list where $$x=1$$, $$x=n$$ and $$x=1+(n-1)/2$$ round closest to and the numbers closest to the chosen elements.

For instance, if $$n=15$$ the elements rounded closest to are boxed, and the elements closest to the chosen elements are underlined.

$$\left\{\boxed{1},\underline2,3,4,5,6,\underline{7},\boxed{8},\underline{9},10,11,12,13,\underline{14},\boxed{15}\right\}\to\left\{1,2,7,8,9,14,15\right\}$$

1. Next we choose the numbers are not in the previous sub-list and round closest to $$x=1+(n-1)/4$$ and $$x=1+3(n-1)/4$$ (which are double boxed) and elements closest to the double boxed, underlined and single boxed numbers (which are double-underlined)

$$\require{enclose}\left\{\boxed{1},\underline2,\underline{\underline{3}},\underline{\underline{4}},\boxed{\boxed{5}},\underline{\underline{6}},\underline{7},\boxed{8},\underline{9},\underline{\underline{10}},\underline{\underline{11}},\boxed{\boxed{12}},\underline{\underline{13}},\underline{14},\boxed{15}\right\}\to\left\{3,4,5,6,10,11,12,13\right\}$$

For values of larger $$n$$, we continue this. In general, for $$r\in\mathbb{N}$$, we choose elements that $$x=1+(n-1)/2^r$$,$$x=1+2(n-1)/2^r$$...,$$x=1+(2^r-1)(n-1)/2^r$$ round closest to and aren't in previous iterations; then, choose elements closest to these and those from previous iterations till we have no more elements left.

Question

For a larger list such as $$n=100$$, what would this list look like? For example, for $$n=15$$, the list of sub-lists would look like.

$$\left\{\left\{1,2,7,8,9,14,15\right\},\left\{3,4,5,6,10,11,12,13\right\}\right\}$$

Edit: Here is the code that I have tried

From a previous answer, I know that for each iteration, the boxed numbers can be found using the following:

n = 100;(*length of original list*)
d = Range[1, n];
get[m_, n_] :=
Module[{}, Round[1 + (n - 1) Table[2 i - 1, {i, 1, 2^m/2}]/2^m]];
t = {1, get[1, n][[1]], n};
res = {t};
d = Select[d, ! MemberQ[t, #] &];
sel[m_, d_, n_] := Module[{t}, t = get[m, n];
{Select[d, MemberQ[t, #] &], Select[d, ! MemberQ[t, #] &]}];
i = 2; While[d != {},
If[i > Length[d], Break[]]; {t, d} = sel[i++, d, n];
Print[{d, t}]; AppendTo[res, t]]
res


Where res takes the list of boxed numbers until all values are taken.

Unfortunately, I know little about the code (e.g. whileloop,++,break) to modify it so for each iteration, I can choose numbers closest to the boxed number, as well as the others values from previous iterations.

• In the output,where is 4? Jan 21 at 23:10