Theory of size-selective precipitation