OFFSET
1,3
COMMENTS
A variant of the Josephus problem where two numbers are eliminated at every stage, one elimination clockwise, the other counterclockwise. To resolve ambiguities, the usual Josephus problem takes precedence.
LINKS
Hiroshi Matsui, Toshiyuki Yamauchi, Soh Tatsumi, Takahumi Inoue, Masakazu Naito and Ryohei Miyadera, Interesting Variants of the Josephus Problem, Computer Algebra - Design of Algorithms, Implementations and Applications, Kokyuroku, The Research Institute of Mathematical Science, No. 1652, (2009), 44-54.
Masakazu Naito and Ryohei Miyadera, The Josephus Problem in Both Directions, The Wolfram Demonstrations Project.
Masakazu Naito, Sohtaro Doro, Daisuke Minematsu and Ryohei Miyadera, The Self-Similarity of the Josephus Problem and its Variants, Visual Mathematics, Volume 11, No. 2, 2009.
FORMULA
A165556(n) = a(n) mod 2.
MATHEMATICA
joseboth[m_, mm_] := Block[{t, p, q, u, v, w}, w = mm - 1; t = Range[m]; p = t; q = t; Do[p = RotateLeft[p, w]; u = First[p]; p = Rest[p]; q = Drop[q, Position[q, u][[1]]]; If[Length[p] == 1, Break[], ]; q = RotateRight[q, w]; v = Last[q]; q = Drop[q, -1]; p = Drop[p, Position[p, v][[1]]]; If[Length[q] == 1, Break[], ], {n, 1, Ceiling[m/2]}]; p[[1]]];
CROSSREFS
KEYWORD
nonn
AUTHOR
Gordon Atkinson, Sep 07 2019
STATUS
approved