I was studying discrete mathematics with a book that had mini biographies of the mathematicians that worked on wharever was being explain on that section. And it had one of them, who considered mathematics an art at the same level as painting or sculpting and hated that mathematicians “lower” themselves to do math that were “useful”, like nobody expects the same “useful results” from the art department. This guy worked really hard to only research on pure mathematics and the most “useless” branch of it, number theory. Eventually, his work helped build the necessary mathematics background to make encryption a thing, and now the entire society use his research. It’s a shame I can’t remember the name of the guy.
It could be but I don’t remember if they talked about Ramanujam on his bio, and pretty sure that why he’s most famous for.
He said this: I have never done anything “useful”. No discovery of mine has made, or is likely to make, directly or indirectly, for good or ill, the least difference to the amenity of the world.
That’s in https://en.m.wikipedia.org/wiki/A_Mathematician’s_Apology, the summary of which matches what you said:
One of the main themes of the book is the beauty that mathematics possesses, which Hardy compares to painting and poetry.[5] For Hardy, the most beautiful mathematics was that which had no practical applications in the outside world (pure mathematics) and, in particular, his own special field of number theory. Hardy contends that if useful knowledge is defined as knowledge which is likely to contribute to the material comfort of mankind in the near future (if not right now), so that mere intellectual satisfaction is irrelevant, then the great bulk of higher mathematics is useless. He justifies the pursuit of pure mathematics with the argument that its very “uselessness” on the whole meant that it could not be misused to cause harm. On the other hand, Hardy denigrates much of the applied mathematics as either being “trivial”, “ugly”, or “dull”, and contrasts it with “real mathematics”, which is how he ranks the higher, pure mathematics.