Here is what
I consider that the following lines of Hardy wrote about this matter in his Apology (section 21, last paragraph)might help the OP to form a definite idea as to the accuracy of such an asseveration:
"... I must deal with a misconception. It is sometimes suggested that pure mathematicians glory in the uselessness of their work*, and make it a boast that it has no practical applications. The imputation is usually based on an incautious saying attributed to Gauss, to the effect that, if mathematics is the queen of the sciences, then the theory of numbers is, because of its supreme uselessness, the queen of mathematics—I have never been able to find an exact quotation. I am sure that Gauss’s saying (if indeed it be his) has been rather crudely misinterpreted. If the theory of numbers could be employed for any practical and obviously honourable purpose, if it could be turned directly to the furtherance of human happiness or the relief of human suffering, as physiology and even chemistry can, then surely neither Gauss nor any other mathematician would have been so foolish as to decry or regret such applications. But science works for evil as well as for good (and particularly, of course, in time of war); and both Gauss and less mathematicians may be justified in rejoicing that there is one science at any rate, and that their own, whose very remoteness from ordinary human activities should keep it gentle and clean.
*I have been accused of taking this view myself. I once said that ‘a science is said to be useful if its development tends to accentuate the existing inequalities in the distribution of wealth, or more directly promotes the destruction of human life’, and this sentence, written in 1915, has been quoted (for or against me) several times. It was of course a conscious rhetorical flourish, though one perhaps excusable at the time when it was written. "
P.S. Boldface a) The emphasis is mine. b) The excerpt comes from the last paragraph of section 21 of Hardy's Apology.