login
A065191
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
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, 60, 22, 31, 35, 44, 26, 45, 57, 80, 6, 47, 109, 128, 14, 39, 155, 64, 48, 49, 25, 32, 106, 227, 53, 82, 150, 139, 143, 58, 78, 169, 147, 198, 70, 23, 131, 88, 156, 75, 103, 166, 192
OFFSET
1,2
LINKS
MATHEMATICA
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 *)
PROG
(Python)
for n in range(1, 5001):
..pos = n
..for k in range(n, 1, -1): pos -= k*(-1)**(pos//k)
..print(n, pos)
# Charlie Neder, Feb 04 2019
CROSSREFS
KEYWORD
nice,nonn
AUTHOR
Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Oct 19 2001
STATUS
approved