Changes

no edit summary
Line 9: Line 9:     
==Code==
 
==Code==
  ps=PRIMES(1000)
  −
    .filter((x,i,d)=>d[i]-d[i-1]==2)
  −
    .$("[x-2,x]")
     −
ps.map(r=>1/r[0]+1/r[1])~
+
<br/>PRIMES(1000)
 +
<br/>--> displays first 1000 prime numbers
 +
 
 +
<br/>ps=PRIMES(1000)
 +
<br/>.filter((x,i,d)=>d[i]-d[i-1]==2)
 +
<br/>.$("[x-2,x]")
 +
<br/>--> above code filters the first 1000 primes to check if the difference between two prime numbers is '2' and displays the list of twin primes as (3 5), (5,7), (11,13) etc
 +
This list is stored as a table named 'ps'. Using the below code statement, this table is further used to map it to the reciprocals of the twin primes and add them.
 +
 
 +
 
 +
ps.map(r=>1/r[0]+1/r[1])~
   −
  ps=PRIMES(10000)
  −
    .filter((x,i,d)=>d[i]-d[i-1]==2)
  −
    .$("[x-2,x]")
      
<<[[Learn_ZCubes | Learn ZCubes ]]
 
<<[[Learn_ZCubes | Learn ZCubes ]]
 
<br/>
 
<br/>
 
&copy; Copyright 1996-2020, ZCubes, Inc.
 
&copy; Copyright 1996-2020, ZCubes, Inc.
writer
2,661

edits