In mathematics, the phrase "almost all" has a number of specialised uses which extend its intuitive meaning.
"Almost all" is sometimes used synonymously with "all but [except] finitely many" (formally, a cofinite set) or "all but a countable set" (formally, a cocountable set); see almost.
A simple example is that almost all prime numbers are odd, which is based on the fact that all but one prime number are odd. (The exception is the number 2, which is prime but not odd.)
Perversely, if we allow "almost all" to mean "all but a countable set", then it follows that almost all prime numbers are even, since the set of all prime numbers is itself countable.
When speaking about the reals, sometimes it means "all reals but a set of Lebesgue measure zero" (formally, almost everywhere). In this sense almost all reals are not a member of the Cantor set even though the Cantor set is uncountable.
More generally, "almost all" is sometimes used in the sense of "almost everywhere" in measure theory, or in the closely related sense of "almost surely" in probability theory.
In number theory, if P(n) is a property of positive integers, and if p(N) denotes the number of positive integers n less than N for which P(n) holds, and if
(see limit), then we say that "P(n) holds for almost all positive integers n" (formally, asymptotically almost surely).