On 24 Apr 2013 10:42, "Shannon Severance" <s...@s53.me> wrote:
>       (define sqrt-n (inexact->exact (ceiling(sqrt n))))

Racket has integer-sqrt, which saves you defining sqrt-n every time.
Also worth noting is sqr, which covers the occasions you want (* x x) or
(expt x 2)

Customer testimonial:
> I have used integer-sqrt in lots of Project Euler problems. It has never
let me down!
>  - Tim, Epsom

--
sent from my phone
consider yourself lucky if you get
all the right letters in the right order
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to