Help:=proc(): print(` muList(N) , muListD(N) `): end: with(numtheory): #muList(N): inputs a pos. integer N and outputs #[seq(mu(i),i=1..N)]: muList:=proc(N) local eq,var,mu,i,j: var:={seq(mu[i],i=1..N)}: eq:={mu[1]-1, seq(add(mu[j],j in divisors(i)),i=2..N)}: var:=solve(eq,var): [seq(subs(var, mu[j]),j=1..N)]: end: #muListD(N): inputs a pos. integer N and outputs #[seq(mu(i),i in divisors(N) ]: muListD:=proc(N) local S,eq,var,mu,i,j: S:=divisors(N): var:={seq(mu[i],i in S)}: eq:={mu[1]-1, seq(add(mu[j],j in divisors(i)),i in S minus {1})}: var:=solve(eq,var): end: #Def: good person: Doesn't smoke, doesn't drink, doesn't gamble #S:=Set of Smokers #D:=Set of drinkers #G:=set of gamblers #IE(S,a): Given a set S of vices and a letter a #such that a[T] is the number of people whose set #of vices is EXACTLY T (for any T subset of S) #and b[T] is the number of people who have at least #the vices of T (and possibly others) IE:=proc(S,a,b) local Se,T,eq,Tc: Se:=powerset(S): #b[{Smoke}]=a[{Smoke}]+a[{Smoke,Gamble}+a[{Smoke, Drink}]+ #a[{Smoke,Drink,Gamble}] eq:={}: for T in Se do Tc:=S minus T: Tce:=powerset(Tc): eq:= eq union {b[T]=add(a[T union t1], t1 in Tce)}: od: eq: end: