Why does Carnap say 'Caesar is a prime number' is meaningless?
First, clearly, the statement "Caesar is a prime number" is just false, not meaningless. And it is precisely because it is not meaningless that we can tell that it is false.
If that is not obvious to some, to see that it is false, it is enough to assume that "Caesar" refers to the well-known Roman emperor and that therefore Caesar was a human being, and that a prime number is some sort of number. I think we can confidently say that no human being is a number.
Obviously, the statement is not just false. It is also baffling. Anyone really asserting this statement would be immediately suspected of being somewhat deranged.
Why did Carnap claimed that it was meaningless? Well, this would be a question for the psychology forum, not the philosophy one. The closest explanation I could think of is that Carnap was a logical positivist, insisting that natural languages have many imperfections and are therefore logically misleading. In a similar vain, Bertrand Russell claimed for example that in the sentence "the author of Waverley was a man", the expression "the author of Waverley" is not the subject, something all grammarians would raise an eyebrow at.
Obviously, saying that Caesar is a prime number is a category mistake, but category mistakes do not render the statements guilty of them meaningless.
Still, that the statement is just false, not meaningless, is the standard grammatical perspective on the subject:
According to our actual grammatical standards, we consider 'Caesar is a prime number' not meaningless, but false. —— Stephen K. McLeod, Modality and Anti-Metaphysics (2018)
And anyone with a bit of sense can judge for themselves.
I guess I have to say something of the "accepted answer", following Philip Klöcking's comment.
First, yes, Philip, I read the accepted answer, and I read it before writing my own answer, I even relied on it for information about Carnap's position.
And wrote my own answer precisely because the accepted answer did not answer the question.
So, the accepted answer says:
Nevertheless, Carnap claims that (2) is meaningless, and gives the following explanation: "Prime number" is a predicate of numbers; it can be neither affirmed nor denied of a person (p. 68).
Well, this may well be what Carnap said, but this is no explanation as to why he believed what he said. Again, this would be a question for a psychology forum.
However, Carnap's own justification is plainly wrong. To say that "'prime number' is a predicate of numbers" is grossly mistaken. Sure, it can be and is meant to apply to numbers, but this is a semantic fact, while it is a linguistic and syntactic fact that it can be used for other things, if only falsely. Let me here repeat what grammarians think:
According to our actual grammatical standards, we consider 'Caesar is a prime number' not meaningless, but false. —— Stephen K. McLeod, Modality and Anti-Metaphysics (2018)
The think this because the notion of predicate is both a functional and a syntactic notion, not a semantic one. The predicate is whatever according to the syntax is in a syntactic position to qualify the syntactic subject, and Carnap has not the authority to decree as he does here that something that is obviously here to qualify a subject is not a predicate.
Second, while "prime number" is obviously normally used to qualify numbers, just as for example "free country" is normally used to qualify countries, using "prime number" to qualify Julius Caesar or anything not a number is not meaningless. It will just produce an inevitably false statement.
Similarly, the sentence "Bats are better birds" is certainly meaningful, although it will be regarded as true or false according to one's opinion. Yet, for Carnap, "better birds" could not be used meaningfully to qualify bats, because bats are not birds and therefore not better birds.
Now, maybe Carnap provides elsewhere a better justification, but I took the "accepted" answer as giving a full picture of Carnap's position. So, yes, I agree the sentence is a category error, but people like Carnap who think that a category error makes for a meaningless sentences are just wrong. And they certainly have no argument to support their point except their ignorance of how logic works.
The consequence of this is that the accepted answer literally does not answer the question, which is why I wrote my own answer. Mr. Philip Klöcking's moderation is biased by his own views on mathematical logic and related subjects, views which like that of Bertrand Russell and Rudolph Carnap are based on their ignorance of own logic really works. This is why my perfectly legitimate questions and answers are routinely voted down and closed. You should take the time to examine your position.