182 RSA encryption.gp 276 B

123456789101112131415161718
  1. \\ Pari/GP
  2. \\ Daniel "Trizen" Șuteu
  3. \\ Date: 14 January 2017
  4. \\ https://github.com/trizen
  5. \\ https://projecteuler.net/problem=182
  6. p = 1009
  7. q = 3643
  8. s = 0
  9. P = (p-1) * (q-1)
  10. for(e = 2, P-1, if(gcd(e, P) == 1 && gcd(e-1, p-1) == 2 && gcd(e-1, q-1) == 2, s += e))
  11. print(s)