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

Home > Numbers
Ulam numbers II (Posted on 2017-11-18) Difficulty: 3 of 5
There is a finite number of Ulam numbers n, such that n+1 is also an Ulam number.

List all such pairs.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer "solution" Comment 1 of 1
The program below ran overnight and got up to n=5843 (that is, identified any Ulam numbers that were under that value, not that many Ulam numbers) before I stopped it. It started only at the 2 to 3 level and so excluded the 1. I manually added the 1, 2 pair to the output below, making 4 pairs altogether. Obviously not a proof of completeness.

ordinal   Ulam 
Ulam #    Number
          itself
 1          1
 2          2
          
 2          2
 3          3
 3          3
 4          4
15         47
16         48


Sloane's OEIS has a note that

1,2,3,47 are the only values of x < 6.759*10^8 such that x and x+1 are both Ulam numbers. - Jud McCranie, Jun 08 2001.  This holds through the first 28 billion Ulam numbers - Jud McCranie, Jan 07 2016.

Jud must have a faster computer or a better algorithm (inclusive OR). But still doesn't look like a proof of completeness (proof of finite nature of the set) had been achieved.


DefDbl A-Z
Dim crlf$, u(1000), ways, sum(1000), ptr, term(2), terms, tot, n, t1, t2


Private Sub Form_Load()
 Form1.Visible = True
 
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 u(1) = 1: u(2) = 2: ptr = 3
 sum(1) = 1: sum(2) = 3
 For n = 3 To 10000
   DoEvents
   ways = 0: tot = 0: terms = 0
   addon ptr - 1
   If ways = 1 Then
     u(ptr) = n
     sum(ptr) = sum(ptr - 1) + n
     If u(ptr - 1) = n - 1 Then
     Text1.Text = Text1.Text & ptr - 1 & Str(u(ptr - 1)) & crlf
     Text1.Text = Text1.Text & ptr & Str(n) & crlf
     Text1.Text = Text1.Text & crlf
     End If
     ptr = ptr + 1
   End If
 Next
 
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Sub addon(wh)
  If u(wh) <= n - tot And sum(wh) >= n - tot And terms < 2 Then
     terms = terms + 1
     term(terms) = wh
     tot = tot + u(wh)
     
     If tot = n Then
        ways = ways + 1
        t1 = term(1): t2 = term(2)
     Else
        addon (wh - 1)
     End If
     
     tot = tot - u(wh)
     term(terms) = 0
     terms = terms - 1
  End If
     
  w = wh - 1
  If w > 0 Then
      If sum(w) >= n - tot Then
         addon w
      End If
  End If
End Sub


  Posted by Charlie on 2017-11-18 16:10:30
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
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