OFFSET
0,2
COMMENTS
We first define an iteration process, starting with the infinite sequence of natural numbers (1,2,3,4,5...) In each iteration, the following steps are applied to generate a permuted sequence of the natural numbers:
i. Let p be the current leftmost term of the sequence.
ii. Extract the first p elements into a block G.
iii. Remove G from the beginning of the sequence and reinsert it after skipping the next p terms in the sequence.
Let a(n) of the series be defined, after exactly n iterations of the above process, as the smallest index m of the permuted sequence such that from position m+1 in the sequence, the sequence coincides with the natural numbers.
Put in a different way, a(n) is the length of the disturbed/jumbled prefix after n iterations. For a(0) the value is 0 because no iterations have been performed and so, no changes have been made to the sequence of natural numbers.
a(n) is always even.
LINKS
Sean A. Irvine, Table of n, a(n) for n = 0..100
EXAMPLE
The permuted natural numbers and their disturbed prefix lengths begin
n=0: 1, 2, 3, 4, 5, ... a(0) = 0
n=1: 2, 1, 3, 4, 5, ... a(1) = 2
n=2: 3, 4, 2, 1, 5, 6, 7, ... a(2) = 4
\-----/ ^
n=3: 1, 5, 6, 3, 4, 2, 7, ... a(3) = 6
\-----/
At n=2, the permutation starts with p=3 so that the first 3 terms 3,4,2 move 3 further places ahead, marked "^", to form the next permutation.
Iteration 1: the leftmost term is (1). Thus, the group G would include a block of just one term from the left, e.g. the term [1]. That group will be moved 1 steps to the right to result in: 2, 1, 3, 4, 5... => A(1)=2 (from 3 onward the sequence is as in the original);
Iteration 2: the leftmost term is (2). Thus, the group G would include a block of two term from the left - [2, 1]. That group will be moved 2 steps to the right to result in: 3, 4, 2, 1, 5, 6...=> A(2)=4 (from 5 onward the sequence is as in the original);
Iteration 3: the leftmost term is (3). Thus, the group G would include a block of three term from the left - [3, 4, 2]. That group will be moved 3 steps to the right to result in: 1, 5, 6, 3, 4, 2, 7, 8...=> A(3)=6 (from 7 onward the sequence is as in the original);
...
PROG
(PARI) lista(n)={my(a=vector(n+1), u=[1]); for(n=2, #a, my(k=u[1]); if(#u<2*k, u=concat(u, [#u+1..2*k])); u=concat([u[k+1..2*k], u[1..k], u[2*k+1..#u]]); a[n]=#u); a} \\ Andrew Howroyd, Sep 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph Rozhenko, Sep 02 2025
EXTENSIONS
a(27) onward from Andrew Howroyd, Sep 02 2025
STATUS
approved
