[Date Index]
[Thread Index]
[Author Index]
Re: 100 digit base ten primes
*To*: mathgroup at smc.vnet.net
*Subject*: [mg52259] Re: 100 digit base ten primes
*From*: drbob at bigfoot.com (Bobby R. Treat)
*Date*: Thu, 18 Nov 2004 01:44:59 -0500 (EST)
*References*: <cneusb$qc2$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
The code below demonstrates several things:
1) Yes, there's at least one prime between n and n + Log[n]^2. In
fact, there are MANY primes in the range when n is large.
2) The average of those limits (rounded to an integer) almost never
delivers a prime number. (It didn't in your own examples.) Exactly
half the time it's even, for instance.
3) Searching the entire range is silly if you're searching for a
prime; why not stop at the first one you find?
4) The upper bound (and the theorem itself) is irrelevant to a
practical search for primes. It puts a bound on how far you'll have to
search, but knowing that doesn't change the search method in any way.
On another note, Dimensions[a][[1]] is usually computed as Length@a,
and evaluating
PrimeQ[m+Floor[Log[m]^2/2]]==True is the same result as evaluating
PrimeQ[m+Floor[Log[m]^2/2]]
That's False in both cases from your post. Here's a test for exponents
ranging from 1 to 100:
f[n_] = n + Floor[Log[n]^2/2];
g[exp_] = 2^Prime[exp] - 1;
select[exp_] := If[PrimeQ[f[g[exp]]],
f[g[exp]], Sequence @@ {}]
select /@ Range[100]
Length[%]
{3, 8231, 2361183241434822608057,
3064991081731777716716694054300618367237478244367212221}
4
That's four prime numbers in a hundred tries, no better than random,
so let's try replacing f with something else:
f[n_] = 2*n - 1;
select /@ Range[100]
Length[%]
{5, 13, 61, 4093, 16381,
1048573, 16777213, 14272476927\
05959881058285969449495136382746\
621, 239452428260295134118491722\
99223580994042798784118781}
9
Or better yet:
f[n_]=Prime@n;
select/@Range@13
Length@%
{5,17,127,709,17851,84011,1742527,7754017,148948133,11891268397,
50685770143,3839726846299,67756520645293}
13
Thirteen out of thirteen. The fourteenth candidate is too large for
Mathematica's implementation of Prime.
Bobby
Roger Bagula <tftn at earthlink.net> wrote in message news:<cneusb$qc2$1 at smc.vnet.net>...
> Clear[a,b,m,m0,m1,m3]
> (* program for finding primes near 100 digits long base 10 using Mersenne
> seed points*)
> (* cryptography length primes*)
> (* the logically most probable way someone taught*)
> (* traditional number theory might use find 100 digits primes*)
> (* short of using a sieve to 100 decimal places*)
> Table[N[Log[2^Prime[n]]/Log[10]],{n,1,68}]
> $MaxPrecision=Floor[Log[2^Prime[68]]/Log[10]]+1
> m=2^Prime[67]-1
> m0=Floor[m+Log[m]^2]
> (m0-m)/2
> m1=2^Prime[68]-1
> m3=Floor[m1+Log[m1]^2]
> (m3-m1)/2
> a=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m,m0,2}]],1]
> Dimensions[a][[1]]
> (* 1/Log[n] probability test*)
> N[Dimensions[a][[1]]/((m0-m)/2)-1/Log[m0]]
> b=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m1,m3,2}]],1]
> Dimensions[b][[1]]
> N[Dimensions[b][[1]]/((m3-m1)/2)-1/Log[m3]]
> PrimeQ[m+Floor[Log[m]^2/2]]==True
> PrimeQ[m1+Floor[Log[m1]^2/2]]==True
>
> Respectfully, Roger L. Bagula
>
> tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 :
> alternative email: rlbtftn at netscape.net
> URL : http://home.earthlink.net/~tftn
Prev by Date:
**Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data**
Next by Date:
**5.1 graphics updates?**
Previous by thread:
**100 digit base ten primes**
Next by thread:
**Mathematica 2.0 on xp?**
| |