OFFSET
1,1
COMMENTS
Beginning at the position A187789(n) with step a(n), (n-1) white stones were eliminated; then from the position 1 of the last white stone, n black stones were eliminated.
REFERENCES
W. Ahrens, Das Josephusspiel, Archiv für Kulturgeschichte, Jg 11(1913), 129-151.
LINKS
R. Baumann, Das Josephus-Problem, LOG IN, Heft Nr. 165, pp. 68-71, 2010 (in German).
EXAMPLE
n=4; WBWWBBWB; startposition=A187789(4)=8; least step=a(4)=4; elimination: white stones: {3,7,4}; black stones: {6,5,8,2}.
MAPLE
s:=1: M:={}:
for n from 1 to 100 do M:=M union {n}:
while (M <> {}) do
s1:=s: s:=s+1: f[1]:=1:
for n from 2 to 101 do n1:=n-1:
f[n]:=(f[n1]+s1) mod n +1:
if (f[n]=1) and (n1 in M) then
a[n1]:=s: M:=M minus {n1}:
end if:
end do:
end do:
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Weisenhorn, Jan 06 2013
STATUS
approved