consider Z[−5]. Here, we have the equation that 2×3=(1+−5)(1−−5).
Why are 2,3,(1+5),(1−5) prime?
we can enumerate numbers upto a given absolute value. Since the absolute value is a norm and is multiplicative, we only need to check for prime factorization of a given number n in terms of primes p with smaller absolute value (ie, ∣p∣<∣n∣).
If we list numbers in Z[−5] upto norm square 6 (because 6 is the norm square of 1−5), we get:
This was generated from the python code:
classalgnum:def__init__(self, a, b):
self.a = a
self.b = b
def__add__(self, other):return algnum(self.a + other.a, self.b + other.b)def__mul__(self, other):# (a + b \sqrt(-5)) (a' + b' \sqrt(-5))# aa' + ab' sqrt(-5) + ba' sqrt(-5) + bb' (- 5)# aa' - 5 bb' + sqrt(-5)(+ab' +ba')return(self.a * other.b -5* self.b * other.b,
self.a * other.b + self.b * other.a)def__str__(self):if self.b ==0:returnstr(self.a)if self.a ==0:returnf"{self.b}sqrt(-5)"returnf"[{self.a}, {self.b} sqrt(-5)]"defnormsq(self):# (a + b \sqrt(-5))(a - b \sqrt(-5))# = a^2 - (-5) b^2# = a^2 + 5 b^2return self.a * self.a +5* self.b * self.b
defis_zero(self):return self.a ==0and self.b ==0defis_one(self):return self.a ==1and self.b ==0defis_minus_one(self):return self.a ==-1and self.b ==0
__repr__ = __str__
nums =[algnum(a, b)for a inrange(-10,10)for b inrange(-10,10)]defdivisor_candidates(p):return[n for n in nums if n.normsq()< p.normsq() \
andnot n.is_zero() \
andnot n.is_one() \
andnot n.is_minus_one()]# recursive.print("normsq of 2: ", algnum(2,0).normsq());print("normsq of 3: ", algnum(3,0).normsq());print("normsq of 1 + sqrt(-5):", algnum(1,1).normsq());print("potential divisors of 2: ", divisor_candidates(algnum(2,0)))# candidates must be real. Only real candidate is 2.print("potential divisors of 3: ", divisor_candidates(algnum(3,0)))# Candidate must be mixed.print("potential divisors of (1 + sqrt(-5)): ", divisor_candidates(algnum(1,1)))print("potential divisors of (1 - sqrt(-5)): ", divisor_candidates(algnum(1,-1)))