Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Euler probl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 10 Topic 4044 of 4065
Post > Topic >>

Re: Euler problem #48

by Albert van der Horst <albert@[EMAIL PROTECTED] > May 9, 2008 at 02:08 AM

In article <5jfbf5-14d.ln1@[EMAIL PROTECTED]
>,
Bernd Paysan  <bernd.paysan@[EMAIL PROTECTED]
> wrote:
<SNIP>
>
>I've tried something else: Using fractional numbers, i.e. scaling by
1e-10
>and having the decimal point on bit 64. The problem is the same: If you
use
>just a 64 bit inverse of 1e10, you don't have much accuracy left. Using
128
>bits requires too many multiplications, and I still didn't get it
accurate
>enough.

This too must work:
If we are prepared to do N^2 operations instead of N log N, for an
exponentiation, we can calculate 877^877 without needing more
precision than double on a 32 bit Forth.
Repeatedly multiply with 877. This remains under 1000*10^10.
Then calculate the last 10 digits by first calculating the
last 5, then the last 5 of the remainder. (Using FM/MOD)
Combine, rinse, repeat.
(OK this is a very limited form of multiple precision.)

(Oeps, we are now into 1000^3 operations. This may become
an overnighty.)

Some of the problems give me the idea I'm cheating when using
a 64 bit Forth, in the sense that you don't need to address the
real challenge.

>
>--
>Bernd Paysan
>"If you want it done right, you have to do it yourself"
>http://www.jwdt.com/~paysan/


--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
 &=n http://home.hccnet.nl/a.w.m.van.der.horst




 10 Posts in Topic:
Euler problem #48
mhx@[EMAIL PROTECTED] (M  2008-05-07 22:55:35 
Re: Euler problem #48
Bernd Paysan <bernd.pa  2008-05-08 11:22:15 
Re: Euler problem #48
anton@[EMAIL PROTECTED]   2008-05-08 10:28:32 
Re: Euler problem #48
Thomas Pornin <pornin@  2008-05-08 14:18:40 
Re: Euler problem #48
Bernd Paysan <bernd.pa  2008-05-08 16:33:41 
Re: Euler problem #48
Albert van der Horst <  2008-05-09 02:08:35 
Re: Euler problem #48
Albert van der Horst <  2008-05-08 17:00:16 
Re: Euler problem #48
William James <w_a_x_m  2008-05-09 08:44:42 
[SPOILER] Re: Euler problem #48
mhx@[EMAIL PROTECTED] (M  2008-05-09 19:13:05 
Re: [SPOILER] Re: Euler problem #48
Albert van der Horst <  2008-05-09 22:07:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 3:26:56 CDT 2008.