Giter VIP home page Giter VIP logo

primesievejs's Introduction

PrimeSieveJS

How to run: As this was implemented using Node.js you will need to have this installed. To run the file, navigate the directory the file is cloned to in your preffered command prompt (eg Powershell, Command prompt, Cmder etc.) Enter your selected amount of primes and it should be output as a table. Due to many command prompts not featuring horizontal scrolling I have also stored the results in a seperate file called results.txt, though this file is not properly formatted

This was implemented using Node.js and npm, as I realised quite early on that a large amount of numbers would end up crashing any browser that tried to load a ~1000000 x ~1000000 table without using any sort of buffering.

Originally hoping to implement an incremental sieve of Eratosthenes, I quickly found that I had trouble understanding the exact algorithm for implementation. I then decided to implement a segemented sieve of Eratosthenes that would increment its upper boundary until the correct amount of primes had been found.

I'm quite happy with the fact I can generate, parse into a table and store to a file a 34 x 34 prime matrix(the table size my laptop can handle before it begins wrapping) all within 0.8 seconds.

In the future I'd like to try taking the time to implement the sieve via Elixir as being a functional language it is perfect for recurring through such large numbers. I'd like to try implementing a web page buffer for my JS code to try as well as using proper unit testing. I have attempted this in the past but have been unable to grasp the concept fully.

Packages used https://nodejs.org/en/ https://www.npmjs.com/package/cli-table

primesievejs's People

Contributors

canicholson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.