login
Limit of the recursion B_[k] = T[k](B_[k-1]), where B_[1] = (1,2,3,4,5,...) and T[k] is the transformation that permutes the entries k(2i-1) + j and k(2i) + j for all j = 0,..,k-1 and positive integers i.
8

%I #16 Mar 02 2020 18:55:25

%S 1,4,8,3,5,16,18,19,11,2,40,13,15,10,24,29,37,50,12,9,63,28,66,7,33,

%T 60,22,31,35,44,26,45,57,80,6,47,109,128,14,39,155,64,48,49,25,32,106,

%U 227,53,82,150,139,143,58,78,169,147,198,70,23,131,88,156,75,103,166,192

%N Limit of the recursion B_[k] = T[k](B_[k-1]), where B_[1] = (1,2,3,4,5,...) and T[k] is the transformation that permutes the entries k(2i-1) + j and k(2i) + j for all j = 0,..,k-1 and positive integers i.

%H Charlie Neder, <a href="/A065191/b065191.txt">Table of n, a(n) for n = 1..5000</a>

%t Reap[Do[pos = n; Do[pos -= k (-1)^Quotient[pos, k], {k, n, 1, -1}]; pos -= If[Mod[n, 4] < 2, 1, -1]; Sow[pos], {n, 1, 5000}]][[2, 1]]; (* _Jean-François Alcover_, Mar 02 2020, partly translated from _Charlie Neder_'s Python code *)

%o (Python)

%o for n in range(1,5001):

%o ..pos = n

%o ..for k in range(n,1,-1): pos -= k*(-1)**(pos//k)

%o ..print(n,pos)

%o # _Charlie Neder_, Feb 04 2019

%Y Cf. A065192, A065193, A065194, A065195, A065196, A065197.

%K nice,nonn

%O 1,2

%A Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Oct 19 2001