MathGroup Archive 2003

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39174] Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • From: "Diana" <diana53xiii at earthlink.remove13.net>
  • Date: Sun, 2 Feb 2003 01:13:25 -0500 (EST)
  • Reply-to: "Diana" <diana53xiii at earthlink.remove13.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?

Thanks,

Diana

"Diana" <diana53xiii at earthlink.remove13.net> wrote in message news:...
> Folks,
>
> I am trying to come up with a snazzy way to hunt for a prime between n^2
and
> (n+1)^2.
>
> Some ideas?
>
> Thanks, Diana
> --
> =====================================================
> "God made the integers, all else is the work of man."
> L. Kronecker, Jahresber. DMV 2, S. 19.
>
>



  • Prev by Date: Problem with NIntegrate -- Monte Carlo
  • Next by Date: Processing lists of unrelated numbers with Do or While statement
  • Previous by thread: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • Next by thread: Re: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2