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

Home > Numbers
Matryoshka Nesting Primes (Posted on 2016-03-03) Difficulty: 3 of 5
In what base(s) there exist a prime number abcd (a string of distinct digits), such that a, ab, abc are also prime numbers?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re(3): computer solution NEEDS FILTERING Comment 11 of 11 |
(In reply to re(2): computer solution NEEDS FILTERING by Charlie)

I'll let the previous post be the limit of the portion of the filtered listing I include. The revised main part of the program is:


 For bse = 3 To 36
   Text1.Text = Text1.Text & bse & crlf
   st = bse * bse * bse
   fin = st * bse
   p = nxtprm(st)
   Do
     DoEvents
     s4$ = base$(p, bse)
     good = 1
     For i = 2 To 4
       If InStr(s4$, Mid(s4, i, 1)) < i Then good = 0
     Next
     If good Then
        p1 = fromBase(Left(s4$, 1), bse)
        If prmdiv(p1) = p1 And p1 > 1 Then
           p2 = fromBase(Left(s4$, 2), bse)
           If prmdiv(p2) = p2 Then
             p3 = fromBase(Left(s4$, 3), bse)
             If prmdiv(p3) = p3 Then
               Print #2, bse & "  " & s4 & "  " & p1 & Str(p2) & Str(p3) & Str(p)
             End If
           End If
        End If
     End If
     p = nxtprm(p)
   Loop Until p > fin
 Next bse


  Posted by Charlie on 2016-03-03 20:09: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