Function: calcFunc-nextprime

calcFunc-nextprime is an autoloaded and byte-compiled function defined in calc-comb.el.gz.

Signature

(calcFunc-nextprime N &optional ITERS)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
(defun calcFunc-nextprime (n &optional iters)
  (if (Math-integerp n)
      (if (Math-integer-negp n)
	  2
	(if (and (integerp n) (< n 5003))
	    (math-next-small-prime (1+ n))
	  (if (math-evenp n)
	      (setq n (math-add n -1)))
	  (let (res)
	    (while (not (car (setq res (math-prime-test
					(setq n (math-add n 2))
					(or iters 1))))))
	    (if (and calc-verbose-nextprime
		     (eq (car res) 'maybe))
		(calc-report-prime-test res)))
	  n))
    (if (Math-realp n)
	(calcFunc-nextprime (math-trunc n) iters)
      (math-reject-arg n 'integerp))))