This file contains hidden or 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
| (ql:quickload 'cl-ppcre) | |
| (defun all-first-registers-to-strings (regex target-string) | |
| "返回TARGET-STRING中所有匹配正则表达式REGEX的字符串属于第一个register的内容。" | |
| (check-type regex string) | |
| (check-type target-string string) | |
| (let ((pos 0) | |
| (strs '())) | |
| (loop | |
| (multiple-value-bind (start end register-begins register-ends) |
This file contains hidden or 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
| ;;; 换个思路? | |
| ;;; 先算出一百万以下的所有素数 | |
| ;;; 基于这个素数表,对每一个数字d都进行快速的因数分解 | |
| ;;; 得到数字d的质因数后,用筛法计算出互质的数字的个数 | |
| (defun generate-prime-numbers (limit) | |
| "计算出所有不大于LIMIT的素数。" | |
| (let ((bitmap (make-array limit :initial-element 1)) | |
| (result '())) | |
| (dotimes (i limit (nreverse result)) | |
| (let ((ele (aref bitmap i))) |
OlderNewer