diff --git a/README.md b/README.md index a63b94e..e6c12e5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Prime -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/prime`. To experiment with that code, run `bin/console` for an interactive prompt. - -TODO: Delete this and the text above, and describe your gem +Prime numbers and factorization library. ## Installation @@ -22,13 +20,22 @@ Or install it yourself as: ## Usage -TODO: Write usage instructions here +```ruby +require 'prime' -## Development +# Prime is the set of all prime numbers, and it is Enumerable. +Prime.take(4) #=> [2, 3, 5, 7] +Prime.first(4) #=> [2, 3, 5, 7] +Prime.each(7).to_a #=> [2, 3, 5, 7] -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +# Determining whether an arbitrary integer is a prime number +Prime.prime?(7) #=> true +8.prime? #=> false -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +# Factorization in prime numbers +Prime.prime_division(779) #=> [[19, 1], [41, 1]] +Prime.int_from_prime_division([[19, 1], [41, 1]]) #=> 779 +``` ## Contributing