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

 Curious concatenations (Posted on 2014-10-23)
157 is a prime with a very peculiar attribute: placed either after the previous prime or prior to the next prime produces prime numbers (151157 and 157163 respectively).
257 posesses the same feature.
So do many other primes, 4 of them below 2000.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solutions Comment 1 of 1
Sets of three successive primes that form primes that answer the puzzle follow:

151 157 163
251 257 263
257 263 269
523 541 547
1181 1187 1193
1453 1459 1471
2161 2179 2203
7883 7901 7907
7901 7907 7919
9181 9187 9199
11393 11399 11411
11719 11731 11743
15601 15607 15619
16381 16411 16417
16741 16747 16759
18329 18341 18353
19013 19031 19037
24251 24281 24317
34963 34981 35023
40459 40471 40483
40591 40597 40609
40597 40609 40627
47563 47569 47581
48017 48023 48029
49211 49223 49253
49499 49523 49529
57041 57047 57059
64793 64811 64817
69557 69593 69623
80651 80657 80669
80989 81001 81013
83987 84011 84017
89051 89057 89069
89107 89113 89119
90679 90697 90703
91873 91909 91921
95443 95461 95467

from

DefDbl A-Z
Dim wd(10) As String, w As String, sz, crlf\$

Text1.Text = ""
crlf\$ = Chr(13) + Chr(10)
Form1.Visible = True

p1 = nxtprm(0): p2 = nxtprm(p1): p3 = nxtprm(p2)
Do
long1 = Val(LTrim(Str(p1)) + LTrim(Str(p2)))
long2 = Val(LTrim(Str(p2)) + LTrim(Str(p3)))
If prmdiv(long1) = long1 And prmdiv(long2) = long2 Then
Text1.Text = Text1.Text & p1 & Str(p2) & Str(p3) & crlf
DoEvents
End If
p1 = p2: p2 = p3: p3 = nxtprm(p3)
Loop Until p1 > 100000

Text1.Text = Text1.Text & "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 nxtprm(x)
Dim n
n = x + 1
While prmdiv(n) < n
n = n + 1
Wend
nxtprm = n
End Function

Edited on October 23, 2014, 4:08 pm
 Posted by Charlie on 2014-10-23 16:07:43

 Search: Search body:
Forums (0)