login
a(n) is the start position for a Sankt-Petrus-game with n white and n black stones and the least step A187788(n).
1

%I #23 Jan 19 2023 09:35:13

%S 2,3,2,8,5,5,2,7,1,17,15,4,8,1,2,30,26,11,35,7,26,27,23,44,24,30,6,39,

%T 53,18,2,15,61,40,30,68,44,32,78,29,81,15,19,76,51,67,40,19,53,42,53,

%U 3,74,103,73,35,105,78,110,105,76,61,2,5,48,128,82,36,37,63,88,87,31,123,93,126,2,1,156,89,33,160,90,135,124,136,145,79,42,26,104,94,67,44,186,30,133,137,40,118

%N a(n) is the start position for a Sankt-Petrus-game with n white and n black stones and the least step A187788(n).

%C 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.

%D W. Ahrens, Das Josephusspiel, Archiv für Kulturgeschichte, Jg 11(1913), 129-151.

%H R. Baumann, <a href="https://www.yumpu.com/de/document/read/460296/nr-165">Das Josephus-Problem</a>, LOG IN, Heft Nr. 165, pp. 68-71, 2010 (in German).

%H <a href="/index/J#Josephus">Index entries for sequences related to the Josephus Problem</a>

%e 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}.

%p stone:=proc(n1)

%p local n,j,k,h,z,zp: global a,m,s:

%p n:=2*n1: m:=m+1:

%p for j from 1 to n-1 do z[j]:=z[j]+1: end do:

%p z[n]:=1: zp:=1:

%p for j from 1 to n1 do

%p for k from 1 to (s-2) do zp:=z[zp]: end do:

%p h:=z[zp]: z[zp]:=z[z[zp]]: zp:=z[zp]:

%p end do:

%p if (h=1) then a[n1]:=1: else a[n1]:=n+2-h: end if:

%p end proc:

%p m:=0: s:=1:

%p while (m < 100) do

%p s1:=s: s:=s+1: c:=1:

%p for p from 2 to 100 by 2 do p1:=p-1: p2:=p+1:

%p b:=(c+s1) mod p +1:

%p if (b=1) and (a[p1]=0) then stone(p1): end if:

%p c:=(b+s1) mod p2 +1:

%p if (c=1) and (a[p]=0) then stone(p): end if:

%p end do:

%p end do:

%Y Cf. A187788, A206602.

%K nonn

%O 1,1

%A _Paul Weisenhorn_, Jan 06 2013