Giter Club home page Giter Club logo

distprime's Introduction

elixir-pdx/distprime


#Overview

This exercise is designed to be an introduction to distributed Elixir programming. This is a partial revisitation of a previous problem we solved together, but with a few additional twists.

The challenge is to write a distributed prime number generator/finder. Such that you could request the Nth prime number and use multiple CPU cores and multiple computers to assist you in finding the answer.

We'll talk about strategies for how we might accomplish this before we begin.

Prerequisites:


#Getting Started

###Clone this repository.

$ cd ~/Repositories
$ git clone https://github.com/elixir-pdx/distprime.git
$ cd distprime

#Hacking

You may find it helpful to play with your code in Elixir's iex interactive console. If you want to do that and autoload the console session with your code then you can do the following from the project root:

$ iex -S mix

That will make sure that you're running iex inside your project's build environment.

#Building

To compile your project simply run this from the project root:

$ mix compile

#Testing

To run the test suite defined in test/distprime_test.exs then run this from the project root:

$ mix test

If you got your project bootstrapped correction you should see something like the following:

Called with 3
Called with 1
Called with 1000000
Called with 1000


  1) test nth_prime with 3 (DistPrimeTest)
     test/distprime_test.exs:8
     Assertion with == failed
     code: DistPrime.nth_prime(3) == 5
     lhs:  3
     rhs:  5
     stacktrace:
       test/distprime_test.exs:9



  2) test nth_prime with 1 (DistPrimeTest)
     test/distprime_test.exs:4
     Assertion with == failed
     code: DistPrime.nth_prime(1) == 2
     lhs:  1
     rhs:  2
     stacktrace:
       test/distprime_test.exs:5



  3) test nth_prime with 1000000 (DistPrimeTest)
     test/distprime_test.exs:16
     Assertion with == failed
     code: DistPrime.nth_prime(1000000) == 15485863
     lhs:  1000000
     rhs:  15485863
     stacktrace:
       test/distprime_test.exs:17



  4) test nth_prime with 1000 (DistPrimeTest)
     test/distprime_test.exs:12
     Assertion with == failed
     code: DistPrime.nth_prime(1000) == 7919
     lhs:  1000
     rhs:  7919
     stacktrace:
       test/distprime_test.exs:13



Finished in 0.03 seconds (0.03s on load, 0.00s on tests)
4 tests, 4 failures

distprime's People

Contributors

nathanaschbacher avatar

Watchers

 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.