Skip to content

Commit cda64e7

Browse files
authored
fix: remove obsolete limitation in torsion unit computation (#1822)
1 parent 3cbd957 commit cda64e7

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/NumFieldOrd/NfOrd/TorsionUnits.jl

+14-3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ end
251251
#
252252
# Magma code:
253253
# [Maximum(&cat[ EulerPhiInverse(d) : d in Divisors(n) | #EulerPhiInverse(d) ne 0 ]) : n in [1..250]];
254+
# Hecke
255+
# [ maximum(vcat([euler_phi_inv(d) for d in divisors(n)]...)) for n in 1:250]
254256
const _euler_phi_inverse_maximum =
255257
[ 2, 6, 2, 12, 2, 18, 2, 30, 2, 22, 2, 42, 2, 6, 2, 60, 2, 54, 2, 66, 2, 46, 2,
256258
90, 2, 6, 2, 58, 2, 62, 2, 120, 2, 6, 2, 126, 2, 6, 2, 150, 2, 98, 2, 138, 2,
@@ -265,14 +267,19 @@ const _euler_phi_inverse_maximum =
265267
2, 6, 2, 810, 2, 6, 2, 726, 2, 446, 2, 870, 2, 454, 2, 458, 2, 94, 2, 708, 2,
266268
158, 2, 12, 2, 478, 2, 1050, 2, 46, 2, 12, 2, 166, 2, 30, 2, 502 ]
267269

270+
#
271+
268272
# One should/could also try to be closer to Algorithm 1
269273
# in Molin, "On the calculation of roots of unity in a number field"
270274
function _torsion_group_order_divisor(K::AbsSimpleNumField)
271-
272275
if degree(K) <= 250
273276
upper_bound = _euler_phi_inverse_maximum[degree(K)]
274277
else
275-
error("Not implemented yet")
278+
l = 0
279+
for d in divisors(degree(K))
280+
l = maximum(euler_phi_inv(d); init = l)
281+
end
282+
upper_bound = l
276283
end
277284

278285
p = upper_bound + 1
@@ -342,7 +349,11 @@ function _torsion_group_order_divisor(K::NumField)
342349
if absolute_degree(K) <= 250
343350
upper_bound = _euler_phi_inverse_maximum[absolute_degree(K)]
344351
else
345-
error("Not implemented yet")
352+
l = 0
353+
for d in divisors(absolute_degree(K))
354+
l = maximum(euler_phi_inv(d); init = l)
355+
end
356+
upper_bound = l
346357
end
347358

348359
p = upper_bound + 1

test/NfOrd/TorsionUnits.jl

+7
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,11 @@
1919
K, a = cyclotomic_field(13, cached = false)
2020
O = maximal_order(K)
2121
@test (@inferred length(Hecke._torsion_units_lattice_enum(O)[1])) == 26
22+
23+
let
24+
p = 2^9
25+
K, a = cyclotomic_field(p)
26+
l = Hecke._torsion_group_order_divisor(K)
27+
@test is_divisible_by(degree(K), euler_phi(l))
28+
end
2229
end

0 commit comments

Comments
 (0)