Eisenstein primes

my \ω = exp 2i × π/3;

sub norm    (@p) { @p[0]² - @p[0]×@p[1] + @p[1]² }
sub display (@p) { (@p[0] + ω×@p[1]).reals».fmt('%+8.4f').join ~ 'i' }

my @E = gather (-10..10 X -10..10).map: -> (\a,\b) {
    take (a,b) if 0 == a|b || a == b ?? (.is-prime and 2 == $_ mod 3 given (a,b)».abs.max) !! norm((a,b)).is-prime
}

(@E.sort: *.&norm).head(100).map(*.&display).batch(4).join("\n").say;

Output:

 -1.5000 -0.8660i  -0.0000 -1.7321i  -1.5000 +0.8660i  +1.5000 -0.8660i
 +0.0000 +1.7321i  +1.5000 +0.8660i  -1.0000 -1.7321i  -2.0000 +0.0000i
 +1.0000 -1.7321i  -1.0000 +1.7321i  +2.0000 +0.0000i  +1.0000 +1.7321i
 -2.0000 -1.7321i  -2.5000 -0.8660i  -0.5000 -2.5981i  -2.5000 +0.8660i
 +0.5000 -2.5981i  -2.0000 +1.7321i  +2.0000 -1.7321i  -0.5000 +2.5981i
 +2.5000 -0.8660i  +0.5000 +2.5981i  +2.5000 +0.8660i  +2.0000 +1.7321i
 -2.5000 -2.5981i  -3.5000 -0.8660i  -1.0000 -3.4641i  -3.5000 +0.8660i
 +1.0000 -3.4641i  -2.5000 +2.5981i  +2.5000 -2.5981i  -1.0000 +3.4641i
 +3.5000 -0.8660i  +1.0000 +3.4641i  +3.5000 +0.8660i  +2.5000 +2.5981i
 -3.5000 -2.5981i  -4.0000 -1.7321i  -0.5000 -4.3301i  -4.0000 +1.7321i
 +0.5000 -4.3301i  -3.5000 +2.5981i  +3.5000 -2.5981i  -0.5000 +4.3301i
 +4.0000 -1.7321i  +0.5000 +4.3301i  +4.0000 +1.7321i  +3.5000 +2.5981i
 -2.5000 -4.3301i  -5.0000 +0.0000i  +2.5000 -4.3301i  -2.5000 +4.3301i
 +5.0000 +0.0000i  +2.5000 +4.3301i  -3.5000 -4.3301i  -5.5000 -0.8660i
 -2.0000 -5.1962i  -5.5000 +0.8660i  +2.0000 -5.1962i  -3.5000 +4.3301i
 +3.5000 -4.3301i  -2.0000 +5.1962i  +5.5000 -0.8660i  +2.0000 +5.1962i
 +5.5000 +0.8660i  +3.5000 +4.3301i  -5.0000 -3.4641i  -5.5000 -2.5981i
 -0.5000 -6.0622i  -5.5000 +2.5981i  +0.5000 -6.0622i  -5.0000 +3.4641i
 +5.0000 -3.4641i  -0.5000 +6.0622i  +5.5000 -2.5981i  +0.5000 +6.0622i
 +5.5000 +2.5981i  +5.0000 +3.4641i  -4.0000 -5.1962i  -6.5000 -0.8660i
 -2.5000 -6.0622i  -6.5000 +0.8660i  +2.5000 -6.0622i  -4.0000 +5.1962i
 +4.0000 -5.1962i  -2.5000 +6.0622i  +6.5000 -0.8660i  +2.5000 +6.0622i
 +6.5000 +0.8660i  +4.0000 +5.1962i  -6.5000 -4.3301i  -7.0000 -3.4641i
 -0.5000 -7.7942i  -7.0000 +3.4641i  +0.5000 -7.7942i  -6.5000 +4.3301i
 +6.5000 -4.3301i  -0.5000 +7.7942i  +7.0000 -3.4641i  +0.5000 +7.7942i

Last updated