1. A 4-bit non-prime number detector (output 1 for non-prime numbers). 
    Suppose the input number is ABCD, the output function is F. 

(1)	Draw the truth table

Decimal	A	B	C	D	F	
0	0	0	0	0	1	
1	0	0	0	1	1	
2	0	0	1	0	0	
3	0	0	1	1	0	
4	0	1	0	0	1	
5	0	1	0	1	0	
6	0	1	1	0	1	
7	0	1	1	1	0	
8	1	0	0	0	1	
9	1	0	0	1	1	
10	1	0	1	0	1	
11	1	0	1	1	0	
12	1	1	0	0	1	
13	1	1	0	1	0	
14	1	1	1	0	1	
15	1	1	1	1	1	

(2)	Simplify with K-map

          CD

         00

          01

          11

          10

  AB	   00	       01	 11	    10

1	
1	
1	
1	

1	
0	
0	

All are essential prime implicants

1	

0	
0	
1	
0	

0	
1	
1	
1	

2. Suppose a BCD number X = ABCD, design a function F such that
	if X mod 3 = 0
             then F: = 0
          else F: = 1;

(1)	Draw the truth table

Decimal	A	B	C	D	F	
0	0	0	0	0	0	
1	0	0	0	1	1	
2	0	0	1	0	1	
3	0	0	1	1	0	
4	0	1	0	0	1	
5	0	1	0	1	1	
6	0	1	1	0	0	
7	0	1	1	1	1	
8	1	0	0	0	1	
9	1	0	0	1	0	
10	1	0	1	0	X	
11	1	0	1	1	X	
12	1	1	0	0	X	
13	1	1	0	1	X	
14	1	1	1	0	X	
15	1	1	1	1	X	

(2)	Simplify with K-map

          CD

         00

          01

          11

          10

  AB	   00	       01	 11	    10

0	
1	
X	

All are essential prime implicants

1	

1	
1	
X	
0	

0	
1	
X	
X	

1	
0	
X	
X