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

Home > Numbers
Twin and reversible (Posted on 2019-02-20) Difficulty: 2 of 5
Below is an example of twin & reversible primes:
(173313197, 173313199); and (791313371, 991313371)

Find the smallest non trivial pair with similar features .

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution and extension | Comment 1 of 5
(3,5)(3,5)
and
(5,7)(5,7)
are obviously trivial.

(11,13)(11,31) I guess is semi-trivial, as one of its members is palindromic.

(71,73)(17,37) would be the first non-trivial pair.

(1031, 1033) (1301, 3301) would be first to share the feature in the given pair that each of the reversals is larger than the original prime.

The non-reversed pairs are shown below, both semi-trivial and non-trivial (the first 100 cases).

11 13
71 73
149 151
179 181
311 313
1031 1033
1151 1153
1229 1231
3299 3301
3371 3373
3389 3391
3467 3469
3851 3853
7457 7459
7949 7951
9011 9013
9437 9439
10007 10009
10067 10069
10457 10459
10499 10501
10889 10891
11159 11161
11699 11701
11717 11719
11777 11779
11969 11971
12071 12073
12107 12109
13709 13711
13757 13759
13829 13831
13931 13933
14447 14449
14549 14551
14591 14593
15731 15733
16061 16063
16451 16453
17207 17209
17681 17683
17747 17749
17909 17911
18911 18913
19421 19423
19541 19543
30851 30853
31721 31723
32321 32323
32939 32941
33809 33811
34469 34471
34589 34591
34841 34843
34961 34963
35051 35053
35801 35803
36107 36109
37199 37201
37307 37309
37547 37549
37571 37573
38327 38329
38921 38923
39827 39829
70949 70951
70997 70999
71261 71263
71387 71389
72227 72229
72251 72253
72869 72871
74759 74761
75167 75169
75539 75541
76259 76261
78779 78781
78887 78889
79229 79231
79397 79399
79841 79843
92381 92383
92639 92641
93557 93559
94109 94111
94151 94153
94349 94351
94397 94399
94541 94543
94649 94651
95801 95803
96179 96181
97379 97381
97787 97789
98729 98731
102197 102199
103391 103393
103421 103423
104087 104089
106187 106189


DefDbl A-Z
Dim crlf$
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

Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 
 p = 11
 Do
   prev = p
   p = nxtprm(p)
   If p - prev = 2 Then
     p1$ = LTrim(Str(prev))
     p2$ = LTrim(Str(p))
     r1$ = ""
     For i = 1 To Len(p1)
       r1 = Mid(p1, i, 1) + r1
     Next
     r2$ = ""
     For i = 1 To Len(p2)
       r2 = Mid(p2, i, 1) + r2
     Next
     tst1 = Val(r1): tst2 = Val(r2)
     If prmdiv(tst1) = tst1 Then
       If prmdiv(tst2) = tst2 Then
         Text1.Text = Text1.Text & prev & Str(p) & crlf
         ct = ct + 1
       End If
     End If
   End If
   DoEvents
 Loop Until ct >= 100
 
 Form1.Visible = True
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 nxtprm(x)
  Dim n
  n = x + 1
  While prmdiv(n) < n Or n < 2
    n = n + 1
  Wend
  nxtprm = n
End Function


  Posted by Charlie on 2019-02-20 13:06:07
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 (3)
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