Talk About Network

Google


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: The hardest...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 23 Topic 4031 of 4173
Post > Topic >>

Re: The hardest Euler problem

by mhx@[EMAIL PROTECTED] (Marcel Hendrix) May 4, 2008 at 01:08 PM

cac <cac@[EMAIL PROTECTED]
> writes Re: The hardest Euler problem

> Marcel Hendrix wrote:
>> cac <cac@[EMAIL PROTECTED]
> writes Re: The hardest Euler problem

>> Assuming you are doing this in Forth (why else mention it here):

> Actually, no. I was just responding to an ongoing discussion, and
> going off-topic. My bad. My Forth is very rusty; I haven't written
> anything significant in Forth since about '83. However, it is a
> favorite of mine, and I have recently started to work with it again.

> I have been trying some of the problem in Forth, but my brain is
> old and rusty, and it will take time.

If you are solving #191, there can't be much wrong with it.

>> I also find that some of the higher-numbered problems can be
surprisingly
>> simple. Unfortunately, some others can waste a day (44, 45 I can't
solve
>> by brute force).

> I solved 44 quickly by computing lookup tables, and then searching them.
> 45 I solved by brute force.

Anything over 6 seconds is "can't" for me :-) I finally let #44 run, and
it
found the solution in about 4634 seconds. With the below optimization it  
finds the solution in 9.6 seconds.

-- GUESS guesses the generating n for a (possibly) pentagonal number xd.
-- The guess will always be too low and never less than 1. 
-- This is simply (-b+sqrt(b^2-4ac))/2a.
: guess ( xd -- n ) #24 1 M*/ 1. D+ DSQRT 1+  6 /   1- 1 MAX ;

-marcel
 




 23 Posts in Topic:
The hardest Euler problem
Albert van der Horst <  2008-05-02 11:05:34 
Re: The hardest Euler problem
mhx@[EMAIL PROTECTED] (M  2008-05-02 14:18:00 
Re: The hardest Euler problem
Albert van der Horst <  2008-05-02 16:09:01 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-02 07:40:21 
Re: The hardest Euler problem
William James <w_a_x_m  2008-05-03 17:06:22 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-03 21:36:56 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-03 22:27:03 
Re: The hardest Euler problem
mhx@[EMAIL PROTECTED] (M  2008-05-04 09:13:22 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-04 01:31:32 
Re: The hardest Euler problem
mhx@[EMAIL PROTECTED] (M  2008-05-04 13:08:37 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-04 19:00:19 
Re: The hardest Euler problem
mhx@[EMAIL PROTECTED] (M  2008-05-04 15:41:04 
Re: The hardest Euler problem
anton@[EMAIL PROTECTED]   2008-05-04 13:47:12 
Re: The hardest Euler problem
William James <w_a_x_m  2008-05-05 08:08:17 
Re: The hardest Euler problem
Jonah Thomas <jethomas  2008-05-04 22:51:46 
Re: The hardest Euler problem
cac <cac@[EMAIL PROTEC  2008-05-04 20:44:33 
Re: The hardest Euler problem
William James <w_a_x_m  2008-05-05 10:22:58 
Re: The hardest Euler problem
anton@[EMAIL PROTECTED]   2008-05-05 17:49:46 
Re: The hardest Euler problem
Alex McDonald <blog@[E  2008-05-15 05:20:01 
Re: The hardest Euler problem
Alex McDonald <blog@[E  2008-05-15 06:47:58 
Re: The hardest Euler problem
foxchip <fox@[EMAIL PR  2008-05-23 17:08:24 
Re: The hardest Euler problem
GiulioDeVecchi@[EMAIL PRO  2008-05-15 00:56:07 
Re: The hardest Euler problem
Albert van der Horst <  2008-05-05 00:01:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Jul 25 16:55:53 CDT 2008.