File: nextprime.cc

package info (click to toggle)
cln 1.3.1-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,056 kB
  • ctags: 16,803
  • sloc: cpp: 81,043; sh: 10,611; ansic: 3,281; makefile: 1,302
file content (25 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// This program prints the smallest probable prime >= x, x being given on the
// command line.

// We work with real numbers and integers.
#include <cln/real.h>
#include <cln/integer.h>

// We do I/O.
#include <cln/io.h>
#include <cln/integer_io.h>

// The function nextprobprime() is part of the number theory package.
#include <cln/numtheory.h>

int main (int argc, char* argv[])
{
	if (argc != 2) {
		std::cerr << "Usage: nextprime x" << std::endl;
		return(1);
	}
	cln::cl_R x = (cln::cl_R)argv[1];
	cln::cl_I p = cln::nextprobprime(x);
	std::cout << p << std::endl;
	return(0);
}