MathGroup Archive 2003

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

Search the Archive

Counting Twin Primes

  • To: mathgroup at
  • Subject: [mg43621] Counting Twin Primes
  • From: Allan Haley <ashaley at>
  • Date: Tue, 23 Sep 2003 04:02:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

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: Bug!
  • Next by Date: Re: Re: how to import data???
  • Previous by thread: Bug!
  • Next by thread: Re: Counting Twin Primes