On the prime ideal theorem and irregularities in the distribution of primes