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

Home > Numbers
Ulam numbers (Posted on 2017-06-03) Difficulty: 3 of 5
We define recursively the Ulam numbers by setting u1 = 1, u2 = 2, and for each subsequent integer n, we set n equal to the next Ulam number if it can be written uniquely as the sum of two different Ulam numbers; e.g.: u3 = 3, u4 = 4, u5 = 6, etc.

Prove that there are infinitely many Ulam numbers.

Now a D4 BONUS.
3 (=1+2). Find another Ulam number is that is the sum of two consecutive Ulam numbers.

How about a 3rd one?

See The Solution Submitted by Ady TZIDON    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: The proof and the bonus | Comment 3 of 5 |
(In reply to The proof and the bonus by Charlie)

Oh, yes, the program producing the list:


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
     Text1.Text = Text1.Text & ptr & Str(n)
     If t2 = t1 - 1 Then Text1.Text = Text1.Text & " * " & u(t1) & Str(u(t2))
     Text1.Text = Text1.Text & crlf
     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-06-03 14:34:24
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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information