]> www.ginac.de Git - cln.git/blob - examples/nextprime.cc
Move GETVAL macro from acinclude.m4 to m4/getval.m4.
[cln.git] / examples / nextprime.cc
1 // This program prints the smallest probable prime >= x, x being given on the
2 // command line.
3
4 // We work with real numbers and integers.
5 #include <cln/real.h>
6 #include <cln/integer.h>
7
8 // We do I/O.
9 #include <cln/io.h>
10 #include <cln/integer_io.h>
11
12 // The function nextprobprime() is part of the number theory package.
13 #include <cln/numtheory.h>
14
15 int main (int argc, char* argv[])
16 {
17         if (argc != 2) {
18                 std::cerr << "Usage: nextprime x" << std::endl;
19                 return(1);
20         }
21         cln::cl_R x = (cln::cl_R)argv[1];
22         cln::cl_I p = cln::nextprobprime(x);
23         std::cout << p << std::endl;
24         return(0);
25 }