# copy paste these into sage def count(K, n): # K is a number field # counts the number of ideals of norm <= n return sum([len(x) for x in K.ideals_of_bdd_norm(n).values()]) def estimate(K): r = len(K.real_embeddings()) s = (len(K.complex_embeddings())-r)/2 R = K.regulator() w = K.number_of_roots_of_unity() d = K.discriminant() h = K.class_number() return n(2^r * (2*pi)^s * R * h /(w * sqrt(abs(d)))) K = QQ[sqrt(23)] L = QQ[7^(1/9)] M = CyclotomicField(17) count(K,1000)-round(estimate(K)*1000) count(L,1000)-round(estimate(L)*1000) count(M,1000)-round(estimate(M)*1000)