   (let [a' (int-sqrt x)]
     (if (< (- x (sqr a')) (- (sqr (+ 1 a')) x)) a' (+ 1 a'))))
 
-(defn diophantine-solution [d x]
+(defn diophantine-solution
+  "Naive solution !!! Doesn't work :("
+  [d x]
   (let [x2-1 (- (* x x) 1)]
     (if (zero? (rem x2-1 d))
       (let [y2 (/ x2-1 d)

       (first)
       ))

(defn chakravala [d]
  (let [a  (nearest-int-sqrt d)
        b  1
        k  (- (sqr a) d)]
    (println "a b k : " a b k)

    ))

(defn solution []
  (->> (range 2 1001)
       (remove is-square?)
       (map (fn [d] (let [[x y] (diophantine-min-solution-in-x d)]
                      [x d])))
       (sort)
       (last)
       (second)
       ))

          nil))
      nil)))

(defn diophantine-min-solution-in-x
  "Naive solution !!! Doesn't work :("
  [d]
  (->> (iterate inc 2)
       (map (fn [x]
              [x  (diophantine-solution d x)]))
