Difference between revisions of "ZCubes/Twin Primes & Bruns Theorem"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "==Twin Primes & Bruns Theorem== <br/> Twin primes are prime numbers separated by 2. Viggo Bruns theorem states that sum of reciprocals of twin primes is convergent. This video...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
 
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  
 +
==Code==
  
 +
PRIMES(1000)
 +
--> displays first 1000 prime numbers
  
<<[[Learn_ZCubes | Learn ZCubes ]]
+
ps=PRIMES(1000)
 +
  .filter((x,i,d)=>d[i]-d[i-1]==2)
 +
  .$("[x-2,x]")
 +
--> 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])~
 +
 
 +
 
 +
<br/>
 +
*[[Z3 | Z3 home]]
 +
*[[Z^3 Language Documentation]]
 +
*[[ZCubes_Videos | ZCubes Videos and Tutorials]]
 +
*[[Main_Page | About ZCubes ]]
 +
<br/>
 
<br/>
 
<br/>
&copy; Copyright 1996-2020, ZCubes, Inc.
+
&copy; Copyright 1996-2021, ZCubes, Inc.

Latest revision as of 00:29, 11 March 2021

Twin Primes & Bruns Theorem


Twin primes are prime numbers separated by 2. Viggo Bruns theorem states that sum of reciprocals of twin primes is convergent. This video demonstrates how to test this theorem, using ZCubes. You will observe that the computation is simple and easy in ZCubes, as it takes only 4 lines of code.

Video


Twin Primes & Bruns Theorem














Code

PRIMES(1000)

--> displays first 1000 prime numbers

ps=PRIMES(1000)
 .filter((x,i,d)=>d[i]-d[i-1]==2)
 .$("[x-2,x]")

--> 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])~





© Copyright 1996-2021, ZCubes, Inc.