#determines if i, j, k are exclusive numbers exclusive_numbers := proc(i, j, k) if (i = j) or (i = k) or (j = k) then return false; end if; return true; end proc; #outputs all possible combinations of numbers that statisfy given conditions department_numbers := proc() local i, j, k; printf("Police Sanitation Fire\n"); for i to 7 do for j to 7 do k := 12 - i - j; if (k <= 7) and (k >= 1) and (i mod 2 = 0) and exclusive_numbers(i,j,k) then printf("%d %d %d\n", i, j, k); end if; end do; end do; end proc; department_numbers();