6 /* 0 and 1 are not primes */
19 /* this is checked 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 is still found by trialdivision */
57 ifactors(5178997768267);
58 [[183823,1],[28173829,1]];
60 /* disable Pollard p-1 to test Pollard rho */
61 (save_pm1 : pollard_pm1_tests, pollard_pm1_tests : 0);
64 /* this should be found by Pollard rho */
65 ifactors(25091429338142886343);
66 [[3873703993, 1], [6477373951, 1]];
68 (pollard_pm1_tests : save_pm1, 0);
71 (save_prt : pollard_rho_tests, pollard_rho_tests : 0);
74 /* now this should be found by Pollard p-1 */
75 ifactors(25091429338142886343);
76 [[3873703993, 1], [6477373951, 1]];
78 (pollard_rho_tests : save_prt, 0);
81 /* disable Pollard rho and p-1 to test ECM */
82 (save_prt : pollard_rho_tests, pollard_rho_tests : 0);
85 (save_pm1 : pollard_pm1_tests, pollard_pm1_tests : 0);
88 /* now this should be found by ECM */
89 ifactors(25091429338142886343);
90 [[3873703993, 1], [6477373951, 1]];
92 (pollard_rho_tests : save_prt, 0);
95 (pollard_pm1_tests : save_pm1, 0);
98 /* MODULAR POWERS AND INVERSE */
100 power_mod(2^64,2,2^64-2^34+1);
103 inv_mod(42,2^64-2^34+1);
104 18007535864707547137;
106 /* negative exponents */
113 power_mod(2^64,-2,2^64-2^34+1);
114 18446743816011514066;
116 inv_mod(2^128,2^64-2^34+1);
117 18446743816011514066;