Help:=proc(): print(` mex(S), GW(a,b) , WS1(a), WS(N) `): end: #mex(S): MinOFTheEx inputs a set of non-neg. intetgers,and #outputs the smallest non-neg. integer NOT in S # mex:=proc(S) local s: for s from 0 while member(s,S) do od: s: end: #Wythoff's game Moves [a,b]->[a-i,b],i=1..a #[a,b]->[a,b-i], i=1..b #[a,b]->[a-i,b-i] (i=1.. min(a,b)) #GW(x)=mex(GW(y), x->y) GW:=proc(a,b) local i: option remember: mex({seq( GW(a-i,b),i=1..a), seq(GW(a,b-i),i=1..b), seq(GW(a-i,b-i),i=1..min(a,b))}): end: #WS1(i): the unique a such that [a,a+i] is WS1:=proc(i) local a: for a from 0 while GW(a,a+i)<>0 do od: a: end: #WS(N): the list L of length N such that #such that [i,L[i]] is the unique LOSING position #with a=i (alias GW(i,L[i])=0) WS:=proc(N) local b: [seq(WS1(b),b=1..N)]: end: