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
560 B

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 <cl_real.h>
  5. #include <cl_integer.h>
  6. // We do I/O.
  7. #include <cl_io.h>
  8. #include <cl_integer_io.h>
  9. // The function nextprobprime() is part of the number theory package.
  10. #include <cl_numtheory.h>
  11. int main (int argc, char* argv[])
  12. {
  13. if (argc != 2) {
  14. fprint(cl_stderr, "Usage: nextprime x\n");
  15. exit(1);
  16. }
  17. cl_R x = (cl_R)argv[1];
  18. cl_I p = nextprobprime(x);
  19. fprint(cl_stdout, p);
  20. fprint(cl_stdout, "\n");
  21. }