MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Matrix Dot Product
  • Next by Date: TraditionalForm of expressions WITHOUT evaluating.
  • Previous by thread: Re: Matrix Dot Product
  • Next by thread: Re: next Prime method from sci.math post