From: Jann Horn Date: Wed, 7 May 2014 00:00:57 +0000 (+0200) Subject: add eea X-Git-Url: http://git.thejh.net/?a=commitdiff_plain;h=847df72c4f2e266c86c37193751e1ec0d8435293;p=tools.git add eea --- diff --git a/math/eea.c b/math/eea.c new file mode 100644 index 0000000..4e05494 --- /dev/null +++ b/math/eea.c @@ -0,0 +1,35 @@ +#include +#include +#include + +#define num long long + +num mod_inverse(num n, num p) { + assert(n>=0); + assert(n

"), exit(1); + num n = strtoll(argv[1], NULL, 0); + num p = strtoll(argv[2], NULL, 0); + if (n >= p || n < 0 || p <= 0) puts("bad input"), exit(1); + printf("%lld\n", mod_inverse(n, p)); + return 0; +} \ No newline at end of file