NextSimpleGroupOrder := function(m) local orders, order, divisors, gcd, q, n; orders := []; #-------------------------------------------------- # Alternating groups: A(n) #-------------------------------------------------- order := 60; n := 6; while order <= m do order := order * n; n := n + 1; od; AddSet(orders, order); #-------------------------------------------------- # Classical Chevalley groups: A_n(q) #-------------------------------------------------- for n in [1..(RootInt(LogInt(m, 2) + 1, 2))] do q := RootInt(m, (n + 1) ^ 2); if n = 1 then q := Maximum(q, 4); fi; divisors := Set(DivisorsInt(n + 1)); repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(n + 1, q - 1); order := q ^ (n * (n + 1) / 2) * Product(List([1..n], i -> q ^ (i + 1) - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; od; #-------------------------------------------------- # Classical Chevalley groups: B_n(q) and C_n(q) #-------------------------------------------------- for n in [2..RootInt(Int((LogInt(m, 2) + 1) / 2) + 1, 2)] do q := RootInt(m, 2 * n ^ 2 + n); if n = 2 then q := Maximum(q, 3); fi; divisors := [1, 2]; repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(2, q - 1); order := q ^ (n ^ 2) * Product(List([1..n], i -> q ^ (2 * i) - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; od; #-------------------------------------------------- # Classical Chevalley groups: D_n(q) #-------------------------------------------------- for n in [4..(RootInt(Int((LogInt(m, 2) + 1) / 2), 2) + 1)] do q := RootInt(m, 2 * n ^ 2 + n); divisors := [1, 2, 4]; repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(4, q ^ n - 1); order := q ^ (n * (n - 1)) * (q ^ n - 1) * Product(List([1..(n - 1)], i -> q ^ (2 * i) - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; od; #-------------------------------------------------- # Exceptional Chevalley groups: E_6(q) #-------------------------------------------------- divisors := [1, 3]; q := RootInt(m, 78); repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(3, q - 1); order := q ^ 36 * Product(List([2, 5, 6, 8, 9, 12], i -> q ^ i - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; #-------------------------------------------------- # Exceptional Chevalley groups: E_7(q) #-------------------------------------------------- divisors := [1, 2]; q := RootInt(m, 133); repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(2, q - 1); order := q ^ 63 * Product(List([2, 6, 8, 10, 12, 14, 18], i -> q ^ i - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; #-------------------------------------------------- # Exceptional Chevalley groups: E_8(q) #-------------------------------------------------- q := RootInt(m, 248); repeat while not IsPrimePowerInt(q) do q := q + 1; od; order := q ^ 120 * Product(List([2, 8, 12, 14, 18, 20, 24, 30], i -> q ^ i - 1)); q := q + 1; until order > m; AddSet(orders, order); #-------------------------------------------------- # Exceptional Chevalley groups: F_4(q) #-------------------------------------------------- q := RootInt(m, 52); repeat while not IsPrimePowerInt(q) do q := q + 1; od; order := q ^ 24 * Product(List([2, 6, 8, 12], i -> q ^ i - 1)); q := q + 1; until order > m; AddSet(orders, order); #-------------------------------------------------- # Exceptional Chevalley groups: G_2(q) #-------------------------------------------------- q := RootInt(m, 14); q := Maximum(q, 3); repeat while not IsPrimePowerInt(q) do q := q + 1; od; order := q ^ 6 * Product(List([2, 6], i -> q ^ i - 1)); q := q + 1; until order > m; AddSet(orders, order); #-------------------------------------------------- # Classical Steinberg groups: 2A_n(q^2) #-------------------------------------------------- for n in [2..RootInt(LogInt(m, 2) + 1, 2)] do q := RootInt(m, (n + 1) ^ 2); if n = 2 then q := Maximum(q, 3); fi; divisors := Set(DivisorsInt(n + 1)); repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(n + 1, q + 1); order := q ^ (n * (n + 1) / 2) * Product(List([1..n], i -> q ^ (i + 1) - (-1) ^ (i + 1))) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; od; #-------------------------------------------------- # Classical Steinberg groups: 2D_n(q^2) #-------------------------------------------------- for n in [4..(RootInt(Int((LogInt(m, 2) + 1) / 2), 2) + 1)] do q := RootInt(m, 2 * n ^ 2 - n); divisors := [1, 2, 4]; if IsEvenInt(n) then RemoveSet(divisors, 4); fi; repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(4, q ^ n + 1); order := q ^ (n * (n - 1)) * (q ^ n + 1) * Product(List([1..(n - 1)], i -> q ^ (2 * i) - 1)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; od; #-------------------------------------------------- # Exceptional Steinberg groups: 2E_6(q^2) #-------------------------------------------------- q := RootInt(m, 78); divisors := [1, 3]; repeat while not IsPrimePowerInt(q) do q := q + 1; od; gcd := GcdInt(3, q + 1); order := q ^ 36 * Product(List([2, 5, 6, 8, 9, 12], i -> q ^ i - (-1) ^ i)) / gcd; if order > m and gcd in divisors then AddSet(orders, order); SubtractSet(divisors, DivisorsInt(gcd)); fi; q := q + 1; until Length(divisors) = 0; #-------------------------------------------------- # Exceptional Steinberg groups: 3D_4(q^3) #-------------------------------------------------- q := RootInt(m, 28); repeat while not IsPrimePowerInt(q) do q := q + 1; od; order := q ^ 12 * (q ^ 8 + q ^ 4 + 1) * (q ^ 6 - 1) * (q ^ 2 - 1); q := q + 1; until order > m; AddSet(orders, order); #-------------------------------------------------- # Suzuki groups: 2B_2(q) #-------------------------------------------------- n := 0; repeat n := n + 1; q := 2 ^ (2 * n + 1); order := q ^ 2 * (q ^ 2 + 1) * (q - 1); until order > m; AddSet(orders, order); #-------------------------------------------------- # Ree groups: 2F_4(q) #-------------------------------------------------- if m < 17971200 then AddSet(orders, 17971200); fi; n := 0; repeat n := n + 1; q := 2 ^ (2 * n + 1); order := q ^ 12 * (q ^ 6 + 1) * (q ^ 4 - 1) * (q ^ 3 + 1) * (q - 1); until order > m; AddSet(orders, order); #-------------------------------------------------- # Ree groups: 2G_2(q) #-------------------------------------------------- n := 0; repeat n := n + 1; q := 3 ^ (2 * n + 1); order := q ^ 3 * (q ^ 3 + 1) * (q - 1); until order > m; AddSet(orders, order); #-------------------------------------------------- # Sporadic groups #-------------------------------------------------- if m < 7920 then AddSet(orders, 7920); elif m < 95040 then AddSet(orders, 95040); elif m < 175560 then AddSet(orders, 175560); elif m < 443520 then AddSet(orders, 443520); elif m < 604800 then AddSet(orders, 604800); elif m < 10200960 then AddSet(orders, 10200960); elif m < 44352000 then AddSet(orders, 44352000); elif m < 50232960 then AddSet(orders, 50232960); elif m < 244823040 then AddSet(orders, 244823040); elif m < 898128000 then AddSet(orders, 898128000); elif m < 4030387200 then AddSet(orders, 4030387200); elif m < 145926144000 then AddSet(orders, 145926144000); elif m < 448345497600 then AddSet(orders, 448345497600); elif m < 460815505920 then AddSet(orders, 460815505920); elif m < 495766656000 then AddSet(orders, 495766656000); elif m < 42305421312000 then AddSet(orders, 42305421312000); elif m < 64561751654400 then AddSet(orders, 64561751654400); elif m < 273030912000000 then AddSet(orders, 273030912000000); elif m < 51765179004000000 then AddSet(orders, 51765179004000000); elif m < 90745943887872000 then AddSet(orders, 90745943887872000); elif m < 4089470473293004800 then AddSet(orders, 4089470473293004800); elif m < 4157776806543360000 then AddSet(orders, 4157776806543360000); elif m < 86775571046077562880 then AddSet(orders, 86775571046077562880); elif m < 1255205709190661721292800 then AddSet(orders, 1255205709190661721292800); elif m < 4154781481226426191177580544000000 then AddSet(orders, 4154781481226426191177580544000000); elif m < 808017424794512875886459904961710757005754368000000000 then AddSet(orders, 808017424794512875886459904961710757005754368000000000); fi; return Minimum(orders); end;