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

Home > Numbers
Odd partition (Posted on 2019-05-09) Difficulty: 3 of 5
There are 3 ways to write 4 as a sum of odd numbers (assuming order matters and numbers can be repeated in the sum): 3+1, 1+3, and 1+1+1+1.

How many ways are there to write 19 as a sum of odd numbers?

Hint: The above result has something to do with Fibonacci numbers

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
DefDbl A-Z
Dim crlf$, ways, n, togo



Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 
 For n = 2 To 25
   ways = 0
   togo = n
   addon
   Text1.Text = Text1.Text & n & Str(ways) & crlf
 Next
 
  
  
  
 Text1.Text = Text1.Text & ct & " done"
End Sub

Sub addon()
  For amt = 1 To togo Step 2
    togo = togo - amt
    If togo = 0 Then
      ways = ways + 1
    Else
      addon
    End If
    togo = togo + amt
  Next
End Sub

finds

2 1
 3     2
 4     3
 5     5
 6    8
 7   13
 8   21
 9   34
10  55
11  89
12 144
13 233
14 377
15 610
16 987
17 1597
18 2584
19 4181
20 6765
21 10946
22 17711
23 28657
24 46368
25 75025

For 19, the sum is 4181. I do see the Fibonacci sequence here.

  Posted by Charlie on 2019-05-09 14:13:14
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 (0)
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