Re: Writing a program to hunt for a prime between n^2 and (n+1)^2

*To*: mathgroup at smc.vnet.net*Subject*: [mg39201] Re: Writing a program to hunt for a prime between n^2 and (n+1)^2*From*: Bill Rowe <listuser at earthlink.net>*Date*: Mon, 3 Feb 2003 01:10:22 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 2/2/03 at 1:13 AM, diana53xiii at earthlink.remove13.net (Diana) wrote: >My program, which is not fancy: >NRange = Flatten[{n, Range[10, 20, 1]}] >NSquared = Flatten[NRange^2] >NPlus1Squared = Flatten[(NRange+1)^2] >FirstPrimeGreaterNSquared=Flatten[{"Prime>n^2",Table[NestWhile[#1+1&,n >^2,!(P rimeQ[#1])&],{n,10,20}]}] >{NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // >TableForm >Are there ideas to make this more snazzy, and accomplish the same >thing? <<NumberTheory`Master` TableForm[ {#,#^2,NextPrime[#^2],(#+1)^2}&/@Range[10,20], TableHeadings->{None,{n,n^2,"Prime>n^2",(n+1)^2}}]