MathGroup Archive 2003

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

Search the Archive

Re: Counting Twin Primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43649] Re: [mg43621] Counting Twin Primes
  • From: Bob Walker <walkerbg at ieee.org>
  • Date: Sat, 27 Sep 2003 04:58:12 -0400 (EDT)
  • References: <200309230802.EAA12476@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try,
Count[twinPrims[50], {_Integer, _Integer}]  or
Count[twinPrims[50], _Integer, 2]/2

Also I noticed someone on the list said:
Length[twinPrims[50]]

which also works.

Allan Haley wrote:

>In the Mathematica reference material, there is a defined function to 
>list the twin primes in a given interval, as follows:
>
>TwinPrimes[m__] : = Module[{s = Prime[Range[m]]}, {#, # + 2}& /@ Extract[s,
>Position[Drop[s, 1] - Drop[s, -1], 2]]]
>
>My question is: having defined this function and gotten a list for a 
>given (large) interval m, how do I get Mathematica to tell me the number 
>of twin prime pairs in that interval?  Trying something like
>Count[{TwinPrimes[m]}, _Integer]/2 just gives the output zero.
>
>Thanks in advance,
>
>Allan Haley
>
>
>
>  
>



  • Prev by Date: LogPlot
  • Next by Date: Re: Incorrect integral
  • Previous by thread: Counting Twin Primes
  • Next by thread: Re: Counting Twin Primes