Prime numbers

Prime numbers

Post by Erro » Thu, 16 Sep 1999 04:00:00



Is there a script that could generate prime numbers.  I am thinking of
using an item number that would be divisable by a prime that could be
generated by the record number?

In other words the item in the third record would be 7 and in the next
would be 11.

I want to use this as a  hidden code so that people trying to duplicate
the number could not just randomly generate one.

errol

 
 
 

Prime numbers

Post by Hans Rijnbo » Sat, 18 Sep 1999 04:00:00



>Is there a script that could generate prime numbers.  I am thinking of
>using an item number that would be divisable by a prime that could be
>generated by the record number?

Errol,
Yes, you could write a script that calculates the next prime, but the
simplest I could think of still requires multiple loops through all
records of your file. Much easier and faster to have a numbered list of
primes in a separate lookup file and look them up via the record number.

--
Hans Rijnbout
Bureau Scheikunde, Sorbonnelaan 16
Postbus 80.083, NL-3508 TB  UTRECHT
tel: +31 30 253 4567 fax: +31 30 253 3072

 
 
 

Prime numbers

Post by Simon Slav » Sat, 18 Sep 1999 04:00:00




> Is there a script that could generate prime numbers.  I am thinking of
> using an item number that would be divisable by a prime that could be
> generated by the record number?

> In other words the item in the third record would be 7 and in the next
> would be 11.

You can do this in FileMaker (I'd beginning to suspect that you
can do /anything/ in FileMaker if you're sufficiently clever and
willing to wait long enough).  But the calculations will take
longer the higher the number gets: by the time your numbers are
in the thousands it'll take thirty times as long.

Quote:> I want to use this as a  hidden code so that people trying to duplicate
> the number could not just randomly generate one.

I'd suggest that you use a fixed-time process to generate a
check-digit instead.  That would be more appropriate.

Simon.
--
<http://www.hearsay.demon.co.uk> | ... you start off with a typical message,
           No junk email please. | let's say a 2.5MB Word document containing
 ET may've phoned /us/.          | three lines of text and a macro virus ...

 
 
 

Prime numbers

Post by Erro » Sat, 18 Sep 1999 04:00:00


Thanks for the response.  While I was waiting for something to come up on the
newsgroup I found a list of 1000 prime numbers with commas.  I will make a lookup
or something based on the list.

I am not sure what you mean by your comment below.

errol

> I'd suggest that you use a fixed-time process to generate a
> check-digit instead.  That would be more appropriate.

> Simon.
> --
> <http://www.hearsay.demon.co.uk> | ... you start off with a typical message,
>            No junk email please. | let's say a 2.5MB Word document containing
>  ET may've phoned /us/.          | three lines of text and a macro virus ...


 
 
 

Prime numbers

Post by Erro » Sat, 18 Sep 1999 04:00:00


Thanks for the response.  While I was waiting for something to come up on the
newsgroup I found a list of 1000 prime numbers with commas.  I will make a lookup
or something based on the list.

I am not sure what you mean by your comment below.

errol

> I'd suggest that you use a fixed-time process to generate a
> check-digit instead.  That would be more appropriate.

> Simon.
> --
> <http://www.hearsay.demon.co.uk> | ... you start off with a typical message,
>            No junk email please. | let's say a 2.5MB Word document containing
>  ET may've phoned /us/.          | three lines of text and a macro virus ...


 
 
 

Prime numbers

Post by Mac_Za » Sun, 19 Sep 1999 04:00:00





>>Is there a script that could generate prime numbers.  I am thinking of
>>using an item number that would be divisable by a prime that could be
>>generated by the record number?

> Errol,
> Yes, you could write a script that calculates the next prime, but the
> simplest I could think of still requires multiple loops through all
> records of your file. Much easier and faster to have a numbered list of
> primes in a separate lookup file and look them up via the record number.

Do an Archie/sherlock search for a nifty little app called:
"PrimeNoGenerator 1.0"  it will calculate the nth prime number you request
it to, and write them all in a tab delimited window. (save the file and open
it with something heavier duty than SimpleText)  (The app will do the
10000th prime number on my PBG3/292 in about a minute)
   Hint: to have the report it generates remember all the primes it
generates, SIGNIFICANTLY increase the allotted memory.
  I've had this file kicking around on my hard disk forever, and I am no
longer sure where I got it from.

Good luck

Chris

 
 
 

1. Prime Numbers

Do you happen to need to know all the prime numbers between, say,
8,123,456,789,000,000 and 8,123,456,790,000,000?

Or maybe you'd just like to say for sure if 6,000,000,016,333,021 is a prime
number.

Can you figure this out with dBASE or FoxPro?

The answer is yes, no problemo.

Okay, here's the story:  I was cleaning house the other day and I ran across a
bench marking program I wrote back in my QA engineer days at Borland (I updated
it slightly a couple of years ago when I got my CD writer).  I never published
this program and it is certainly obsolete but I thought someone might find it
interesting.  It's tricky.  I store all the primes within a range of 30 numbers
in a single byte.  So, the primes within a range of 1 million numbers gets
stored in a table of only 34 k.

This code runs without modification under dBASE IV 2.0, dBASE 5, or FoxPro v
2.5 (it probably runs under other DOS versions but these are the ones I tested
with).  It writes a log file with elapsed times for each range of 1 million.
So, I found it useful for speed benchmarking--comparing xBase versiions and
also comparing hardware setups.

The program uses a table of primes (all primes under 100 million) to facilitate
finding larger primes.  If the program doesn't find this table then it
generates it.  This will take a long time (perhaps overnight or even days on
slow systems).  If you want to skip this step, you could dowload this starter
set of primes.  The file is called

http://www.go2zero.com/1st100ml.dbf  (it's about 3.3 megabytes)

Once you have the first 100 million table, it takes only about 10 seconds on a
fast system to find all the primes in a range of one million (for smallish
primes, say under 100 billion).  The quadrillions take longer of course.

Here's the code:

http://www.go2zero.com/se-prg.txt

--Alan Dechert

2. What's new in BDE 3.5

3. Using prime numbers for variable values???

4. Driver error

5. prime numbers - incorrect....

6. date century compliant using accept

7. How to show picture (OLE) from Access database in VB

8. Is it better to set the freelist to a prime number ?

9. Prime Information - Prime Computer inc. 1991

10. NUMBER(9) UNION NUMBER(9) results in NUMBER(32,32)

11. Saving single prime in CHAR field ???

12. How Determine Prime Index