Re: Counting Twin Primes
- To: mathgroup at smc.vnet.net
- Subject: [mg43687] Re: Counting Twin Primes
- From: "Peter Pein" <peter1963 at totalise.co.uk>
- Date: Tue, 30 Sep 2003 16:42:35 -0400 (EDT)
- References: <bkp0dp$cho$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
tp=TwinPrimes[10^5]; Length[tp] will give you what you want. Peter PS. please excuse the empty post "Allan Haley" <ashaley at nccn.net> schrieb im Newsbeitrag news:bkp0dp$cho$1 at smc.vnet.net... > 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 > >