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

Home > Just Math
Getting 13 (Posted on 2014-07-21) Difficulty: 3 of 5
Using integers 1,2,3 & 4 only , in how many distinct ways a sum of 13 can be achieved?

Rem: The order matters i.e. 1,4,4; 4,1,4; & 4,4,1 are considered distinct.

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Elegant(?) approach | Comment 2 of 5 |
I confirm 2,872

Let f(n) = number of ways of achieving total n.
These can be achieved be adding a 1 to the left of all ways of achieving (n-1), or by adding a 2 to the left of all ways of achieving (n-2), or by adding a 3 to the left of all ways of achieving (n-3), or by adding a 4 to the left of all ways of achieving (n-4). 

In other words, f(n) = f(n-4) + f(n-3) + f(n-2) + f(n-1).  It's an extended fibonacci.

f(0) = 1
f(1) = 1
f(2) = 2
f(3) = 4
f(4) = 8 (ie, 1+1+2+4)
f(5) = 15 (ie, 1+2+4+8)
f(6) = 29 (ie, 2+4+8+15)
f(7) = 56
f(8) = 108
f(9) = 208
f(10) = 401
f(11) = 773
f(12) = 1490
f(13) = 2872

  Posted by Steve Herman on 2014-07-21 19:17:46
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 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information