anchor.diff:        (format-place-cells stream object 'reader-place 'integer-length
                             :label "Length (bits)")
         (format-place-cells stream object 'reader-place 'logcount
  -                          :label "Hamming weight"))))
  +                          :label "Hamming weight"))
  +
  +    ;; Prime factors.
  +    (unless (<= -3 object 3)
  +      (formatting-row (stream)
  +        (with-style (stream :slot-like)
  +          (formatting-cell (stream) (write-string "Factors" stream))
  +          (formatting-cell (stream) (declare (ignore stream))))
  +        (formatting-cell (stream)
  +          (with-placeholder-if-emtpy (stream)
  +            ((not (prime-factors-p state))
  +             "Cowardly refusing to compute prime factors")
  +            (t
  +             ;; Print prime factors with exponents. Avoid offsetting
  +             ;; the whole line if all exponents are 1.
  +             (let ((factors (prime-factors (abs object))))
  +               (flet ((print-factors (&optional sup)
  +                        (when (minusp object)
  +                          (write-string "-1 × " stream))
  +                        (loop for ((factor . exponent) . rest) on factors
  +                              do (princ factor stream)
  +                                 (unless (= exponent 1)
  +                                   (funcall sup (curry #'princ exponent)))
  +                                 (when rest (write-string " × " stream)))))
  +                 (if (find 1 factors :test #'/= :key #'cdr)
  +                     (call-with-superscript #'print-factors stream)
  +                     (print-factors)))))))))))
   
   (defmethod inspect-object-using-state ((object ratio)
                                          (state  inspected-object)
  
positive.code:     (limits)))
  
  (defmethod inspect-object-using-state ((object integer)
                                         (state  inspected-object)
                                         (style  (eql :expanded-body))
                                         (stream t))
    (formatting-table (stream)
  
negative.code: ;;;; Boston, MA  02111-1307  USA.
  
  (cl:in-package #:clouseau)
  
  ;;; Utilities
  
  (defun prime-factors (integer)
    (declare (optimize speed (debug 1) (safety 1))
             (type (unsigned-byte 32) integer))
    (let ((factors '()))
      (labels ((add-factor (factor)
                 (declare (type (unsigned-byte 32) factor))
                 (let ((first (first factors)))
                   (if (or (null first) (/= factor (the (unsigned-byte 32)
                                                        (car first))))
                       (push (cons factor 1) factors)
                       (incf (the (unsigned-byte 32) (cdr first))))))
               (try (n d upper-bound)
                 (declare (type (unsigned-byte 32) n d upper-bound))
                 (if (> d upper-bound)
                     (add-factor n)
                     (multiple-value-bind (quotient remainder) (truncate n d)
                       (cond ((zerop remainder)
                              (add-factor d)
                              (rec quotient))
                             (t
                              (try n (if (evenp d) (1+ d) (+ d 2)) upper-bound))))))
               (rec (n)
                 (declare (type (unsigned-byte 32) n))
                 (when (>= n 2)
                   (try n 2 (isqrt n)))))
        (rec integer))
      factors))
  
  ;;; Object states
  
  (defclass inspected-integer (inspected-object)
    ((%prime-factors-p :initarg  :prime-factors-p
                       :accessor prime-factors-p
                       :initform nil)))
  
  (defmethod object-state-class ((object integer) (place t))
    'inspected-integer)
  
  (defmethod make-object-state ((object integer) (place t))
    (make-instance (object-state-class object place)
                   :prime-factors-p (<= (abs object) (expt 2 32))))
  
  ;;; Object inspection methods
  
  