Impressive improvement! Thanks Matthias.<div><br></div><div>-Joe<br><div><br></div><div><br><div class="gmail_quote">On Sun, Mar 11, 2012 at 4:14 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I believe the code below cuts your running time to one third. -- Matthias<br>
<br>
#lang racket<br>
<br>
(require srfi/13)<br>
<div class="im"><br>
(define (euler4e)<br>
(for*/fold ([greatest 0]) ([first (in-range 101 1000)] [second (in-range first 1000)])<br>
</div> (define prod (* first second))<br>
<div class="im"> (if (palindromic? prod) (max greatest prod) greatest)))<br>
<br>
</div>(define (palindromic? n)<br>
(define s (number->string n))<br>
(define r (string-reverse s))<br>
(string=? s r))<br>
<br>
</blockquote></div><br></div></div>