Git Product home page Git Product logo

prime-ruby-online-web-pt-071519's Introduction

Implementing Prime

Objectives

  1. Practice iteration and looping.
  2. Practice defining methods and controlling return values.

Instructions

Fork and clone this repository. Run the test suite to learn what is required of you.

You'll be defining a method, prime?(), that takes in an integer argument and returns a boolean of whether or not that integer is a prime number.

A few things to think about:

  • What defines an integer as a prime number? Research algorithms for how to determine if a number is prime.
  • How do you create a range of numbers? How do you turn a range into an array so that it can be iterated over?

Requirements:

  • Do not use any other Ruby library. You must build a method that can verify whether a number is prime. Don't require 'math' and just piggyback off their implementation of prime number.

Advanced

Think about the efficiency of your algorithm. How many iterations does it do? Look into Benchmarking in Ruby and profile a few different approaches to implementing prime?().

Resources

View Prime? Lab on Learn.co and start learning to code for free.

prime-ruby-online-web-pt-071519's People

Contributors

ahimmelstoss avatar annjohn avatar arelenglish avatar aviflombaum avatar bhollan avatar curiositypaths avatar deniznida avatar fislabstest avatar fs-lms-test-bot avatar jonbf avatar kthffmn avatar markedwardmurray avatar maxwellbenton avatar mendelb avatar peterbell avatar sarogers avatar sgharms avatar shmuwol avatar sophiedebenedetto 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.