next Prime method from sci.math post
- To: mathgroup at smc.vnet.net
- Subject: [mg52168] next Prime method from sci.math post
- From: Roger Bagula <tftn at earthlink.net>
- Date: Sat, 13 Nov 2004 04:40:19 -0500 (EST)
- Reply-to: tftn at earthlink.net
- Sender: owner-wri-mathgroup at wolfram.com
I read a post several days ago that said you could find a prime between
n and n+Log[n]^2.
( there also seems to be a NextPrime[] function in Mathematica that I
wasn't aware of)
I tried the average of the two and it works very well
such that there are only a few primes that don't fit that pattern:
(* Primes that aren't at the average of n and n+Log[n]^2 *)
Clear[f]
digits=10000
f[n_]:=Floor[n+Log[n]^2/2]
a=Delete[Union[Table[If[PrimeQ[f[n]]==True,f[n],0],{n,1,digits}]],1];
b=Table[Prime[n],{n,1,Dimensions[a][[1]]}];
Complement[b,a]
{5,37,97,421,673,2659,3407,3847,7703}
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
- Follow-Ups:
- Re: next Prime method from sci.math post
- From: DrBob <drbob@bigfoot.com>
- Re: next Prime method from sci.math post