According to the Tenth Doctor, "Any number that reduces to 1 when you take the sum of the square of its digits and continue iterating it until it yields 1 is a happy number; any number that doesn't, isn't." (TV: 42)
Though AUDIO: The Haunting establishes that 1 is itself a prime number in the DWU, this is a point of contention among mathematicians.
Generally, 1 is considered neither prime nor composite. It would certainly have been considered a prime, however, in the story's time period of the 1890s. In particular, the entry for Number published in 1890 in the 9th edition of Encyclopædia Britannica stated that every positive number was either prime or composite, and explicitly listed 1 as prime.