To demonstrate set union and intersection to her class, Mrs. Putnam asked for three students to each write down a set of numbers.
After they had done so, she looked at their sets and told the class, "the union of these three sets is the first ten counting numbers, but their intersection is empty!"
How many triples (A, B, C) of sets are there such that
A U B U C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
and
A ∩ B ∩ C = {} ?
(In reply to
re(4): Solution FINAL WORD(by Charlie by Charlie)
By the way the program that produced the list is
OPEN "setmeup.txt" FOR OUTPUT AS #2
DATA 1,2,3,12,13,23
FOR i = 1 TO 6
READ choice$(i)
NEXT
DIM set$(3)
FOR c1 = 1 TO 6
FOR c2 = 1 TO 6
FOR c3 = 1 TO 6
FOR c4 = 1 TO 6
ERASE set$
c$ = choice$(c1)
FOR i = 1 TO LEN(c$)
set$(VAL(MID$(c$, i, 1))) = set$(VAL(MID$(c$, i, 1))) + "1"
NEXT
c$ = choice$(c2)
FOR i = 1 TO LEN(c$)
set$(VAL(MID$(c$, i, 1))) = set$(VAL(MID$(c$, i, 1))) + "2"
NEXT
c$ = choice$(c3)
FOR i = 1 TO LEN(c$)
set$(VAL(MID$(c$, i, 1))) = set$(VAL(MID$(c$, i, 1))) + "3"
NEXT
c$ = choice$(c4)
FOR i = 1 TO LEN(c$)
set$(VAL(MID$(c$, i, 1))) = set$(VAL(MID$(c$, i, 1))) + "4"
NEXT
good = 1
FOR i = 1 TO 3
IF set$(i) = "" THEN good = 0
NEXT
IF good THEN
gdCt = gdCt + 1
PRINT #2, set$(1); " "; set$(2); " "; set$(3); " "
END IF
NEXT
NEXT
NEXT
NEXT
CLOSE
PRINT gdCt



Posted by Charlie
on 20040210 15:58:42 