All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Big, super and prime (Posted on 2010-10-20)
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.

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): Another method. -- solution for that Euler problem 37 | Comment 5 of 8 |
(In reply to re: Another method. by Daniel)

list
50     end
60
75     local Dig
80     for Dig=3 to 9 step 2
90       Pr=Pr*10+Dig
100       Digs=int(log(Pr)/log(10))+1
105       Good=1
110       for St=0 to Digs-1
120         Tst=Pr-(Pr\(10^(Digs-St)))*10^(Digs-St)
130         if prmdiv(Tst)<>Tst then Good=0
140       next
200       if prmdiv(Pr)=Pr and Good=1 then
210       :print Pr
230       if prmdiv(Pr)=0 then print "**":end
240       Pr=Pr\10
250     next Dig
260     return
OK
run
23
37
373
53
73
OK
 Posted by Charlie on 2010-10-20 15:18:20

 Search: Search body:
Forums (0)