Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 6
    \$\begingroup\$ isprime does an APR-CL primality proof, so does slow down quite a bit as inputs get very large. ispseudoprime(input) does an AES BPSW probable prime test, which will be much faster for over 100 digits. Still no known counterexamples after 35 years. Version 2.1 and earlier of Pari, from pre-2002, uses a different method that can easily give false results, but nobody should be using that. \$\endgroup\$ Commented Sep 11, 2015 at 18:30
  • \$\begingroup\$ Why not i->isprime(i) or just isprime, that's shorter? \$\endgroup\$ Commented Aug 30, 2020 at 17:50
  • \$\begingroup\$ @JeppeStigNielsen The challenge says: “Write a full program that …” \$\endgroup\$ Commented Aug 31, 2020 at 16:46
  • \$\begingroup\$ OK, that might be the correct interpretation, if you insist on reading with input() and writing with print(...). However, I thought a function like foo(x, y) = { z=bar(x); if(y, return(y*z)); z } or something was a "full program" in PARI/GP. It is not usual to do input() and print(...), more common to use return values (functional language). \$\endgroup\$ Commented Sep 1, 2020 at 1:51