# Beastly Coprimes

View

### DATE: August, 2015

### TECHNOLOGIES

Example of how to use **Web Workers**
on the browser and take advantage of parallel computing.
For the sake of demonstration, a simple algorithm to compute coprime numbers is presented. Specifically,
we need to find all coprime numbers from 1 to 1x10^6 such that added together sum **the number of the beast (666)**.

To compute the coprime numbers, I use an algorithm called Euclid’s algorithm. For each number , the evaluation of is done and if it holds, such number is added to the final result.

# Run | Sequential Time () | Parallel Time () |
---|---|---|

1 | 6.80 | 1.26 |

2 | 6.88 | 1.23 |

3 | 6.74 | 1.22 |

4 | 6.81 | 1.25 |

5 | 6.83 | 1.25 |

Mean |
6.81 |
1.24 |

means the runtime by executing the code using threads.

As you can see, there is a great improvement on the execution time. The *parallel* version works
almost **5.5x** times faster than the *sequential* version.