Counting Twin Primes
- To: mathgroup at smc.vnet.net
- Subject: [mg43621] Counting Twin Primes
- From: Allan Haley <ashaley at nccn.net>
- Date: Tue, 23 Sep 2003 04:02:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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
- Follow-Ups:
- Re: Counting Twin Primes
- From: Bob Walker <walkerbg@ieee.org>
- Re: Counting Twin Primes