Lisp Count Non Divisible
(defun count-non-divisible (a)
  (let* ((vec (coerce a 'vector))
         (size (length vec))
         (occurrences (make-array (1+ (reduce #'max vec)) :initial-element 0)))
    (loop for v across vec do (incf (aref occurrences v)))
    (loop for v across vec
          collect (let ((count 0) (i 1))
                    (loop while (<= (* i i) v)
                          do (progn
                               (when (zerop (mod v i))
                                 (incf count (aref occurrences i))
                                 (unless (= (/ v i) i)
                                   (incf count (aref occurrences (/ v i)))))
                               (incf i)))
                    (- size count)))))

This counts how often each value appears, then subtracts the divisor matches so you get the non-divisible count for each item.