6 /* 0 and 1 are not primes */
19 /* this are checkd from the list of small primes */
26 /* this is the deterministic primality test */
30 primep(5178997768267);
33 next_prime(100002100000);
36 prev_prime(100002100042);
39 /* Bug reported on mailing list by Walter Faxon on October 25th, 2017: "Bug in Maxima function primes()" */
40 [primes(10005, 10009), primes(10006, 10009), primes(10007, 10009), primes(10008, 10009), primes(10009, 10009), primes(10010, 10010), primes(9972, 10007), primes(9973, 10007), primes(1, 2), primes(2, 2), primes(2, 3)];
41 [[10007, 10009], [10007, 10009], [10007, 10009], [10009], [10009], [], [9973, 10007], [9973, 10007], [2], [2], [2, 3]]$
50 [[2,4],[3,4],[5,2],[7,1]];
52 /* limiting to factors */
53 ev( ifactors(226800), factors_only:true );
56 /* this should be found by Pollard rho */
57 ifactors(5178997768267);
58 [[183823,1],[28173829,1]];
60 /* disable Pollard rho to test ECM */
61 (save_prt : pollard_rho_tests, pollard_rho_tests : 0);
64 /* this should be found by ECM */
65 ifactors(5178997768267);
66 [[183823,1],[28173829,1]];
68 (pollard_rho_tests : save_prt, 0);
71 /* MODULAR POWERS AND INVERSE */
73 power_mod(2^64,2,2^64-2^34+1);
76 inv_mod(42,2^64-2^34+1);
79 /* negative exponents */
86 power_mod(2^64,-2,2^64-2^34+1);
89 inv_mod(2^128,2^64-2^34+1);