K= (D0+A'+B').(D1'+D0+A+B).(D1+D0'+A).(D1'+D0'+A'+B).(D0'+A+B') truth table (not(D1) or D0 or A or B) and (D1 or not(D0) or A) and (not(D1) or not(D0) or not(A) or B) and (not(D0) or A or not(B) ) and (D0 or not(A) or not(B)) (not(D1) or D0 or A or B) (D1 or not(D0) or A) truth table not( not( (not(D1 and not(D0) and A and not(B))) and (not(not(D1) and D0 and not(A))) )) (not(D1) or not(D0) or not(A) or B) -------> (not((D1 and D0 and A and not(B)))) (not(D0) or A or not(B) ) -----> (not(D0 and not(A) and B)) (D0 or not(A) or not(B)) ----------> (not(not(D0) and A and B )) Final equation using only NAND truth table not( not( (not(D1 and not(D0) and A and not(B))) and (not(not(D1) and D0 and not(A))) and (not((D1 and D0 and A and not(B)))) and (not(D0 and not(A) and B)) and (not(not(D0) and A and B )) )) too long ..... Let's use Proteus instead WolframAlpha for this demonstration