You can speed it up a little bit thusly:

      PRINT 'Enter number: ': ; INPUT TARGET
      NUMBER = (2 * INT(TARGET / 2)) + 1
      IF NUMBER NE TARGET THEN PRINT "Even numbers can't be prime."

      PRIME = 0

      LOOP UNTIL PRIME DO
         PRINT NUMBER:' ':
         PRIME = 1
         FOR I = 3 TO INT(SQRT(NUMBER)) + 1 STEP 2
            IF NUMBER/I = INT(NUMBER/I) THEN
               PRIME = 0
               J = I
               EXIT
            END
         NEXT I
         IF NOT(PRIME) THEN
            PRINT '= ':J:' * ':NUMBER / J
            NUMBER += 2
         END
      REPEAT
      PRINT 'is a prime number.'  
   END


Larry Hiscock
Western Computer Services


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allen E. Elwood
Sent: Friday, September 02, 2005 3:04 PM
To: [email protected]
Subject: RE: [U2] Prime number file modulos

Here, try this old code I just dusted off (really old, had a LOTTA dust) :

Amazingly fast for a brute force algorithm...

 *FIND.PRIME written by aee 080888
  PRINT 'Enter Number ':;INPUT TARGET
  ORIGINAL.TARGET = TARGET
  PRIME = 1
  LOOP
    FOR I = 2 TO TARGET-1
      ABC = INT(TARGET / I)
      XYZ = ABC * I
      IF XYZ = TARGET THEN
        PRIME = 0
        I = TARGET
      END
    NEXT I
  WHILE NOT(PRIME) DO
    TARGET += 1
    PRIME = 1
  REPEAT
  IF TARGET = ORIGINAL.TARGET THEN
    PRINT TARGET:' is prime'
  END ELSE
    PRINT 'Next higher prime was : ':TARGET
  END
  STOP

Enjoy!!!!!

Allen
www.tortillafc.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson
Sent: Friday, September 02, 2005 14:41
To: [email protected]
Subject: Re: [U2] Prime number file modulos


I found the resize program and all it did was place the new mod in 013 of
the DL/ID. Its only proof was that it was numeric and not 'even'. Pretty
pathetic.

Thanks
Mark Johnson
----- Original Message -----
From: "Allen E. Elwood" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, September 02, 2005 4:20 PM
Subject: RE: [U2] Prime number file modulos


> >P.S. Could "SLOW" stand for System Loves Overflow Workspace?
>
> Since someone lacked the ability to calculate a prime number, maybe 
> its
>
> Serious Lack Of Writhmatic
>
> which fails the English test as well ;)
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson
> Sent: Friday, September 02, 2005 05:53
> To: [email protected]
> Subject: Re: [U2] Prime number file modulos
>
>
> I just got a copy of the stat report and found over 100 files who's 
> mods
are
> either obviously not prime, ie 1000 or someone's stupid assumption 
> that
1001
> is prime. Plus many of these files are 200%-500% under mod'd (is that 
> a word?). Plus it's the second slowest client of mine (my microdatas 
> are currently the slowest, but sized properly).
>
> I'm checking to see if there's an erroneous resize program or an 
> erroneous resize programmer. Not truly understood back in the day 
> (circa 1978), but prime numbers were stringently insisted when learning
MV101.
>
> Thanks.
> Mark Johnson
>
> P.S. Could "SLOW" stand for System Loves Overflow Workspace?
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Tuesday, August 30, 2005 5:05 PM
> Subject: Re: [U2] Prime number file modulos
>
>
> > The funniest or most gruesome file tuning that I've seen was a few 
> > years ago, at a site that I won't name, who had a master file with a 
> > modulo of exactly 100 and where 99% of the ids were numbers ending 
> > in 00.
> >
> > Definitely not tuned by "FAST"  - -  maybe they'd used "SLOW"?
> >
> > Answering Mark's question, "did it really matter to be prime?"
> >    . . .  No, but if your group distribution is extremely lumpy or 
> > spiky, then, as Henry Eggers once said, your file is walking around 
> > with a sign taped to the back of its shirt, saying, "Hit Me!".
> >
> > --
> > CONFIDENTIALITY:  The information transmitted is intended only for 
> > the person or entity to which it is addressed and may contain 
> > material that is confidential, privileged and exempt from disclosure 
> > under applicable law.
> > Any review, re-transmission, dissemination or other use of, or 
> > taking of any action in reliance upon, this information by persons 
> > or entities other than the intended recipient is prohibited.
> > If you received this in error, please contact the sender and delete 
> > the material in a secure receptacle or by shredding the document 
> > (s).
> > --
> >
> >
> >
> > -----Mark Johnson wrote: -----
> > To: <[email protected]>
> > From: "Mark Johnson" <[EMAIL PROTECTED]> Sent by: 
> > [EMAIL PROTECTED]
> > Date: 08/30/2005 09:16AM
> > Subject: [U2] Prime number file modulos
> >
> > A little non-U2 but I'm sure still answerable by many experienced MV 
> > persons.
> >
> > One client (AP-Pro, Native) reported to me a bunch of GFE's. Upon
further
> > investigation, all of the involved data files had non-prime modulos.
> >
> > This begs the question. Did it really matter to be prime. I 
> > understand
the
> > concept of prime numbers and the many forms of hashing so let's not
> deviate
> > into a hashing thread debate. I'm just interested to learn 
> > first-hand observations on native systems with non-prime file modulos.
> >
> > Thanks in advance.
> > Mark Johnson
> > -------
> > u2-users mailing list
> >  [email protected]
> > To unsubscribe please visit http://listserver.u2ug.org/
> > -------
> > u2-users mailing list
> > [email protected]
> > To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to