Generating a Sum of Prime Numbers in Ruby

1
1349

This guide walks through how to generate a sum of prime numbers in Ruby.

Summary

Create a method that totals a sequence of prime numbers.

Exercise File

Code File

Exercise Description

After being provided with a number, generate a sequence of prime numbers that are greater than or equal to the given number, and then return the total of the prime numbers.

Sample Input

42

Expected Output

238

Real World Usage

Prime numbers are important in a number of computer science fields, including: security and linear mathematical implementations. This guide will test your knowledge of how to work with the prime number library provided by Ruby.

Solution

Can be found on the solutions branch on github.

1 COMMENT

  1. Hi, what editor are you using for ruby? It looks neat and I like how it shows the results right away. Line by line. Please tell me which one where to find it. Thank you

LEAVE A REPLY

Please enter your comment!
Please enter your name here