// Example code from paper 1: // _Some computational experiments in number theory_ by Wieb Bosma // print "Examples from: Some computational experiments in number theory"; load "Paper01_funcs"; ei := GetEchoInput(); SetEchoInput(true); // Section 2: Covering systems for c := 2 to 10 do D := 0; done := false; repeat D +:= 4; S := [ x : x in Divisors(D) | x ge c ]; if &+[ Integers() | D div s : s in S ] ge D then done, F := try2cover(S, D); end if; until done; print < Min([ f[2] : f in F ]), D, F >; end for; m := [ 0, 0, 1, 3, 7, 23 ]; P := [ 3, 7, 5, 17, 13, 241 ]; N := CRT([ 2^j : j in m ], P); N; N + &*P; Q := &*P; Q; H := InverseMod(-N, Q); H; for k := 0 to 100 do print k, [ p : p in P | (H*2^k+1) mod p eq 0 ]; end for; // Section 3: Covering systems and explicit primality tests S := [ 2,3,4,9,12,18,36 ]; CS := [ ]; K := CartesianProduct([ Integers(i) : i in S ]); for x in K do C := [ [ Integers() ! x[i], S[i] ]: i in [1..#S] ]; if check(C) then Append(~CS, C); end if; end for; P := [ 3, 7, 5, 73, 13, 19, 109 ]; H := CRT([ -Modexp(2, -C[i][1], P[i]) : i in [1..#C] ], P); P := [ 3, 7, 5, 73, 13, 19, 37 ]; H := CRT([ -Modexp(2, -C[i][1], P[i]) : i in [1..#C] ], P); C := [ [1,3], [2,4], [2,6], [3,8], [0,12], [7,16], [5,16], [18,24], [30,48], [6,48] ]; P := [ 13, 5, 7, 41, 73, 17, 193, 6481, 97, 577 ]; H := CRT([ -Modexp(3, -C[i][1], P[i]) : i in [1..#C] ], P); // Section 4: The totient function A := 35; P := [ n : n in [2..A] | IsPrime(n) ]; E := [ Floor(A/p) : p in P ]; C := CartesianProduct([ [e..0 by -1] : e in E ]); for c in C do nfn := SeqFact([
: i in [1..#P] | c[i] ne 0 ]);
if EulerPhi(DivisorSigma(1, nfn)) eq Facint(nfn) then
print nfn;
end if;
end for;
// Section 5: Class number relations
permcharmat( Alt(4) );
relations := func< G | Kernel( permcharmat(G) ) >;
relations( Alt(4) );
G := Sym(6);
U := sub< G | (1,2)(3,4), (1,3)(2,4), (1,4)(2,3) >;
V := sub< G | (1,2)(3,4), (1,2)(5,6), (3,4)(5,6) >;
PermutationCharacter(G, U);
PermutationCharacter(G, V);
Induction(PrincipalCharacter(U), G) eq PermutationCharacter(G, U);
for n := 1 to 12 do
for k := 1 to NumberOfTransitiveGroups(n) do
G := TransitiveGroup(n, k);
U := Stabilizer(G, 1);
chi := PermutationCharacter(G, U);
S := Subgroups(G : OrderEqual := Order(G) div n);
if exists(i){ i : i in [1..#S] |
PermutationCharacter(G, V) eq chi and IsEmpty(Fix(V))
where V := S[i]`subgroup }
then
< n, k, Order(G) >;
end if;
end for;
end for;
// The next line is a modified print line for the above, as described
// at the bottom of page 24:
// < n, k, G, U, S[i]`subgroup >;
F ;
end for;
SetEchoInput(ei);
:= FunctionField(Rationals(), 2);
Q