Thu Feb 25 19:34:27 MST 1999 aquarius% maple |\^/| Maple V Release 5.1 (WMI Campus Wide License) ._|\| |/|_. Copyright (c) 1981-1998 by Waterloo Maple Inc. All rights \ MAPLE / reserved. Maple and Maple V are registered trademarks of <____ ____> Waterloo Maple Inc. | Type ? for help. # ----------[ M a p l e ]---------- #interface(echo = 3); # ---------- Initialization ---------- > readlib(showtime): > _EnvAllSolutions:= true: > _MaxSols:= 7: > on; # ---------- Number Theory ---------- # Display the largest 6-digit prime and the smallest 7-digit prime # => [999983, 1000003] O1 := [prevprime(1000000), nextprime(1000000)]; [999983, 1000003] time = 0.04, bytes = 56154 # Primitive root => 19 O2 := numtheory[primroot](191); 19 time = 0.03, bytes = 64314 # (a + b)^p mod p => a^p + b^p for p prime and a, b in Z_p [Chris Hurlburt] # See Thomas W. Hungerford, _Algebra_, Springer-Verlag, 1974, p. 121 for a # more general simplification: (a +- b)^(p^n) => a^(p^n) +- b^(p^n) O3 := assume(p, prime): time = 0.08, bytes = 244206 O4 := (a + b)^p mod p; p~ modp((a + b) , p~) time = 0.01, bytes = 5022 O5 := p:= 'p': time = 0.01, bytes = 4570 # Congruence equations. See Harold M. Stark, _An Introduction to Number # Theory_, The MIT press, 1984. # 9 x = 15 mod 21 => x = 4 mod 7 or {4, 11, 18} mod 21 [Stark, p. 68] O6 := msolve(9*x = 15, 21); {x = 18}, {x = 4}, {x = 11} time = 0.05, bytes = 74974 O7 := Roots(9*x - 15) mod 21; [[18, 1], [4, 1], [11, 1]] time = 0.01, bytes = 11566 # 7 x = 22 mod 39 => x = 5 mod 13 or 31 mod 39 [Stark, p. 69] O8 := msolve(7*x = 22, 39); {x = 31} time = 0.01, bytes = 28942 O9 := Roots(7*x - 22) mod 39; [[31, 1]] time = 0.02, bytes = 11370 # x^2 + x + 4 = 0 mod 8 => x = {3, 4} mod 8 [Stark, p. 97] O10 := msolve(x^2 + x + 4 = 0, 8); {x = 3}, {x = 4} time = 0.02, bytes = 24750 O11 := Roots(x^2 + x + 4) mod 8; [[3, 1], [4, 1]] time = 0.02, bytes = 9754 # x^3 + 2 x^2 + 5 x + 6 = 0 mod 11 => x = 3 mod 11 [Stark, p. 97] O12 := msolve(x^3 + 2*x^2 + 5*x + 6 = 0, 11); {x = 3} time = 0.03, bytes = 37002 O13 := Roots(x^3 + 2*x^2 + 5*x + 6) mod 11; [[3, 3]] time = 0.02, bytes = 12630 # {x = 7 mod 9, x = 13 mod 23, x = 1 mod 2} => x = 151 mod 414 [Stark, # p. 76] O14 := chrem([7, 13, 1], [9, 23, 2]); 151 time = 0.02, bytes = 17474 # {5 x + 4 y = 6 mod 7, 3 x - 2 y = 6 mod 7} => x = 1 mod 7, y = 2 mod 7 # [Stark, p. 76] O15 := msolve({5*x + 4*y = 6, 3*x - 2*y = 6}, {x, y}, 7); Error, improper mixture of indeterminates time = 0.02, bytes = 15622 # 2 x + 3 y = 1 mod 5 => # (x, y) = {(0, 2), (1, 3), (2, 4), (3, 0), (4, 1)} mod 5 O16 := msolve(2*x + 3*y = 1, {x, y}, 5); Error, improper mixture of indeterminates time = 0.02, bytes = 13498 # 2 x + 3 y = 1 mod 6 => [Stark, p. 76] # (x, y) = {(2, 1), (2, 3), (2, 5), (5, 1), (5, 3), (5, 5)} mod 6 O17 := solve(2*x + 3*y = 1, {x, y}, 6); Error, invalid arguments time = 0.03, bytes = 37270 # Diophantine equations => x = 2, y = 5 (Wallis) [Stark, p. 147] O18 := isolve(x^4 + 9 = y^2, {x, y}); bytes used=1320888, alloc=1048384, time=0.81 time = 0.56, bytes = 860858 # => x = 11, y = 5 (Fermat) [Stark, p. 147] O19 := isolve(x^2 + 4 = y^3, {x, y}); time = 0.12, bytes = 140026 # => (x, y, t, z, w) = (3, 4, 5, 12, 13), (7, 24, 25, 312, 313), ... # [Stark, p. 154] O20 := System:= {x^2 + y^2 = t^2, t^2 + z^2 = w^2}; 2 2 2 2 2 2 {x + y = t , t + z = w } time = 0.01, bytes = 12242 O21 := isolve(System, {x, y, t, z, w}); time = 0.30, bytes = 264946 O22 := System:= 'System': time = 0.00, bytes = 4118 # Rational approximation of sqrt(3) with an error tolerance of 1/500 => 26/15 O23 := convert(sqrt(3.), rational, 4); 26 -- 15 time = 0.01, bytes = 13410 # Continued fractions => 3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + ... O24 := convert(3.1415926535, confrac); [3, 7, 15, 1, 292, 1, 1, 6] time = 0.02, bytes = 20194 O25 := numtheory[cfrac](3.1415926535, 4); 1 3 + ---------------------- 1 7 + ------------------ 1 15 + ------------- 1 1 + --------- 292 + ... bytes used=2323920, alloc=1572576, time=1.83 time = 0.06, bytes = 82498 # => 4 + 1/(1 + 1/(3 + 1/(1 + 1/(8 + 1/(1 + 1/(3 + 1/(1 + 1/(8 + ... # [Stark, p. 340] O26 := numtheory[cfrac](sqrt(23), 'periodic', 'quotients'); [[4], [1, 3, 1, 8]] time = 0.39, bytes = 491742 # => 1 + 1/(1 + 1/(1 + 1/(1 + ... See Oskar Perron, _Die Lehre von den # Kettenbr\"uchen_, Chelsea Publishing Company, 1950, p. 52. O27 := numtheory[cfrac]((1 + sqrt(5))/2, 'periodic', 'quotients'); [[], [1]] time = 0.12, bytes = 112714 # => 1/(2 x + 1/(6 x + 1/(10 x + 1/(14 x + ... [Perron, p. 353] O28 := numtheory[cfrac]((exp(1/x) - 1)/(exp(1/x) + 1)); Error, unable to compute series time = 0.03, bytes = 38498 # => 1/(2 x + 1/(2 x + 1/(2 x + ... (Re x > 0) From Liyang Xu, ``Method # Derived from Continued Fraction Approximations'', draft. O29 := numtheory[cfrac](sqrt(x^2 + 1) - x, 8, x, 'subdiagonal', 'simple'); 1 ------------------------------------------------- 1 1 + --------------------------------------------- 1 1/x + --------------------------------------- 1 -2 + ---------------------------------- 1 - 1/x + -------------------------- 1 2 + ---------------------- 1 1/x + ---------------- 1 -2 + ----------- - 1/x + ... time = 0.14, bytes = 135938 O30 := numtheory[cfrac]([0, 2*x, 2*x, 2*x, 2*x, 2*x, 2*x, `...`]); 4 2 x (16 x + 16 x + 3) 2 ------------------------- 6 4 2 64 x + 80 x + 24 x + 1 time = 0.02, bytes = 29290 # ---------- Quit ---------- O31 := quit bytes used=3168704, alloc=1769148, time=2.56 real 3.52 user 2.64 sys 0.84