It's logic gates time!
You are only allowed to use NOT, OR, AND, XOR gates, accepting 1,2,2,2 inputs respectively.
PART ONE
You must build a circuit with $n$ inputs, and 1 output.
The output must be TRUE if and only if an even number of inputs are TRUE.
Can you find a solution which uses the minimal number of gates (the construction must be general for all $n$, express the number of gates in terms of $n$). Can you prove that this is the minimum?
PART TWO
You must build a circuit with $n$ inputs, and 1 output.
The output must be TRUE if and only if a multiple of three inputs are TRUE.
Once again, attempt to find an optimal general solution, expressing the number of gates needed in terms of $n$.
PART THREE
You must build a circuit with $n$ inputs, and 1 output.
The output must be TRUE if and only if exactly $x$ inputs are true. You are given what $x$ is before building the circuit.
Again, attempt to find an optimal general solution.
PART FOUR
You must build a circuit with $n$ inputs, and $n$ outputs.
The number of TRUE outputs must be the same as the number of TRUE inputs, $x$.
Additionally, if you are told what $x$ is AFTER you have built your circuit, but not which $x$ inputs are TRUE, you must still be able to determine without any doubt which $x$ outputs are TRUE.
Once again, optimise to the best of your ability.\
Edit for clarification: Build a circuit, number the outputs 1, 2, 3, 4, 5, 6, ... , n. Now, you are told that x inputs are true, and you should be able to say exactly which x outputs are true.
PART FIVE
You must build a circuit with $n$ inputs, and 1 output.
The output must be TRUE if and only if a prime number of inputs is true. :O
For clarification, 0 TRUE inputs and 1 TRUE input should both return a 0 output.
Optimise to best of your ability.
You are not allowed to build a circuit with prior knowledge of what numbers are prime - I.e., the construction should be 100% general, with an identical 'structure' for each number $n$. If you have solved part 3, for example, your solution for this part cannot be 'use the construction for part 3, checking every $x$ which is a prime number less than $n$, and then ORing all of these outputs.' I understand that this restriction sounds a little strange, but essentially, it boils down to:
Your general solution must be feasibly constructable for arbitrarily large but finite $n$.
This rules out things like 'construct these modules for every prime number less than the square root of $n$', because that requires information that you don't realistically have. If you want to use information, derive it from your circuit!