In that particular case, the question of determining whether a number is prime was a perfectly valid question and was answered as such with an appropriate algorithm (which is the accepted answer).
The downvotes were because the algorithm given as the author's attempt was incorrect and incomplete (not even giving complete code). Whether that's fair or not is a separate issue, but enough people were interested in the question and its answer that it has become famous.
I don't see why that's a problem, considering that many of the views are probably from people searching for a good algorithm for determining primes, which is indeed given in the accepted answer. Someone has to ask these questions for the content to exist, which is the reason for the badge.