Advertisement
Guest User

Untitled

a guest
Oct 12th, 2010
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.40 KB | None | 0 0
  1. (defn perfectSquare[aux num numero]
  2.   (let [auxN (+ aux num)]
  3.    
  4.     (cond (= auxN numero) auxN,
  5.       (> auxN numero) num,
  6.       :else (+ num (perfectSquare auxN (+ num 2) numero)  ))))
  7.  
  8.  
  9. (defn test [x]
  10.   (dotimes [n x] (def value (perfectSquare 0 1 (- n 1)))
  11.     (if (= value n) "is a perfect quare" "isn't")
  12.     )
  13.  
  14.  
  15.  
  16.  
  17. ;test 5 (should run my test 5 times using 'n' as 0 until 5 (or 4..)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement