From: ludo@gnu.org (Ludovic Courtès)
To: Jozef Chraplewski <jozef@applicake.com>
Cc: 13031@debbugs.gnu.org
Subject: bug#13031: large numbers
Date: Thu, 29 Nov 2012 23:11:29 +0100 [thread overview]
Message-ID: <87pq2w2h66.fsf@gnu.org> (raw)
In-Reply-To: <7B53D3D8-EDFE-47B5-93C1-FD52B21A3F39@applicake.com> (Jozef Chraplewski's message of "Thu, 29 Nov 2012 09:42:09 +0100")
Hi,
Jozef Chraplewski <jozef@applicake.com> 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’.
next prev parent reply other threads:[~2012-11-29 22:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 8:42 bug#13031: large numbers Jozef Chraplewski
2012-11-29 19:08 ` Noah Lavine
2012-11-29 19:15 ` Stefan Israelsson Tampe
2012-11-29 22:11 ` Ludovic Courtès [this message]
2012-11-30 11:54 ` Jozef Chraplewski
2012-11-30 16:27 ` Ludovic Courtès
2012-11-30 17:33 ` Mark H Weaver
2012-12-01 5:22 ` Mark H Weaver
2012-12-03 16:35 ` Jozef Chraplewski
2012-12-04 0:13 ` Mark H Weaver
2012-12-05 16:20 ` Mark H Weaver
2012-12-07 10:40 ` Jozef Chraplewski
2012-12-07 17:06 ` Mark H Weaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pq2w2h66.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=13031@debbugs.gnu.org \
--cc=jozef@applicake.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).