bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13031: large numbers


From: Ludovic Courtès
Subject: bug#13031: large numbers
Date: Thu, 29 Nov 2012 23:11:29 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hi,

Jozef Chraplewski <address@hidden> skribis:

> The solution is trivial:
>
> (define (problem-48 limit)
>  (define (F)
>    (let loop ((n 1)
>               (sum 0))
>      (if (<= n limit)
>          (loop (+ n 1) (+ sum (expt n n)))
>          sum)))
>
>  (let* ((str (number->string (F)))
>           (len (string-length str)))
>    (substring str (- len 10) len)))
>
> (display (problem-48 1000))
> (newline)
>
>
> The proper answer is 9110846700 but guile returns 6457854188

I also get 9110846700 with 2.0.6+ and 1.8.8+.  What version do you use?

(Bigloo 3.2a returns 5842605292, though.)

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]