OFFSET

1,2

COMMENTS

In a Josephus problem such as A006257, a(n) is the order in which the person originally first in line is eliminated.

The number of remaining survivors after the person originally first in line has been eliminated, i.e., n-a(n), gives the fractal sequence A025480.

For the linear version, see A225489.

LINKS

Stefano Spezia, Table of n, a(n) for n = 1..10000

Cristina Ballantine and Mircea Merca, Plane Partitions and Divisors, Symmetry (2024), Vol. 16, Iss. 5. See page 9.

Mircea Merca, Plane Partitions and a Problem of Josephus, Mathematics (2023), Vol. 11, Iss. 4996. See page 2.

FORMULA

a(n) = (n+1)/2 (odd n); a(n) = a(n/2) + n/2 (even n).

a(n) = n - A025480(n).

G.f.: Sum{n>=1} x^n/(1-x^A006519(n)). - Nicolas Nagel, Mar 19 2018

EXAMPLE

If there are 7 persons to begin with, they are eliminated in the following order: 2,4,6,1,5,3,7. So the first person (the person originally first in line) is eliminated as number 4. Therefore a(7) = 4.

MATHEMATICA

t = {1}; Do[AppendTo[t, If[OddQ[n], (n + 1)/2, t[[n/2]] + n/2]], {n, 2, 100}]; t (* T. D. Noe, May 17 2013 *)

CROSSREFS

KEYWORD

nonn

AUTHOR

Marcus Hedbring, May 17 2013

STATUS

approved