Eisenstein primes: Difference between revisions
Content added Content deleted
m (link labels) |
m (→{{header|Julia}}: round output for compactness) |
||
Line 38: | Line 38: | ||
b::T |
b::T |
||
Eisenstein(a::T, b::T) where {T} = new{T}(a, b) |
Eisenstein(a::T, b::T) where {T} = new{T}(a, b) |
||
Eisenstein(a::T) where {T<: |
Eisenstein(a::T) where {T<:Integer} = new{T}(a, zero(T)) |
||
Eisenstein(a:: |
Eisenstein(a::Integer, b::Integer) = new{eltype(promote(a, b))}(promote(a, b)...) |
||
end |
end |
||
Line 80: | Line 80: | ||
for (i, c) in enumerate(eprimes) |
for (i, c) in enumerate(eprimes) |
||
if i <= printlimit |
if i <= printlimit |
||
print(lpad( |
print(lpad(round(Complex(c), digits = 4), 18), i % 5 == 0 ? "\n" : "") |
||
end |
end |
||
end |
end |
||
Line 96: | Line 96: | ||
</syntaxhighlight>{{out}} |
</syntaxhighlight>{{out}} |
||
<pre> |
<pre> |
||
0. |
0.0 - 1.7321im -1.5 - 0.866im 1.5 - 0.866im -1.5 + 0.866im 1.5 + 0.866im |
||
0.0 + 1.7321im -1.0 - 1.7321im 1.0 - 1.7321im -2.0 + 0.0im 2.0 + 0.0im |
|||
-1.0 + 1.7321im 1.0 + 1.7321im -0.5 - 2.5981im 0.5 - 2.5981im -2.0 - 1.7321im |
|||
2.0 - 1.7321im -2.5 - 0.866im 2.5 - 0.866im -2.5 + 0.866im 2.5 + 0.866im |
|||
-2. |
-2.0 + 1.7321im 2.0 + 1.7321im -0.5 + 2.5981im 0.5 + 2.5981im -1.0 - 3.4641im |
||
-2. |
1.0 - 3.4641im -2.5 - 2.5981im 2.5 - 2.5981im -3.5 - 0.866im 3.5 - 0.866im |
||
- |
-3.5 + 0.866im 3.5 + 0.866im -2.5 + 2.5981im 2.5 + 2.5981im -1.0 + 3.4641im |
||
1.0 + 3.4641im -0.5 - 4.3301im 0.5 - 4.3301im -3.5 - 2.5981im 3.5 - 2.5981im |
|||
- |
-4.0 - 1.7321im 4.0 - 1.7321im -4.0 + 1.7321im 4.0 + 1.7321im -3.5 + 2.5981im |
||
-0. |
3.5 + 2.5981im -0.5 + 4.3301im 0.5 + 4.3301im -2.5 - 4.3301im 2.5 - 4.3301im |
||
- |
-5.0 + 0.0im 5.0 + 0.0im -2.5 + 4.3301im 2.5 + 4.3301im -2.0 - 5.1962im |
||
-3. |
2.0 - 5.1962im -3.5 - 4.3301im 3.5 - 4.3301im -5.5 - 0.866im 5.5 - 0.866im |
||
- |
-5.5 + 0.866im 5.5 + 0.866im -3.5 + 4.3301im 3.5 + 4.3301im -2.0 + 5.1962im |
||
2.0 + 5.1962im -0.5 - 6.0622im 0.5 - 6.0622im -5.0 - 3.4641im 5.0 - 3.4641im |
|||
- |
-5.5 - 2.5981im 5.5 - 2.5981im -5.5 + 2.5981im 5.5 + 2.5981im -5.0 + 3.4641im |
||
5.0 + 3.4641im -0.5 + 6.0622im 0.5 + 6.0622im -2.5 - 6.0622im 2.5 - 6.0622im |
|||
- |
-4.0 - 5.1962im 4.0 - 5.1962im -6.5 - 0.866im 6.5 - 0.866im -6.5 + 0.866im |
||
6.5 + 0.866im -4.0 + 5.1962im 4.0 + 5.1962im -2.5 + 6.0622im 2.5 + 6.0622im |
|||
- |
-0.5 - 7.7942im 0.5 - 7.7942im -6.5 - 4.3301im 6.5 - 4.3301im -7.0 - 3.4641im |
||
7.0 - 3.4641im -7.0 + 3.4641im 7.0 + 3.4641im -6.5 + 4.3301im 6.5 + 4.3301im |
|||
-4.0f0 - 5.196152f0im 4.0f0 - 5.196152f0im -6.5f0 - 0.8660254f0im 6.5f0 - 0.8660254f0im |
|||
-6.5f0 + 0.8660254f0im 6.5f0 + 0.8660254f0im -4.0f0 + 5.196152f0im 4.0f0 + 5.196152f0im |
|||
-2.5f0 + 6.0621777f0im 2.5f0 + 6.0621777f0im -0.5f0 - 7.7942286f0im 0.5f0 - 7.7942286f0im |
|||
-6.5f0 - 4.3301272f0im 6.5f0 - 4.3301272f0im -7.0f0 - 3.4641016f0im 7.0f0 - 3.4641016f0im |
|||
-7.0f0 + 3.4641016f0im 7.0f0 + 3.4641016f0im -6.5f0 + 4.3301272f0im 6.5f0 + 4.3301272f0im |
|||
</pre> |
</pre> |
||
[[File:Plot eisenstein primes julia example.svg|center|Eisenstein primes]] |
[[File:Plot eisenstein primes julia example.svg|center|Eisenstein primes]] |