Windows installer: Update help text for the maxima_longnames program.
[maxima/cygwin.git] / tests / rtestifactor.mac
blob063727000ac7c3cf040147aa3eb571010abd1cec
1 /* kill(all); */
2 /* done; */
4 /* PRIMALITY TESTS */
6 /* 0 and 1 are not primes */
7 primep(0);
8 false;
10 primep(1);
11 false;
13 primep(2);
14 true;
16 primep(6);
17 false;
19 /* this are checkd from the list of small primes */
20 primep(1741);
21 true;
23 primep(8989);
24 false;
26 /* this is the deterministic primality test */
27 primep(1738727);
28 true;
30 primep(5178997768267);
31 false;
33 next_prime(100002100000);
34 100002100043;
36 prev_prime(100002100042);
37 100002099971;
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]]$
43 /* FACTORING TESTS */
45 ifactors(1);
46 [];
48 /* trial divisions */
49 ifactors(226800);
50 [[2,4],[3,4],[5,2],[7,1]];
52 /* limiting to factors */
53 ev( ifactors(226800), factors_only:true );
54 [2,3,5,7];
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);
74 240518168561;
76 inv_mod(42,2^64-2^34+1);
77 18007535864707547137;
79 /* negative exponents */
80 power_mod(3,-1,41);
81 14;
83 inv_mod(3,41);
84 14;
86 power_mod(2^64,-2,2^64-2^34+1);
87 18446743816011514066;
89 inv_mod(2^128,2^64-2^34+1);
90 18446743816011514066;
92 /* zero divisors */
93 inv_mod(3,42);
94 false;
96 power_mod(3,-1,42);
97 false;