File: nth_prime.cpp

package info (click to toggle)
primesieve 5.7.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,064 kB
  • ctags: 1,079
  • sloc: cpp: 5,871; makefile: 232; ansic: 176; sh: 102
file content (19 lines) | stat: -rw-r--r-- 357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/// @example nth_prime.cpp
/// Find the nth prime.

#include <primesieve.hpp>
#include <stdint.h>
#include <iostream>
#include <cstdlib>

int main(int, char** argv)
{
  uint64_t n = 1000;
  if (argv[1])
    n = std::atol(argv[1]);

  uint64_t nth_prime = primesieve::nth_prime(n);
  std::cout << n << "th prime = " << nth_prime << std::endl;

  return 0;
}