home .. forth .. colorforth mail list archive ..

Re: [colorforth] Euler Project Problems.


On Fri, May 09, 2008 at 04:38:47PM -0600, Ray St. Marie wrote:
> I've spent a day trying to figure out how I will implement larger then
> 32 bit ( 27 really) numbers in colorforth for Project Euler Problem 3.
>
> Find the Greatest Prime Factor of 600851475143.

>
> One of the things I've learn include a "divide and conquer" algorithm
> where the large number is split up into smaller chunks and then
> manipulated in scale and then re-combined.
>
> Also, I've been searching through the Pentium Manuals to see if there
> is integer functions in some of the larger registers on board.

There is a division operator that spans 2 registers, effectively
doing the SM/REM action of ISO Forth in one instruction.
That is 64 by 32 bit division.
It is called IDIV

Then there is a DIV, an unsigned version.

>
> I'm curious as to how some of you more educated programmers would
> proceed... If you would care to elaborate your opinions, please?
>
> I don't have a software guru that helps me with programming and so I
> would really like to hear from someone with more experience.

I have done a multiprecision factoring on the Z80 in 1 Kbyte.
That algorithm would be suitable on colorforth.
It is on my site, programmed in Forth, called Horst algo.

>
> TIA
> Ray
>
> On Thu, May 8, 2008 at 7:52 PM, Ray St. Marie <ray.stmarie@xxxxxxxxx> wrote:
> > On Thu, May 8, 2008 at 7:48 PM, Ray St. Marie <ray.stmarie@xxxxxxxxx> wrote:
> >> On Thu, May 8, 2008 at 6:38 PM, Albert van der Horst
> >> <albert@xxxxxxxxxxxxxxxxxx> wrote:
> >>> On Thu, May 08, 2008 at 09:59:18AM -0600, Ray St. Marie wrote:
> >
> >>>>
> >>>> http://projecteuler.net/
> >>>>
> >>>> I'm fairly certain that I won't be able to do all 200 or so problems
> >>>> without research or help.
> >>>
> >>> I sorted the problems by difficulty, and I'm up to the math, mostly.
> >
> > lol, I'm not up to the math, I can promise you. But that ain't gonna
> > stop me! :-) Never has, never will.
> >
> > Good luck Albert!
> > I suppose you are not going in order then, being that you are looking
> > at them by difficulty. I suppose the trick is to find the hardest
> > problem you can possibly do with out much help, do all of the ones
> > before that one cuz they will be quick, then the rest, hoping what you
> > learned from the ones you did know how to do the ones you don't.
> >
> > Ray
> >
> >>
> >>>
> >>> --
> >>> Albert van der Horst, UTRECHT,THE NETHERLANDS
> >>> Economic growth -- like all pyramid schemes -- ultimately falters.
> >>> albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
> >
> >
> >
> > --
> > Raymond St. Marie ii,
> > colorforthray.info
> >
>
>
>
> --
> Raymond St. Marie ii,
> colorforthray.info
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
> Main web page - http://www.colorforth.com
>

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

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com