MathGroup Archive 2003

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39206] 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:50 -0500 (EST)
  • References: <200302020613.BAA11818@smc.vnet.net> <oprjzr3bjbamtwdy@smtp.cox-internet.com>
  • Sender: owner-wri-mathgroup at wolfram.com

<< NumberTheory`NumberTheoryFunctions`
TableForm[{#, n = NextPrime[#^2], n - #^2, N[n/#^2]} & /@ Range[10, 100, 
5],
  TableAlignments -> Center, TableHeadings -> {None, {"n", "First Prime > 
n^2
    ", "Prime minus n^2", "Prime/n^2"}}]

Bobby

On Sun, 02 Feb 2003 18:10:13 -0600, Dr Bob <drbob at bigfoot.com> wrote:

> << 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 
> <diana53xiii at earthlink.remove13.net> 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?
>>
>> 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: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • Next by Date: RE: To verify Cauchy-Riemann relations in complex variable graphically
  • Previous by thread: Re: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • Next by thread: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2