← RoseCode

ROSECODE 472

Kimberling Sequence

Philippe_57721 · Programming ·

The Kimberling sequence is defined as follow.

We start with S0={1,2,3,4,5,6,7,8,9,10,}
We build Sk+1 from Sk : for i in [1..k], we take Sk[k+i] and Sk[ki], ignoring Sk[0], then we take the rest of the sequence

The first iterations are:
 0  (1) 2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 1   2 (3) 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 2   4  2 (5) 6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 3   6  2  7 (4) 8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 4   8  7  9  2(10) 6 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 5   6  2 11  9 12 (7)13  8 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 6  13 12  8  9 14 11(15) 2 16  6 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 7   2 11 16 14  6  9 17 (8)18 12 19 13 20 21 22 23 24 25 26 27 28 29 30
 8  18 17 12  9 19  6 13 14(20)16 21 11 22  2 23 24 25 26 27 28 29 30
 9  16 14 21 13 11  6 22 19  2 (9)23 12 24 17 25 18 26 27 28 29 30
10  23  2 12 19 24 22 17  6 25 11(18)13 26 21 27 14 28 16 29 30
The Kimberling sequence is formed by the diagonal elements.
K=1,3,5,4,10,7,15,8,20,9,18,24,31,14,28,22,42,35,33,46,53,6,36,23,2,55,62,59,76,65,

It is conjectured that K contains exactly all the integers.

Let O(n) the index of the 1st occurrence of n in K : KO(n)=n

One can verify that:
O(2) = 25
O(3) = 2
O(19) = 49595

Find O(16268)

[My timing : 20 sec]