# HG changeset patch
# User Steve Losh
# Date 1505667475 14400
# Node ID 194f555209713e10cce8147a3cc2dff763c174b9
# Parent 540f1cb1093af835403a710cd42c7d5369d13b05
Problem 97
diff -r 540f1cb1093a -r 194f55520971 src/problems.lisp
--- a/src/problems.lisp Thu Aug 17 12:54:27 2017 -0400
+++ b/src/problems.lisp Sun Sep 17 12:57:55 2017 -0400
@@ -1687,6 +1687,22 @@
(iterate (for i :from 1 :below 10000000)
(counting (= 89 (square-chain-end i))))))
+(defun problem-97 ()
+ ;; The first known prime found to exceed one million digits was discovered in
+ ;; 1999, and is a Mersenne prime of the form 2^6972593ā1; it contains exactly
+ ;; 2,098,960 digits. Subsequently other Mersenne primes, of the form 2^pā1,
+ ;; have been found which contain more digits.
+ ;;
+ ;; However, in 2004 there was found a massive non-Mersenne prime which
+ ;; contains 2,357,207 digits: 28433Ć2^7830457+1.
+ ;;
+ ;; Find the last ten digits of this prime number.
+ (-<> 2
+ (expt <> 7830457)
+ (* 28433 <>)
+ 1+
+ (mod <> (expt 10 10))))
+
(defun problem-145 ()
;; Some positive integers n have the property that the sum [ n + reverse(n) ]
;; consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and
@@ -1963,6 +1979,7 @@
(test p74 (is (= 402 (problem-74))))
(test p79 (is (= 73162890 (problem-79))))
(test p92 (is (= 8581146 (problem-92))))
+(test p97 (is (= 8739992577 (problem-97))))
(test p145 (is (= 608720 (problem-145))))
(test p323 (is (= 6.3551758451d0 (problem-323))))
(test p345 (is (= 13938 (problem-345))))