A superprime is an integer such that all its left-to-right initial segments are prime (e.g. 7331 whose segments are 7, 73, 733, and 7331, all prime).
There is a largest superprime.
Find it.
Source: USA Computing Olympiad,
Feb 1995.
(In reply to
Another method. by broll)
this is also similar to project euler problem 37 in which primes that are both left and right truncatable are sought.
http://projecteuler.net/index.php?section=problems&id=37
The code I used for this problem was simply the code from the first part of my solution to the project euler problem.
|
Posted by Daniel
on 2010-10-20 12:50:37 |