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

Home > Numbers
Does it continue? 3: Growing table of primes (Posted on 2017-09-19) Difficulty: 3 of 5
Before trying the problem "note your opinion as to whether the observed pattern is known to continue, known not to continue, or not known at all."

After row 1, row n is obtained by inserting n between every pair of consecutive numbers that sum to n.

row 1:                  1 1
row 2:                 1 2 1
row 3:               1 3 2 3 1
row 4:            1 4 3  2  3 4 1
row 5:        1 5 4  3 5 2 5 3 4 5 1
row 6:   1  6  5 4  3 5  2  5  3  4 5  6 1
row 7: 1 7 6 5 4 7 3 5 7 2 7 5 3 7 4 5 6 7 1
The number of numbers in each row are 2, 3, 5, 7, 11, 13, 19...

Will they always be prime?

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution first thought and computer vindication | Comment 1 of 3
 I wouldn't think the primes would continue, as I didn't see a relationship to prime numbers. As it turns out, primes are overrepresented for some reason, but indeed, composite numbers do show up:

 The first composite occurs after inserting 10's, when there are 33 numbers in the row:

 1 2 1    3 = 3
 1 3 2 3 1    5 = 5
 1 4 3 2 3 4 1    7 = 7
 1 5 4 3 5 2 5 3 4 5 1    11 = 11
 1 6 5 4 3 5 2 5 3 4 5 6 1    13 = 13
 1 7 6 5 4 7 3 5 7 2 7 5 3 7 4 5 6 7 1    19 = 19
 1 8 7 6 5 4 7 3 8 5 7 2 7 5 8 3 7 4 5 6 7 8 1    23 = 23
 1 9 8 7 6 5 9 4 7 3 8 5 7 9 2 9 7 5 8 3 7 4 9 5 6 7 8 9 1    29 = 29
 1 10 9 8 7 6 5 9 4 7 10 3 8 5 7 9 2 9 7 5 8 3 10 7 4 9 5 6 7 8 9 10 1    33 = 3 * 11
 1 11 10 9 8 7 6 11 5 9 4 11 7 10 3 11 8 5 7 9 11 2 11 9 7 5 8 11 3 10 7 11 4 9 5 11 6 7 8 9 10 11 1    43 = 43

Starting with the insertion of 12's, the number of numbers is listed below. Primes do get rarer, though more common than if by chance.

 12    47 = 47
 13    59 = 59
 14    65 = 5 * 13
 15    73 = 73
 16    81 = 3^4
 17    97 = 97
 18    103 = 103
 19    121 = 11^2
 20    129 = 3 * 43
 21    141 = 3 * 47
 22    151 = 151
 23    173 = 173
 24    181 = 181
 25    201 = 3 * 67
 26    213 = 3 * 71
 27    231 = 3 * 7 * 11
 28    243 = 3^5
 29    271 = 271
 30    279 = 3^2 * 31
 31    309 = 3 * 103
 32    325 = 5^2 * 13
 33    345 = 3 * 5 * 23
 34    361 = 19^2
 35    385 = 5 * 7 * 11
 36    397 = 397
 37    433 = 433
 38    451 = 11 * 41
 39    475 = 5^2 * 19
 40    491 = 491
 41    531 = 3^2 * 59
 42    543 = 3 * 181
 43    585 = 3^2 * 5 * 13
 44    605 = 5 * 11^2
 45    629 = 17 * 37
 46    651 = 3 * 7 * 31
 47    697 = 17 * 41
 48    713 = 23 * 31
 49    755 = 5 * 151
 50    775 = 5^2 * 31


DefDbl A-Z
Dim crlf$, nbr(1, 1000000), fct(20, 1)

Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
     
 nbr(0, 1) = 1: nbr(0, 2) = 1
 For round = 2 To 50
   nbr(1, 1) = nbr(0, 1)
   ptr0 = 1: ptr1 = 1
   Do
    ptr0 = ptr0 + 1: ptr1 = ptr1 + 1
    If nbr(0, ptr0 - 1) + nbr(0, ptr0) = round Then
      nbr(1, ptr1) = round
      ptr1 = ptr1 + 1
    End If
    nbr(1, ptr1) = nbr(0, ptr0)
   Loop Until nbr(0, ptr0 + 1) = 0
   For i = 1 To ptr1
     nbr(0, i) = nbr(1, i)
     If round < 12 Or i = 2 Then Text1.Text = Text1.Text & Str(nbr(0, i))
   Next
   DoEvents
   Text1.Text = Text1.Text & "   " & Str(ptr1) & " = "
   DoEvents
   f = factor(ptr1)
   For i = 1 To f
     Text1.Text = Text1.Text & fct(i, 0)
     If fct(i, 1) > 1 Then Text1.Text = Text1.Text & "^" & fct(i, 1)
     If i < f Then
       Text1.Text = Text1.Text & " * "
     End If
   Next
   Text1.Text = Text1.Text & crlf
 Next round
 
 
     
End Sub



Function factor(num)
 diffCt = 0: good = 1
 nm1 = Abs(num): If nm1 > 0 Then limit = Sqr(nm1) 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
   If INKEY$ = Chr$(27) Then s$ = Chr$(27): Exit Function
 Loop
 If nm1 > 1 Then diffCt = diffCt + 1: fct(diffCt, 0) = nm1: fct(diffCt, 1) = 1
 factor = diffCt
 Exit Function

DivideIt:
 cnt = 0
 Do
  q = Int(nm1 / dv)
  If q * dv = nm1 And nm1 > 0 Then
    nm1 = q: cnt = cnt + 1: If nm1 > 0 Then limit = Sqr(nm1) Else limit = 0
    If limit <> Int(limit) Then limit = Int(limit + 1)
   Else
    Exit Do
  End If
 Loop
 If cnt > 0 Then
   diffCt = diffCt + 1
   fct(diffCt, 0) = dv
   fct(diffCt, 1) = cnt
 End If
 Return
End Function


  Posted by Charlie on 2017-09-19 10:54:29
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 (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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