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