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

Home > Numbers
Why is it D2? (Posted on 2017-03-27) Difficulty: 2 of 5
Find the smallest positive integer fitting the following description:

i. All its digits, except two, are sixes.
ii. It is prime.

Why is this puzzle D2?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
In the other spirit Comment 4 of 4 |
beyond 11 are

     163
     167
     263
     269
     367
     461
     463
     467
     563
     569
     601
     607
     613
     617
     619
     631
     641
     643
     647
     653
     659
     673
     677
     683
     691
     761
     769
     863
     967
    1663
    1667
    1669
    2663
    4663
    5669
    6067
    6163
    6263
    6269
    6361
    6367
    6469
    6563
    6569
    6607
    6619
    6637
    6653
    6659
    6673
    6679
    6689
    6691
    6761
    6763
    6863
    6869
    6961
    6967
    7669
    8663
    8669
    9661
   16661
   26669
   46663
   56663
   60661
   61667
   63667
   64661
   64663
   64667
   66067
   66161
   66169
   66361
   66463
   66467
   66569
   66601
   66617
   66629
   66643
   66653
   66683
   66697
   66763
   66863
   68669
   69661
   76667
   96661
   96667
  166667
  166669
  266663
  616669
  626663
  646669
  660661
  661663
  663661
  664661
  664663
  664667
  664669
  666067
  666167
  666269
  666461
  666467
  666607
  666637
  666643
  666647
  666649
  666671
  666683
  666697
  666769
  669661
  669667
  676661
  686669
  966661
 2666663
 3666661
 4666663
 4666667
 6066661
 6166669
 6466661
 6566663
 6616667
 6636661
 6636667
 6646663
 6646669
 6661661
 6664661
 6664667
 6665669
 6666061
 6666167
 6666269
 6666467
 6666563
 6666613
 6666617
 6666679
 6666683
 6666689
 6666761
 6666769
 6667669
 6676661
 6676667
 6676669
 6686663
 6696661
 6766667
 6866663
 7666661
 7666667
 7666669
 9666661

DefDbl A-Z

Dim crlf$



Private Sub Form_Load()

 Form1.Visible = True

  Text1.Text = ""

 crlf = Chr$(13) + Chr$(10)

 

 For l = 3 To 7

   s0$ = String$(l, "6")

   For digs = 0 To 99

     d$ = Right("000" + LTrim(Str(digs)), 2)

     If InStr(d, "6") = 0 Then

        For p1 = 1 To l - 1

         For p2 = p1 + 1 To l

          s$ = s0

          Mid(s, p1, 1) = Left(d, 1)

          Mid(s, p2, 1) = Right(d, 1)

          n = Val(s)

          If prmdiv(n) = n And Left(s, 1) <> "0" Then

            Text1.Text = Text1.Text & mform(n, "#######0") & crlf

          End If

         Next

        Next

     End If

   Next

 Next l

 

 

 

 

 Text1.Text = Text1.Text & crlf & " done"

  

End Sub


Function prmdiv(num)

 Dim n, dv, q

 If num = 1 Then prmdiv = 1: Exit Function

 n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0

 If limit <> Int(limit) Then limit = Int(limit + 1)

 dv = 2: GoSub DivideIt

 dv = 3: GoSub DivideIt

 dv = 5: GoSub DivideIt

 dv = 7

 Do Until dv > limit

   GoSub DivideIt: dv = dv + 4 '11

   GoSub DivideIt: dv = dv + 2 '13

   GoSub DivideIt: dv = dv + 4 '17

   GoSub DivideIt: dv = dv + 2 '19

   GoSub DivideIt: dv = dv + 4 '23

   GoSub DivideIt: dv = dv + 6 '29

   GoSub DivideIt: dv = dv + 2 '31

   GoSub DivideIt: dv = dv + 6 '37

 Loop

 If n > 1 Then prmdiv = n

 Exit Function


DivideIt:

 Do

  q = Int(n / dv)

  If q * dv = n And n > 0 Then

    prmdiv = dv: Exit Function

   Else

    Exit Do

  End If

 Loop


 Return

End Function


Function mform$(x, t$)

  a$ = Format$(x, t$)

  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$

  mform$ = a$

End Function



  Posted by Charlie on 2017-03-27 11:15:37
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