Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.51 KB | None | 0 0
  1. (defun myfun (x n) (sqrt (- (expt (+ x (isqrt n)) 2) n)))
  2.  
  3. (defun ferma (numb)
  4.     (if (= 0.0 (rem numb (sqrt numb)))
  5.         (cons (sqrt numb) (sqrt numb))
  6.     (loop named test
  7.         for x from 1 to MOST-POSITIVE-FIXNUM
  8.         when (= 0.0 (rem (myfun x numb) 1))
  9.         do (return-from test (cons
  10.             (round (- (+ (isqrt numb) x) (myfun x numb)))
  11.             (round (+ (+ (isqrt numb) x) (myfun x numb)))
  12.         )))))
  13.  
  14. (defun fferma (numb)
  15.     (if (= numb (cdr (ferma numb)))
  16.         numb
  17.         (list (fferma (car (ferma numb))) (fferma (cdr (ferma numb))))
  18.         ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement