Components that make up a sum

Jim Herbert

New member
Joined
Mar 11, 2015
Messages
1
I am a controller for my company. Our CPA moved some numbers around but did not indicate what made up the amounts that he transferred. For instance, I have 23 amounts/numbers that add up to $6,137.35. He moved $5,802.95, which left $334.40 in the account. The problem is that he did not identify which of the 23 numbers made up the amount that he moved or the amount that remained. That's important because I need to identify the assets that apply to the totals and the only way to do that is to know which numbers make up the two totals. Other than trial and error, is there any way (a calculator or formula, perhaps) that you can scan a group of numbers and tell you which ones would add to make a certain total? I suspect trying to figure out which of the 23 make up the $334.40 would be easier than determining which of the 23 make up the $5,802.95. Any suggestions? The 23 numbers are shown below. Any help or suggestions would be well appreciated.

399.96
87.97
8.26
34.97
1,191.50
288.00
1,133.00
1,191.50
288.00
83.70
19.19
189.00
80.00
10.80
24.18
370.50
109.94
51.12
64.03
12.00
239.70
194.70
65.33
 
I am a controller for my company. Our CPA moved some numbers around but did not indicate what made up the amounts that he transferred. For instance, I have 23 amounts/numbers that add up to $6,137.35. He moved $5,802.95, which left $334.40 in the account. The problem is that he did not identify which of the 23 numbers made up the amount that he moved or the amount that remained. That's important because I need to identify the assets that apply to the totals and the only way to do that is to know which numbers make up the two totals. Other than trial and error, is there any way (a calculator or formula, perhaps) that you can scan a group of numbers and tell you which ones would add to make a certain total? I suspect trying to figure out which of the 23 make up the $334.40 would be easier than determining which of the 23 make up the $5,802.95. Any suggestions? The 23 numbers are shown below. Any help or suggestions would be well appreciated.

399.96
87.97
8.26
34.97
1,191.50
288.00
1,133.00
1,191.50
288.00
83.70
19.19
189.00
80.00
10.80
24.18
370.50
109.94
51.12
64.03
12.00
239.70
194.70
65.33
Sorry, just a guess and correct is all that is available unless you have some more information. Also, note that it may be that the answer is not unique, so you may have to ask the CPA what numbers he moved anyway. As a very simpkle example, suppose you had
1
2
3
7
and you had only 3 left after removal of 10. It could have been the 1 and 2 which were kept or it could have been just the 3 by itself which was kept.

Oh, and try to make the $334.40 as to what was kept so you can eliminate a lot of the numbers as Denis recommended.
 
I am a controller for my company. Our CPA moved some numbers around but did not indicate what made up the amounts that he transferred. For instance, I have 23 amounts/numbers that add up to $6,137.35. He moved $5,802.95, which left $334.40 in the account. The problem is that he did not identify which of the 23 numbers made up the amount that he moved or the amount that remained. That's important because I need to identify the assets that apply to the totals and the only way to do that is to know which numbers make up the two totals. Other than trial and error, is there any way (a calculator or formula, perhaps) that you can scan a group of numbers and tell you which ones would add to make a certain total? I suspect trying to figure out which of the 23 make up the $334.40 would be easier than determining which of the 23 make up the $5,802.95. Any suggestions? The 23 numbers are shown below. Any help or suggestions would be well appreciated.

399.96
87.97
8.26
34.97
1,191.50
288.00
1,133.00
1,191.50
288.00
83.70
19.19
189.00
80.00
10.80
24.18
370.50
109.94
51.12
64.03
12.00
239.70
194.70
65.33
Of course, if one were so inclined, one could write a simple program to get
8.26
10.8
19.19
24.18
34.97
65.33
83.7
87.97
 
The answer to your question lies in Set Theory and Combinatorics


Given U as universal set of all cash amounts


A is the set whose sum adds up to 334.4


And its complement U-A adds up to 5802.95


Code:
U={8.26, 10.8, 12, 19.19, 24.18, 34.97, 51.12, 64.03, 65.33, 80, 83.7, 87.97, 109.94, 189, 194.7, 239.7, 288, 288, 370.5, 399.96, 1133, 1191.5, 1191.5}


A={8.26, 10.8, 19.19, 24.18, 34.97, 65.33, 83.7, 87.97}


U\A={12, 51.12, 64.03, 80, 109.94, 189, 194.7, 239.7, 288, 288, 370.5, 399.96, 1133, 1191.5, 1191.5}
 
For larger data sets, if all one wanted was at least one set and didn't insist on 100% testing but maybe a 99% probability (or 99.9% or ...), it might actually be better to do the choice of the numbers on a 'random choice' basis. Some thing like the following:
Set target & put number in array a, any order [do the cull of 'greater than' as indicated above first or have the program do it].

-Shuffle a [use a standard shuffle routine or write your own simple version]
-Go through a sequentially adding values until equal or greater than target
- if equal, do a print & stop. [can continue if you want to see if there is another but should do testing, maybe stop after getting the same answer two or three times or whatever]
-if not equal, repeat from "Shuffle a" N times where N is "sufficiently large"
 
Question Dexter: any limits on number of amounts?

The upper limit of Integer or Long Data Type in a given programming language

Seeking a single solution will not require much resources in terms of time and memory

Yet if you seeking "all solutions" then the total number of iterations are given by

n! / [ k! (n-k)! ]

Take a deep breath before running the program for large data sets and when you awake the computer still may be busy iterating through the combinations
 
Last edited:
The upper limit of Integer or Long Data Type in a given programming language

Seeking a single solution will not require much resources in terms of time and memory

Yet if you seeking "all solutions" then the total number of iterations are given by

n! / [ k! (n-k)! ]

Take a deep breath before running the program for large data sets and when you awake the computer still may be busy iterating through the combinations
If the program is blind, that is doesn't 'see' the obvious single amount entry, then it is the sum over k of that value or 2n 'searches' so for n equal a few tens, say about 32, we would only take about a day if we could do a set in an average of about 1 ms. Of course that could be cut down with some intelligent programming but still probably a bit of time.
 
Top