Hi Larry,

The system I originally wrote this on didn't work with EXIT.  It would exit
*ALL* loops.  Weird.....

But I like the even number filter!

I was a math major before I started programming.  Took crazy stuff like
Euclidian geometry, planer analytical math, quantum math, etc.  So this was
just a fun little thing I just wanted to do...heh....

The mentally hardest thing I ever had to program was for not breaking ship
packs on sales phantoms.  We would sell towel bars to the builder industry
and they wanted the bars in their own boxes, the brackets in their own
boxes, the hidden brackets in their own boxes, because the finish items were
installed by the finish guy, but the hidden brackets were installed by the
dry wall guys.

The problem was that the hidden brackets came in boxes of 12, the visible
brackets in boxes of 10 and the bars in boxes of 8.  Used to be if they
ordered 300 we would just break open some of the boxes and fill the order
that way.  But when we started working with the 'big' builders they didn't
want any broken boxes because 'shrinkage' would occur.  Shrinkage being
industry standard verbiage for theft.

So I had to figure out a mathematical way of deducing a quantity that, if
they ordered 300, I could tell them how many we could ship them, and also
work availability into that equation.  Because of the different number of
items in each box, it was not just as easy as just dividing removing the
remainder and multiplying.  We had to sell them so that after install there
would be exactly the correct number of items so there were no missing
pieces, or left over pieces.  And it had to be flexible to work with any
number of components because we sold all kinds of stuff like this, not just
towel bars.

Took 4 hours to come up with the idea, and another 2 to program it.

Now figure that one out!!!!!

<grin>

Allen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Larry Hiscock
Sent: Friday, September 02, 2005 23:26
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Prime number file modulos


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: u2-users@listserver.u2ug.org
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: u2-users@listserver.u2ug.org
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: <u2-users@listserver.u2ug.org>
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: u2-users@listserver.u2ug.org
> 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: <u2-users@listserver.u2ug.org>
> 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: <u2-users@listserver.u2ug.org>
> > 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
> >  u2-users@listserver.u2ug.org
> > To unsubscribe please visit http://listserver.u2ug.org/
> > -------
> > u2-users mailing list
> > u2-users@listserver.u2ug.org
> > To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to