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

• To: mathgroup at smc.vnet.net
• Subject: [mg39205] Re: [mg39174] Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
• From: Dr Bob <drbob at bigfoot.com>
• Date: Mon, 3 Feb 2003 01:10:44 -0500 (EST)
• References: <200302020613.BAA11818@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```<< NumberTheory`NumberTheoryFunctions`
primeGTnSquare[n_] := NextPrime[n^2]
primeGTnSquare[5000]

25000009

or

TableForm[{#, NextPrime[#^2]} & /@ Range[100],
TableAlignments -> Center,
TableHeadings -> {None, {"n", "First Prime > n^2"}}]

or

TableForm[{#, NextPrime[#^2]} & /@ Range[10, 100, 5],
TableAlignments -> Center, TableHeadings -> {None, {"n", "First Prime >
n^2"}}]

Bobby

On Sun, 2 Feb 2003 01:13:25 -0500 (EST), Diana

> 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.
>>
>>
>
>
>

--
majort at cox-internet.com
Bobby R. Treat

```

• Prev by Date: Re: Processing lists of unrelated numbers with Do or While statement
• Next by Date: RE: Random Trouble
• Previous by thread: Re: 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