Nth Prime

Find the nth prime number using primality testing.

Code

Algorithms
require 'prime'
return Prime.first(n).last

Parameters

Position (1-indexed)

Server

More Ruby Snippets