OFFSET
1,1
COMMENTS
Beginning at the position a(n) with the least step A187788(n) (n-1) white stones were eliminated; then starting at 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=8; WWBBWBBWWBBWWBWB; step=A187788(8)=3; start=a(8)=7; elimination: white stones: {9,12,15,2,5,8,13}, black stones: {4,10,16,6,14,7,3,11}.
MAPLE
stone:=proc(n1)
local n, j, k, h, z, zp: global a, m, s:
n:=2*n1: m:=m+1:
for j from 1 to n-1 do z[j]:=z[j]+1: end do:
z[n]:=1: zp:=1:
for j from 1 to n1 do
for k from 1 to (s-2) do zp:=z[zp]: end do:
h:=z[zp]: z[zp]:=z[z[zp]]: zp:=z[zp]:
end do:
if (h=1) then a[n1]:=1: else a[n1]:=n+2-h: end if:
end proc:
m:=0: s:=1:
while (m < 100) do
s1:=s: s:=s+1: c:=1:
for p from 2 to 100 by 2 do p1:=p-1: p2:=p+1:
b:=(c+s1) mod p +1:
if (b=1) and (a[p1]=0) then stone(p1): end if:
c:=(b+s1) mod p2 +1:
if (c=1) and (a[p]=0) then stone(p): end if:
end do:
end do:
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Weisenhorn, Jan 06 2013
STATUS
approved