You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
585 B

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