Function: calcFunc-moebius

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

Signature

(calcFunc-moebius N)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
(defun calcFunc-moebius (n)
  (if (Math-messy-integerp n)
      (setq n (math-trunc n)))
  (if (and (Math-natnump n) (not (eq n 0)))
      (if (< n 2)
	  (if (Math-negp n)
	      (calcFunc-moebius (math-abs n))
	    1)
	(let ((factors (cdr (calcFunc-prfac n)))
	      (mu 1))
	  (if math-prime-factors-finished
	      (progn
		(while factors
		  (setq mu (if (equal (car factors) (nth 1 factors))
			       0 (math-neg mu))
			factors (cdr factors)))
		mu)
	    (calc-record-why "Number too big to factor" n)
	    (list 'calcFunc-moebius n))))
    (calc-record-why 'posintp n)
    (list 'calcFunc-moebius n)))