This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import primes | |
def invmod(a, p): | |
''' | |
http://code.activestate.com/recipes/576737-inverse-modulo-p/ | |
The multiplicitive inverse of a in the integers modulo p. | |
Return b s.t. | |
a * b == 1 mod p | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package swank) | |
(setq swank-debugger-hook-orig #'swank-debugger-hook) | |
(defun swank-debugger-hook (condition hook) | |
(etypecase condition | |
(sb-int:simple-stream-error | |
(progn | |
(princ "*** Stream error" *error-output*) | |
(abort))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun search-selection-or-symbol (arg) | |
(interactive "p") | |
(unless (and (local-variable-p 'search-prefix-default) | |
search-prefix-default) | |
(let* ((mode (symbol-name major-mode)) | |
(name (replace-regexp-in-string "-mode$" "" mode)) | |
(prefix (replace-regexp-in-string "-" " " name))) | |
(set (make-local-variable 'search-prefix-default) prefix))) | |
(let* ((prefix (if (= arg 1) | |
search-prefix-default |