# HG changeset patch
# User Luis Felipe Tabera Alonso <lftabera@yahoo.es>
# Date 1342456641 -7200
# Node ID 74aba9ed0de63d1d2563c34928fd0be123c395e9
# Parent e9f1521444edad5a826d36a1a0ad88dfb5a27def
Cleanup unexisting methods after #10263
diff --git a/sage/databases/cunningham_tables.py b/sage/databases/cunningham_tables.py
a
|
b
|
|
18 | 18 | return map(Integer,load(file)) |
19 | 19 | else: |
20 | 20 | from warnings import warn |
21 | | warn("You might consider installing the optional package for factoring Cunningham numbers with the following command: ``sage -i cunningham_tables-1.0``") |
| 21 | warn("You might consider installing the optional package for factoring Cunningham numbers with the following command: ``sage -i cunningham_tables``") |
22 | 22 | return [] |
23 | 23 | |
24 | 24 | |
diff --git a/sage/rings/factorint.pyx b/sage/rings/factorint.pyx
a
|
b
|
|
206 | 206 | |
207 | 207 | You need to install an optional package to use this method, |
208 | 208 | this can be done with the following command line: |
209 | | ``sage -i cunningham_tables-1.0`` |
| 209 | ``sage -i cunningham_tables`` |
210 | 210 | |
211 | 211 | INPUT: |
212 | 212 | |
… |
… |
|
216 | 216 | |
217 | 217 | EXAMPLES:: |
218 | 218 | |
219 | | sage: (2^257-1)._factor_cunningham() # optional - cunningham |
| 219 | sage: from sage.rings.factorint import factor_cunningham |
| 220 | sage: factor_cunningham(2^257-1) # optional - cunningham |
220 | 221 | 535006138814359 * 1155685395246619182673033 * 374550598501810936581776630096313181393 |
221 | | sage: ((3^101+1)*(2^60).next_prime())._factor_cunningham(proof=False) # optional - cunningham |
| 222 | sage: factor_cunningham((3^101+1)*(2^60).next_prime(),proof=False) # optional - cunningham |
222 | 223 | 2^2 * 379963 * 1152921504606847009 * 1017291527198723292208309354658785077827527 |
223 | 224 | |
224 | 225 | """ |
diff --git a/sage/rings/finite_rings/element_base.pyx b/sage/rings/finite_rings/element_base.pyx
a
|
b
|
|
41 | 41 | sage: a = Zmod(17)(13) |
42 | 42 | sage: a._nth_root_common(4, True, "Johnston", False) |
43 | 43 | [3, 5, 14, 12] |
| 44 | sage: a._nth_root_common(4, True, "Johnston", cunningham = True) # optional - cunningham |
| 45 | [3, 5, 14, 12] |
44 | 46 | """ |
45 | 47 | K = self.parent() |
46 | 48 | q = K.order() |
… |
… |
|
69 | 71 | else: raise ValueError, "no nth root" |
70 | 72 | self = self**alpha |
71 | 73 | if cunningham: |
72 | | F = n._factor_cunningham() |
| 74 | from sage.rings.factorint import factor_cunningham |
| 75 | F = factor_cunningham(n) |
73 | 76 | else: |
74 | 77 | F = n.factor() |
75 | 78 | from sage.groups.generic import discrete_log |
diff --git a/sage/rings/finite_rings/finite_field_base.pyx b/sage/rings/finite_rings/finite_field_base.pyx
a
|
b
|
|
538 | 538 | """ |
539 | 539 | if self.__factored_unit_order is None: |
540 | 540 | if self.characteristic() in []: # want to be [2,3,5,7,11] once #7240 is finished. |
541 | | self.__factored_unit_order = [(self.order()-1)._factor_cunningham()] |
| 541 | from sage.rings.factorint import factor_cunningham |
| 542 | self.__factored_unit_order = [factor_cunningham(self.order()-1)] |
542 | 543 | else: |
543 | 544 | self.__factored_unit_order = [(self.order()-1).factor()] |
544 | 545 | return self.__factored_unit_order |
diff --git a/sage/rings/finite_rings/integer_mod.pyx b/sage/rings/finite_rings/integer_mod.pyx
a
|
b
|
|
996 | 996 | CRT and p-adic log techniques are used to reduce to this case. |
997 | 997 | 'Johnston' is the only currently supported option. |
998 | 998 | |
| 999 | - ``cunningham`` - bool (default: ``False``); In some cases, |
| 1000 | factorization of ``n`` is computed. If cunningham is set to ``True``, |
| 1001 | the factorization of ``n`` is computed using trial division for all |
| 1002 | primes in the so called Cunningham table. Refer to |
| 1003 | sage.rings.factorint.factor_cunningham for more information. You need |
| 1004 | to install an optional package to use this method, this can be done |
| 1005 | with the following command line ``sage -i cunningham_tables`` |
| 1006 | |
999 | 1007 | OUTPUT: |
1000 | 1008 | |
1001 | 1009 | If self has an `n`\th root, returns one (if ``all`` is ``False``) or a |
… |
… |
|
1092 | 1100 | sage: mod(-1, 4489).nth_root(2, all=True) |
1093 | 1101 | [] |
1094 | 1102 | |
| 1103 | Check that the code path cunningham might be used:: |
| 1104 | |
| 1105 | sage: a = Mod(9,11) |
| 1106 | sage: a.nth_root(2, False, True, 'Johnston', cunningham = True) # optional - cunningham |
| 1107 | [3, 8] |
| 1108 | |
1095 | 1109 | ALGORITHMS: |
1096 | 1110 | |
1097 | 1111 | - The default for prime modulus is currently an algorithm described in the following paper: |
diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
a
|
b
|
|
4599 | 4599 | 2 * 101^2 |
4600 | 4600 | sage: a.squarefree_part(bound=1000) |
4601 | 4601 | 2 |
| 4602 | sage: a.squarefree_part(bound=2**14) |
| 4603 | 2 |
4602 | 4604 | sage: a = 7^3 * next_prime(2^100)^2 * next_prime(2^200) |
4603 | 4605 | sage: a / a.squarefree_part(bound=1000) |
4604 | 4606 | 49 |
… |
… |
|
4633 | 4635 | if bound == -1: |
4634 | 4636 | F = self.factor() |
4635 | 4637 | else: |
4636 | | F = self._factor_trial_division(bound) |
| 4638 | from sage.rings.factorint import factor_trial_division |
| 4639 | F = factor_trial_division(self,bound) |
4637 | 4640 | n = one |
4638 | 4641 | for pp, e in F: |
4639 | 4642 | if e % 2 != 0: |