#OK to post homework #Sam Minkin, 9/20, Assignment 4 Problem 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 CheckDecomp({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, n, o, r}, 5)); true Problem 2: Pasting in seq(i, i = 1 .. 106) into OEIS search was the first to return only 1 hit. Therefore, n=106 is the smallest number such that searching seq(i, i = 1 .. 106) returns 1 hit. Problem 3: 1. Given U={1,..., 15}, A1={3,6,9,12,15}, A2={5,10,15}. We want to show that |Comp(U,A1) intersect Comp(U,A2)|= |U|- |A1|-|A2|+ |A1 intersect A2|. We have, Comp(U,A1) intersect Comp(U,A2) = {1,2,4,5,7,8,10,11,13,14} intersect {1,2,3,4,6,7,8,9,11,12,13,14} = {1,2,4,7,8,11,13,14}. So, |Comp(U,A1) intersect Comp(U,A2)| = 8. Additionally, A1 intersect A2 = {15}. Then, we have |U| = 15, |A1| = 4, |A2| = 3, |A1 intersect A2|. So, |U|- |A1|-|A2|+ |A1 intersect A2| = 15 - 5 - 3 + 1 = 8. Hence, |Comp(U,A1) intersect Comp(U,A2)|= |U|- |A1|-|A2|+ |A1 intersect A2|. 2. The procedure which computes the size using the above formulas: PIE2:=proc(U,A1,A2): if not type(U,set) or not type(A1,set) or not type(A2,set) then print(`A1, A2, or U is not a set `): RETURN(FAIL): fi: if not U intersect A1 = A1 or not U intersect A2 = A2 then print(`A1 or A2 is not a subset of U`): RETURN(FAIL): fi: [nops( (U minus A1) intersect (U minus A2) ), nops(U) - nops(A1) - nops(A2) + nops(A1 intersect A2)]: end: