Sieve of Eratosthenes

Here is an Angular implementation of the Sieve of Eratosthenes. The Sieve of Eratosthenes is an algorithm for finding prime numbers up to a given limit - in this example 100. Implemented in less than 60 lines of JavaScript (using AngularJS and UnderscoreJS), CSS and HTML (all rudely and obtrusively included inline). Shows off a simple angular application consisting of a module and single controller, and the use of the ng-repeat, ng-style and ng-click directives. With all of the implementations of the algorithm floating around, it is nice to use the power of angular to provide a bit of visibility into how the algorithm works.

comments powered by Disqus