title: Clojure - Creating a No Divisors function
body: <p>I am really struggling to do this one function. The function is as follows </p>
  
  <blockquote>
    <p>Write a function named no-divisors? which takes an input n. The function should return true if none of the numbers between 2 and √ divide n, and false otherwise. The function should use both your get-divisors function and your divides? function.
        <em>Hint: you will probably need to wrap the divides? function in an anonymous function so that you can pass in the value of n.</em></p>
  </blockquote>
  
  <p>This is my <code>get-divisors</code> function:</p>
  
  <pre><code>(defn get-divisors [n]
    (str (range 2 (inc (Math/floor (Math/sqrt n))))))
  </code></pre>
  
  <p>This is my <code>divides?</code> function:</p>
  
  <pre><code>(defn divide [a b]
    (zero? (mod a b)))
  </code></pre>
  
  <p>I have tried to create a method in order to try and complete this task, however, to no luck. </p>
  
  <p>This is what I tried:</p>
  
  <pre><code>(defn no-divisors [n] 
    divide(n (get-divisors n)))
  </code></pre>
  
  <p>And I received the output:</p>
  
  <pre><code>ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn  user/x (form-init5516475059937019181.clj:16)`
  </code></pre>
  
  <p>I have an idea in mind which I would like to share of how I could create this task, however, since this is my first time using Clojure I am not too sure of to implement this function or if it is even possible. I am extremely sorry that I have mixed syntax, it's just I have never used Clojure up until this point, but here is my draft/blueprint:</p>
  
  <pre><code>(defn no-divisors [n]
    resultsArray = []
      def results((get-divisors n))
      for results in get-divisors
        resultsArray.append(results)
  
        for i=results[0]; i&lt; results.count; i++ 
          divide(n i)
  )
  </code></pre>
  
  <p>I maybe on the right path or probably (most likely) completely wrong. I am grateful and thankful for any/all help I can possibly receive. Just a side note, both my <code>get-divisors</code> and <code>divides?</code> functions work flawlessly. </p>