Welcome to City-Data.com Forum!
U.S. CitiesCity-Data Forum Index
Go Back   City-Data Forum > General Forums > Science and Technology > Computers
 [Register]
Please register to participate in our discussions with 2 million other members - it's free and quick! Some forums can only be seen by registered members. After you create your account, you'll be able to customize options and access all our 15,000 new posts/day with fewer ads.
View detailed profile (Advanced) or search
site with Google Custom Search

Search Forums  (Advanced)
 
Old 10-15-2009, 06:44 PM
 
Location: Denver
690 posts, read 2,102,662 times
Reputation: 356

Advertisements

I have a strange problem. I have this list of 11 numbers. I need to use some of these numbers to come to a total of exactly $3,144.78. I don't need to use all the numbers to come to that total (if I use all of them, the total is over $4,000) and I don't know which ones I'm supposed to exclude. I also don't know how many of the 11 numbers I need to use.

I was thinking about how hackers sometimes have software that can very quickly come up with thousands of different letter and number combinations to guess passwords. I'm not hacking, I promise. But that made me think that maybe there's a way to solve my problem in Excel or Access or maybe just by using some kind of weird math technique.

Can anyone help? Any advice or suggestions would be greatly appreciated.
Reply With Quote Quick reply to this message

 
Old 10-16-2009, 10:35 AM
 
28,803 posts, read 47,502,153 times
Reputation: 37905
Sounds like me when I'm doing year-end and balancing my books!

An easy out would be putting the numbers here. If no one else attacked it, I would. I love this type of problem.

I'd start with the largest number. If I remove it do the rest add up to more than the target? If not, then the largest number must be included. If the largest runs over then do the same for the second largest.

In a program like Excel you could place them in a column that is summed and remove one or more to see how the sum changes. Delete a number and if need be use undo to put it back.

Programming would require some interesting loops to accomplish, I think.

I would look for combination's that give .78 as a remainder and see if they then add up to the correct total. That eliminates worrying about the tens, hundreds, and thousands columns until you get the decimal correct.
Reply With Quote Quick reply to this message
 
Old 10-16-2009, 12:26 PM
 
2,884 posts, read 5,913,021 times
Reputation: 1991
All the numbers total 4,000. You need a total of 3,144.78. Subtract them, you only have to find the numbers that add up exactly to 855.22. That should be fewer numbers and easier to narrow down. Those numbers get discarded, and the remaining numbers will be the necessary ones.
Reply With Quote Quick reply to this message
 
Old 10-16-2009, 08:35 PM
 
28,803 posts, read 47,502,153 times
Reputation: 37905
Quote:
Originally Posted by scarmig View Post
All the numbers total 4,000. You need a total of 3,144.78. Subtract them, you only have to find the numbers that add up exactly to 855.22. That should be fewer numbers and easier to narrow down. Those numbers get discarded, and the remaining numbers will be the necessary ones.


Pfffftttt!!!
Reply With Quote Quick reply to this message
 
Old 10-17-2009, 12:40 PM
 
Location: Denver
690 posts, read 2,102,662 times
Reputation: 356
Thanks for your suggestions. I asked my question at the Microsoft Discussion forum, too. And someone suggested I go to this link: http://tinyurl.com/5kx9bw

It's right along the lines of what you were thinking, Tek_Freek. It worked perfectly. I was pretty excited! It never ceases to amaze me how much time we waste at work because we're not aware of all these different features in Excel and Access.
Reply With Quote Quick reply to this message
Please register to post and access all features of our very popular forum. It is free and quick. Over $68,000 in prizes has already been given out to active posters on our forum. Additional giveaways are planned.

Detailed information about all U.S. cities, counties, and zip codes on our site: City-data.com.


Reply
Please update this thread with any new information or opinions. This open thread is still read by thousands of people, so we encourage all additional points of view.

Quick Reply
Message:


Over $104,000 in prizes was already given out to active posters on our forum and additional giveaways are planned!

Go Back   City-Data Forum > General Forums > Science and Technology > Computers
Similar Threads

All times are GMT -6.

© 2005-2024, Advameg, Inc. · Please obey Forum Rules · Terms of Use and Privacy Policy · Bug Bounty

City-Data.com - Contact Us - Archive 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 - Top