Re: Which TI should I get?
[Prev][Next][Index][Thread]
Re: Which TI should I get?
You don't need an HP desktop; an HP calculator is sufficient.
I tested STL's prime test numbers on three more HP48 number factorers. The
first, FCTR.LIB, was written in a hybrid of assembly language and System RPL
and takes 3.2k of memory. The second, FACTOR, was written in a hybrid of
User RPL and assembly language and takes 2.4k of memory. The third,
FACTNUMS, was written in User RPL and takes 548 bytes of memory.
I included the table from a previous post for comparison and made a second
table showing the results from my tests. The first two in the first table
are on a TI-85 and the rest are on an HP48.
The FACTOR program uses three steps (which it calls Trial Division,
Primetest, and Pollard) to quickly calculate prime factors, though it's not
as fast as ALG48's FCTR routine (and FCTR can even factor polynomials!).
The User RPL program simply uses brute force (though it doesn't check any
factors greater than the square root of the number to test). The other
assembly language program first tests for primality and then calculates
factors if needed (though I'm unsure of the algorithm).
Number: PRIME6: PRIME6B: FCTR(ASM)
9876511 (prime) 17 sec 14 sec 0.6 sec
369758771
(6661*55511) 36 sec 31 sec 1.1 sec
1000000007 (prime) 2 min 51 sec 2 min 21 sec 0.9 sec
17439280249
(55511*314159) 5 min 5 sec 4 min 13 sec 1.9 sec
Number: FCTR.LIB(ASM): FACTOR(ASM): FACTNUMS(URPL):
9876511 (prime) 0.4 sec 1.4 sec 11.0 sec
369758771
(6661*55511) 2.3 sec 2.0 sec 23.6 sec
1000000007 (prime) 0.6 sec 1.8 sec 1 min 58.0 sec
17439280249
(55511*314159) 4.7 sec 3.4 sec 3 min 30.6 sec
All HP48 tests were done on an HP48GX with a 3.93 MHz CPU and 57.3k of user
memory free. Timings were found by Mika Heiskanen's TIM program, which is
the most accurate (to 1/8192 of a second) program timer for the HP48.
I have pasted the source code for the User RPL program, written by John H
Meyers, below, in case anyone wants to make any sense of it. It's commented
(after the @ signs), but it's still hard to read for someone not used to
RPL.
%%HP: T(3); @ \-> is right-arrow, \<- is left-arrow, etc.
@ The symbol at the left end of this line always begins a comment.
DIR @ Directory begins
FACTR @ real_integer(>1) --> { factors }
\<< DEPTH { WHILE DUP2 MOD NOT REPEAT SWAP OVER / OVER END }
\-> d \<-p \<< PRXX
DUP 1 == { DROP } IFT DEPTH d - 1 + \->LIST \>> \>>
PRIM @ real_integer(>1) --> 1 (is prime) or 0 (not prime)
\<< { DUP2 MOD NOT { DUP2 > { DROP2 -1 2 } IFT } IFT }
\-> \<-p \<< PRXX 0 > \>> \>>
PRIN @ real_integer(>1) --> next larger odd prime (not 2)
\<< DUP 2 MOD NOT - DO 2 + UNTIL DUP PRIM END \>>
PRIP @ real_integer(>1) --> next smaller odd prime (not 2)
\<< DUP 2 MOD NOT + DO 2 - UNTIL DUP PRIM END \>>
PRXX @ inner loop for FACTR and PRIM programs
\<< 1 MAX 2 \<-p EVAL 1 + \<-p EVAL 2 + \<-p EVAL 2 +
WHILE DUP2 SQ \>= REPEAT
\<-p EVAL 4 + \<-p EVAL 2 + \<-p EVAL 4 + \<-p EVAL
2 + \<-p EVAL 4 + \<-p EVAL 6 + \<-p EVAL 2 + \<-p EVAL 6 +
END DROP \>>
\pilist @ { factors } --> product
\<< { 1 1 } + \PILIST \>> @ G/GX only
END @ Directory ends
Regards,
Eric Rechlin
Bismarck, ND, USA
eric@ hpcalc.org
http://www.hpcalc.org/
pucufREMOVE@yahoo.com wrote in message
<369a82c2.3194841@news.northcoast.com>...
>How about for instance any HP desktop computer? I say use the right
>tool for the job.
>
>BTW, why do you need to hide behing your aol address?
>
>On 25 Dec 1998 06:30:49 GMT, stl137@aol.com (STL137) wrote:
>
>>I want to see an HP that beats my PRIME6 program, thank you.
>>------
>>STL137@aol.com ~ http://137.tsx.org ~ http://quote.cjb.net
>>I block all unapproved E-mail. If you wish to talk to me, post to
>>alt.test.9 with the subject "Moo" and your E-mail address in the
>>body. I will allow you within a couple of days.
>
>
Follow-Ups:
References: