#OK to post homework #Tianyi Liu,Sept 20, Assignment 4 1. CP({a,b,c},{b,c,d}); {[a, b], [a, c], [a, d], [b, b], [b, c], [b, d], [c, b], [c, c], [c, d]} CheckMult({1,2},{3,4}); true CheckAdd({1,2,3},{3,4,5}) {1, 2, 3}, {3, 4, 5}, `have the following common elements `, {3} FAIL member([d,o,r,o,n],Words({d,o,n,r},5)); true 2. A27 in OEIS has 77 numbers. Both 76 and 77 return the least number of hits which is 11. There is not an n such that returns only A27. 3.|U|=15. |A1|=5. |A2|=3. A1={3,6,9,12,15}. A2={5,10,15}. Comp(U,A1)={1,2,4,5,7,8,10,11,13,14}. Comp(U,A2)={1,2,3,4,6,7,8,9,11,12,13,14}. Comp(U,A1) intersect Comp(U,A2)={1,2,4,7,8,11,13,14}. A1 intersect A2={15} |Comp(U,A1) intersect Comp(U,A2)|=8=15-5-3+1 PIE2:=proc(U,A1,A2) local x,y: if not type(A1,set) then print(A1, `is not a set `): RETURN(FAIL): fi: if not type(A2,set) then print(A2, `is not a set `): RETURN(FAIL): fi: if not type(U,set) then print(U, `is not a set `): RETURN(FAIL): fi: if A1 intersect U<>A1 then print(A1, `is not a subset of `, U): RETURN(FAIL): fi: if A2 intersect U<>A2 then print(A2, `is not a subset of `, U): RETURN(FAIL): fi: x:=Mynops((U minus A1) intersect (U minus A2)): y:=Mynops(U)+Mynops(A1 intersect A2)-Mynops(A1)-Mynops(A2): [x,y]: end: