Difference between revisions of "ZCubes/Prime Numbers Twins, Cousins, Sexy Primes"
Jump to navigation
Jump to search
(Created page with "==Prime Numbers, Twin Primes, Cousins, Sexy Primes== <br/> This video demonstrates the computations of special prime numbers using ZCubes. Twin primes are prime numbers separa...") |
(→Code) |
||
Line 51: | Line 51: | ||
− | |||
<br/> | <br/> | ||
− | © Copyright 1996- | + | *[[Z3 | Z3 home]] |
+ | *[[Z^3 Language Documentation]] | ||
+ | *[[ZCubes_Videos | ZCubes Videos and Tutorials]] | ||
+ | *[[Main_Page | About ZCubes ]] | ||
+ | <br/> | ||
+ | <br/> | ||
+ | © Copyright 1996-2021, ZCubes, Inc. |
Latest revision as of 00:31, 11 March 2021
Prime Numbers, Twin Primes, Cousins, Sexy Primes
This video demonstrates the computations of special prime numbers using ZCubes. Twin primes are prime numbers separated by two. Cousin primes are prime numbers separated by 4 and sexy primes are separated by six. Using ZCubes you can generate these primes or create functions to generate prime numbers with any gap. You can then do further analysis,
Video
Code
PRIMES(100) .map( (x,i,d)=> [ i d[i], d.slice(0,i), (i>0?d[i]|-|d.slice(0,i):[]) ] )
gap=4 PRIMES(100)//0) .filter( (x,i,d)=> (i>0?d[i]|-|d.slice(0,i):[]) .include(gap) ) .$(x=>[x-gap,x])
function primeswithgap(gap,till) { till=till||100; var ret= PRIMES(till)//0) .filter( (x,i,d)=> ((i>0?(d[i]|-|d.slice(0,i):[]) .include(gap)) ) .$(x=>x-gap,x) return([ret ~]) }
[2..10..2,100]@primeswithgap [2..10..2,1000]@primeswithgap res=[2..30..2,1000]@primeswithgap; res[3]
© Copyright 1996-2021, ZCubes, Inc.