097 Large non-Mersenne prime.sf 388 B

123456789101112131415
  1. #!/usr/bin/ruby
  2. # Author: Daniel "Trizen" Șuteu
  3. # License: GPLv3
  4. # Website: https://github.com/trizen
  5. # However, in 2004 there was found a massive non-Mersenne prime which contains 2,357,207 digits: 28433 × 2^7830457 + 1.
  6. # Find the last ten digits of this prime number.
  7. # https://projecteuler.net/problem=97
  8. # Runtime: 0.130s
  9. say ((28433 * powmod(2, 7830457, 10**10))+1 % 10**10)