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

Home > Numbers
Big, super and prime (Posted on 2010-10-20) Difficulty: 4 of 5
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.

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.0000 (2 votes)

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
   10     Pr=2:gosub *Addon
   20     Pr=3:gosub *Addon
   30     Pr=5:gosub *Addon
   40     Pr=7:gosub *Addon
   50     end
   60
   70     *Addon
   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
  220       :gosub *Addon
  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

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information