Help:=proc(): print(`ER(x,r), ERtest(x,r)`): print(`AllWalls(S,r)`): end: with(combinat): #ER(x,r): the lower bound for the number of #integers <=x that are not divisible by the #first r primes: ER:=proc(x,r) local gu,P,i,p: P:=[ seq(ithprime(i),i=1..r)]: x*mul(1-1/p,p in P)-2^r: end: #The exact number of integres <=x not #divisible by the first r primes ERtest:=proc(x,r) local i,j: nops({seq(i,i=1..x)} minus {seq(seq(ithprime(i)*j,i=1..r),j=1..x)}): end: #AllWalls(S,r): the collection of all subsets #of {1, ..., r} that contain S #AllWals({1,3},4) should be #{{1,3},{1,2,3},{1,3,4},{1,2,3,4}} AllWalls:=proc(S,r) local michael,i,m: michael:=powerset({seq(i,i=1..r)} minus S): {seq(S union m, m in michael)}: end: #BrunGame1: inputs an integer x and a set of #sets-of-primes such that we know that #NumberOfIntegers x not divisible by the #first r prime >x*Sum((-1)^|S1|/mul(p,S1),S1 in S)-nops(S) #and tries to remove free-loading walks with "apex" #of even cardinality BrunGame1:=proc(x,r,S) local T,S1,dennis, d: for S1 in S do if nops(S1) mod 2 =0 then dennis:=AllWalls(S1,r): for d in dennis do if FreeLoader(d,x,r) then RETURN(S minus d): fi: od: fi: od: #TO be continued end: