16/12/31 22:56:06.40 07cXWtfS.net
>>31 Emacs Lisp
(require 'cl-lib)
(defun a (x)
(cl-assert (and (integerp x) (> x 1)))
(let ((l (let ((max-lisp-eval-depth most-positive-fixnum)
(max-specpdl-size most-positive-fixnum))
(b (cl-loop for i from 2 to x collect i)))))
(when (= (car (last l)) x) (length l))))
(defun b (l)
(when l
(cons (car l) (b (cl-remove-if (lambda (x) (= (% x (car l)) 0)) (cdr l))))))
(mapcar (lambda (x) (cons x (a x))) '(2 3 4 5 2017))
((2 . 1) (3 . 2) (4) (5 . 3) (2017 . 306))