>>
>>
>>
>>
>>
>>>> Hi there! Of course it is a joke. But
>>
>>>> elect aTruth from ThisJ>ke>
>>
> > A year ago I read a Ivan Bratko's book about Prolog. His exa>p>e
> > for finding largest common divider was so excellent, so I wante> >o
> > write somethithing l>k>.
> > Here it>is>
>>
> > samp>e>;
> > creates row of simple numbers(1,2,3,5,7,1>.>.)
> > and rows of dividers of first simple number(2,4>6>..)
> > from 1>t> Lim
> > et Lim=>0>0000
> > or i=1:1:Lim s ^a(i)=i ;create a row from >u>bers
> > or i=2:1:Lim j a^sample>i>Lim)
> > >quit
> > a(i,Lim) for j=i:i:Lim s ^b(i,j)=j > >a(j)
>> > >q
>
> > As You see, the arithmetical task without any calculations.But > >on't
> > think that it could work an any co>p>ter.
> > It does not contain any errors, but work like "fork bomb". >n>that
> > reason I am afraid>o> it.
> > Have somebody any sugge>ti>ns?
>
> [KSB] Why don't you try it and see? hat are you afraid of> ake
> sure you have enough disk. n the worst case you will have >o take
> control of your computer by powering it down. f you af>aid of
> powering down your computer try it in a virtual machine (you >an get
> one with GT.M pre-instlaled at
http://www.yqcomputer.com/ ;02.zip
> with instructions at
http://www.yqcomputer.com/ ;h...).
> Tell us how it>wo>ks.
>
> >egards
> -- Bhaskar
Thanks, Bhaskar!
You are right. Now is a time to start. And excuse me for my mistake in
the former code.
The right code is follows:
sample ;
creates row of simple numbers(1,2,3,5,7,11...)
and rows of dividers of first simple number(2,4,6...)
from 1 to Lim
et Lim=1000000
or i=1:1:Lim set ^a(i)=i ;create a row from numbers
i=1 for set i=$o(^a(i)) q:i="" job a^sample(i,Lim) ;that's it!
uit
a(i,Lim) for j=i:i:Lim kill ^a(j) set ^b(i,j)=j
uit
With do a^sample it is trivial. But with job...
My reasons to afraid:
1)All former mumpses had fixed quality of jobs
2)I was not sure in $order for that case
3)So simple, powerful and elegant things I wrote twice in my practice.
Also I happy to tell you that the problems with my site seems have
coming to the finish.
The new provider now is registering me url for it.
I am waiting for result and after testing will post a new messages.
Alexander.