Step 1: Recall the requirement.
The question asks for the preparation of primary amines from alkyl halides without changing the number of carbon atoms in the chain. This means the reaction must directly substitute the halogen with an –NH$_2$ group, giving a pure primary amine.
Step 2: Analyze each option.
- \( \text{(A) Hofmann bromide reaction:} \) This involves the conversion of amides to amines using Br$_2$ and NaOH. However, it reduces the carbon chain length by one (–CO group is removed). Hence, it is not suitable here.
- \( \text{(B) Gabriel's phthalimide synthesis:} \) In this method, phthalimide reacts with alkyl halide to form an N-alkyl phthalimide, which on hydrolysis gives a pure primary amine. This method introduces the –NH$_2$ group without changing the carbon skeleton. This is the correct choice.
- \( \text{(C) Sandmeyer reaction:} \) This is used to prepare aryl halides from aromatic amines via diazonium salts. It is not a method to prepare primary amines.
- \( \text{(D) Reaction with NH$_3$:} \) Direct reaction of alkyl halides with NH$_3$ gives amines but also produces secondary and tertiary amines due to multiple substitutions. Hence, it is not a selective method for pure primary amines.
Step 3: Final Answer.
Thus, the best method is Gabriel's phthalimide synthesis.
\[
\boxed{\text{Gabriel's phthalimide synthesis (B)}}
\]