Re: LF: PRIME NUMBERS!
[Prev][Next][Index][Thread]
Re: LF: PRIME NUMBERS!
In a message dated 96-12-12 00:56:47 EST, you write:
<< The built in function factor essentially does this.
i.e.
input "enter a number",n
if instring(string(factor(n)),"*") then
disp "not a prime"
else
disp "prime"
endif
I'm not sure what the usefulness of iterating through the prime numbers is,
although even a ti-basic version of the sieve of erastothenes shouldn't be
all that slow.
-Kevin
khuber@mr.net
that1guy@juno.com writes:
> Could someone PLEASE write a Prime-Number finder for Fargo... Nothing
> fancy at all, just something that will handle big numbers. I wrote one
> for ti-basic, but it goes SO SLOW! I think this would be perfect for ASM
> becuase it goes so fast.
>>
how about this:
{}->primelst
for c,1,10000
if c=factor(c) then c->primelst[dim(primelst)+1]
endfor
this works really fast, esp. w/numbers less than 1000. no string and instring
junk to slow it down. (those are search funcs: slow, slow) anyway, tell me if
you like it
Tilde,
Jeffrey :j
JBridge21@aol.com