Billboard Challenge, Part 1
June 22, 2012
There are several ways to solve this problem. If you have access to a DNS server, you could extract all the 10-digit.com names, test each for primality, and look at each one until you find the likely solution. Or you could find the digits of e at any of several places on the web and test each successive 10-digits until you find a prime.
But since we just happen to have at hand an unbounded spigot generator for the digits of e, we can use it to solve the problem:
(let loop ((i 0) (n (e-spigot)))
(if (and (< #e1e9 n) (prime? n)) (values i n)
(loop (+ i 1) (+ (* 10 (modulo n #e1e9)) (e-spigot))))))
The first 10-digit prime occurs early in the digits of e:
The web site 7427466391.com no longer exists. If you went to the web site back in 2004, when it was active, it gave you a second problem to solve, which we will see in the next exercise.
Pages: 1 2