This preview shows pages 1–3. Sign up to view the full content.
3/29/09 8:32 PM
Mallard ECE 290: Computer Engineering I  Spring 2009  HWK #1 Solutions
Page 1 of 7
HWK #1 Solutions
SOLUTIONS
Problem 1.1
Before we begin, notice that each of the 5 cards has 16 numbers, exactly one of which is a power of 2. The
numbers are listed in numerically increasing order with the power of 2 displayed as the upper left entry. For
convenience, we refer to the card with 1 in the upper left corner as the 1card, the card with 2 in the upper
left corner as the 2card, etc.
a. Add the numbers in the upper left corner of each card the volunteer points to.
For instance, if the selected number is 19, the volunteer will point to the three cards that contain 19:
the 1card, the 2card, and the 16card. As she points to each card in turn, the mathemagician
computes the sum 1 + 2 + 16 = 19.
b. Consider the cards arranged in lefttoright order: 16card, 8card, 4card, 2card, 1card.
16
8
4
2
1
Every integer between 1 and 31 has a unique binary (base 2) representation. In other words, each can
be represented uniquely as a sum of powers of 2. In particular, each number between 1 and 31 has a
unique 5bit binary representation. When the volunteer points out which cards contain her number,
she is in fact giving the powers of 2 which constitute her number.
For instance, with selected number 19, the volunteer notes that 19 does appear on the 16card, does
not appear on the 8card, does not appear on the 4card, does appear on the 2card, and does appear
on the 1card. This corresponds to the binary number 10011, where 1 indicates the number does
appear on the corresponding card and 0 indicates it does not appear.
c. To extend the trick to include numbers 1 to 63, you will need to make 6 cards, each with 32 numbers
on it. The numbers in the upper left corner are: 1, 2, 4, 8, 16, 32. The numbers on each card are the
same as the numbers on the 5card set, but in addition each card contains the same numbers added to
32. Another way to see this: if the binary representation of a number i has a 1 in the 2
k
position, then i
appears on the 2
k
card.
Number in upper
left corner = 1
1
17
33
49
3
19
35
51
5
21
37
53
7
23
39
55
8
24
40
56
9
25
41
57
10
26
42
58
11
27
43
59
Number in upper
left corner = 8
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 3/29/09 8:32 PM
Mallard ECE 290: Computer Engineering I  Spring 2009  HWK #1 Solutions
Page 2 of 7
Card contains all
numbers x such that
remainder(x/2) = 1
7
23
39
55
9
25
41
57
11
27
43
59
13
29
45
61
15
31
47
63
11
27
43
59
12
28
44
60
13
29
45
61
14
30
46
62
15
31
47
63
Card contains all
numbers x such that
remainder(x/16) =
8,9,10,11,12,13,14, or 15
Number in upper
left corner = 2
Card contains all
numbers x such that
remainder(x/4) = 2 or 3
2
18
34
50
3
19
35
51
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 11/16/2009 for the course ECE 290 taught by Professor Brown during the Spring '08 term at University of Illinois at Urbana–Champaign.
 Spring '08
 BROWN

Click to edit the document details