Elementare Zahlentheorie: Blatt 4
2016-05-16Aufgabe 5
def ps(n): """ Compute how many percent of the primes below `n` have 2 as a primitive root. """ prime_count = pr = 0 for p in prime_range(3, n): prime_count += 1 if Mod(2,p).is_primitive_root(): pr += 1 return N((pr / prime_count) * 100) for i in [1..6]: print ps(10**i)