OFFSET
1,2
COMMENTS
This is a permutation of the natural numbers, with inverse permutation A277680.
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..10000
EXAMPLE
Remove 1 from A000027, leaving 2,3,4,5,6,7,8,...; reverse these 2 at a time, leaving 3,2,5,4,7,6,9,8,... Remove the first 2 terms and reverse the rest 3 at a time, leaving 7,4,5,8,9,6,13,10,11,14,15,12,... Remove the first 3 terms, and so on. The removed terms, taken in order, are 1,3,2,7,4,5,...
MATHEMATICA
x = Range[500];
NestWhile[# + 1 &, 1, (t = 1/2 # (1 + #);
x = Flatten[{Take[x, t],
Map[Reverse, Partition[Drop[x, t], # + 1]]}];
Length[x] > t) &]; x (* A277679 *)
Take[Ordering[#], Position[Differences[Sort[#]], Except[1]][[2]][[1]]]&[x] (* A277680 *) (* Peter J. C. Moses, Nov 13 2016 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Nov 14 2016
STATUS
approved