# Math Is Fun Forum

Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2021-02-21 23:35:08

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Its been awhile since I've been here, but I have another calculation I need help with an I'm not sure how to set-up the Combinations Calculator, if that's the way, to calculate the following

If I have 20 slots

How many different combinations of 1, 2 & 3 are there without exceeding the sum total of 40?

i.e., Twenty (20) 2s can be one combination, or another one is ten (10) 3s and ten (10) 1s (The total for both is 40)

Make sense?

Thanks for any guidance

-- Mitch

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #2 2021-02-23 22:57:34

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Bump

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #3 2021-02-25 01:43:20

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Hey Mitch,
are the two sets: ten 3s and ten 1s and ten 1s and ten 3s distinct?
i.e, does order matter?

Thanks.

EDIT: disregard striked through text, writing up solution

Last edited by Mathegocart (2021-02-25 01:50:28)

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #4 2021-02-25 11:59:14

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Waiting with baited breath

BTW - I'm a math midget, so be gentle

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #5 2021-02-25 12:57:18

Denominator
Member
Registered: 2009-11-23
Posts: 220

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Hello, here are my thoughts:
Sounds like you are only looking at possible amounts of 1s, 2s and 3s (as opposed to a specific order of slots).
^ expanding that what I mean is that it appears you aren't differentiating between [ten 1s first then ten 3s], and [ten 3s first then ten 1s].

Looking only at a sum total of 40, here's one way to find the number of possible collections:
Start off with twenty slots of 2 (sum is 40). Then convert two 2s into one 1 and one 3 (so as to conserve the sum, as 2+2 = 1+3). This is another possible collection of numbers. You can repeat this process nine more times. Therefore there are 11 slot collections that sum to 40.
Let (x, y, z) be the numbers of 1s, 2s and 3s respectively. Then the collections are {(0,20,0), (1,18,1), ... (10,0,10)}, which give 11 possible ways to sum to 40.

Your question asks about combinations that don't exceed 40, so this is not the full answer. But hopefully this has given you a start or possibly new ideas on how to answer your question

Offline

## #6 2021-02-26 11:25:35

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

UCanCallMeMitch wrote:

Waiting with baited breath

BTW - I'm a math midget, so be gentle

Hello, sorry for the delay - some life impediments proved to be quite tiresome and delayed me for a day. Nonetheless, here is what (I believe) to be a solution.

So I decided to tackle your intriguing problem by abstracting it to a system of equations (albeit underdetermined[i.e, there are less equations than variables]).

The System

x + 2y + 3z = n (where n is a positive integer)

x + y + z = 20(i.e, 20 slots for 1, 2, and 3)

__________________________________________________

Now, for obvious reasons, n can only range from 20 to 40 - and Denominator has solved the case for n=40, so really we can just try n=20 to n=39.

The most trivial case is obviously n=20 - there's only one set of slots that sums up to 20, and that's 20 1s. So there's one way to do that.

CASES
__________________________________________________
N = 21
Solving the system where n=21, we have that y=39-2x and z=x-19. Now from relatively obvious arithmetic reasoning(no negative amount of numbers), the only value that x can be 19. So that leaves us with z=0 and y=39-38=1. z=0, y=1, x=19. So 19 1s and 1 2s.
N=22
Solving the system where n=22, we have that y=38-2x and z=x-18. So x is constrained to {18, 19} for reasons above. So we have two solutions.
N=23
For the system n=23 we have that y=37-2x and z=x-17. x is constrained to {17,18}. Hence, two solutions.
N=24
For the system n=24, we have that y=36-2x and z=x-16. x is constrained to {16,17,18}. Hence, three solutions.
N=25
y=35-2x, z=x-15. x is constrained to {15,16,17}. Hence, three solutions.
N=26
y=34-2x, z=x-14. x is constrained to {14,15,16,17}. Hence, four solutions.
N=27
y=33-2x, z=x-13. x is constrained to {13,14,15,16}. Hence, four solutions.
N=28
y=32-2x, z=x-12. x is constrained to {12,13,14,15,16}. Hence, five solutions.
N=29
y=31-2x, z=x-11. x is constrained to {11,12,13,14,15}. Hence, five solutions.
N=30
y=30-2x, z=x-10. x is constrained to {10,11,12,13,14,15}. Hence, six solutions.
N=31
y=29-2x, z=x-9. x is constrained to {9,10,11,12,13,14}. Hence, six solutions.
N=32
y=28-2x, z=x-8. x is constrained to {8,9,10,11,12,13,14}. Hence, seven solutions.
N=33.
y=27-2x, z=x-7. x is constrained to {7,8,9,10,11,12,13}. 7 sols.
N=34, N=35, N=36, N=37, N=38, N=39
The pattern is relatively obvious so I'll just type up the number of solutions for each n.

[EDIT]: MISCOUNTED. ANSWER SHOULD BE 110 + 11 = 121
Respectively, they are: 8, 8, 9, 9, 10, 10. So adding them all up together.. we get 121 ways to fill 20 slots with 1s, 2s, and 3s that total no more than 40.

There is probably a more efficient way to determine the number of solutions, as my mathematical skills are a little rusty from years of inactivity, but 120 does seem to be the number you want.

Last edited by Mathegocart (2021-03-02 01:42:57)

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #7 2021-02-26 13:05:33

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Thanks guys.

I was putz'n around with doing it manually and came up with 11 different combinations as Denominator said  (no repeats)

Question For Mathegocart - is your formula allowing repeats?

Here's The Spreadsheet I Came Up With

Let me know if I'm completely off-base

Last edited by UCanCallMeMitch (2021-02-26 13:13:34)

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #8 2021-02-26 15:22:02

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

UCanCallMeMitch wrote:

Thanks guys.

I was putz'n around with doing it manually and came up with 11 different combinations as Denominator said  (no repeats)

Question For Mathegocart - is your formula allowing repeats?

Here's The Spreadsheet I Came Up With

Let me know if I'm completely off-base

Repeats? Could you clarify?

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #9 2021-02-27 01:48:26

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Sorry for the confusion

Each Combination does not have repetition and order doesn't matter, i.e.

2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1 is the same as

3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 or

2, 2, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, etc.

Last edited by UCanCallMeMitch (2021-02-27 02:13:03)

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #10 2021-02-27 07:34:59

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

UCanCallMeMitch wrote:

Sorry for the confusion

Each Combination does not have repetition and order doesn't matter, i.e.

2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1 is the same as

3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 or

2, 2, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, etc.

Yeah - my method counts all of those as the same. You want each of them to count as individual permutations?

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #11 2021-02-27 11:50:06

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

No, order doesn't matter.

Just wanted to know how many different combinations of 1, 2 and 3 made up the 20 slots and the total sum of them equaled 40.

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #12 2021-02-28 05:51:41

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

UCanCallMeMitch wrote:

No, order doesn't matter.

Just wanted to know how many different combinations of 1, 2 and 3 made up the 20 slots and the total sum of them equaled 40.

Those are the different combos. Order does not matter.

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #13 2021-02-28 11:53:27

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

As I said, I'm really a dunce with math - especially algebra, so I'm not completely understanding what you are calculating.

Are you calculating all the combinations that DON'T EXCEED 40?

Maybe a couple of examples would clear the fog for me ????

Thanks

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline

## #14 2021-03-01 03:46:27

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

UCanCallMeMitch wrote:

As I said, I'm really a dunce with math - especially algebra, so I'm not completely understanding what you are calculating.

Are you calculating all the combinations that DON'T EXCEED 40?

Maybe a couple of examples would clear the fog for me ????

Thanks

The aforementioned linear system is how I determined the number of cases that total to an integer that did not total more than 40, yes.

The System
x = number of 1s
y = number of 2s
z = number of 3s

x + 2y + 3z = n (where n is a positive integer)

x + y + z = 20(i.e, 20 slots for 1, 2, and 3)

So for your first q, yes.

So to determine the number of combinations of 1s, 2s, and 3s that sum to 40, all we have to do is to replace n with 40(since the combo must sum to 40).

Solving for y and z in terms of x, we get that y=20-2x and that z=x.

I start finding said combos by manipulating the value of x - that is, the variable that represents the number of 1s in the combo. So it can range from 0(i.e, no 1s) to 10(not any higher as we would get a negative number for y - which represents 2.)

So there are 11 combos that sum to 40 that consist of 1s, 2s, and 3s.

Adding that to the 120 figure I reached earlier(forgot to add the number of combos for 40), we get 131.

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #15 2021-03-02 00:30:12

Bob
Registered: 2010-06-20
Posts: 10,472

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

hi Mitch and Mathegocart

I've been avoiding this question because I'm not very good with them.  But I've finally plucked up the courage to have a go.  I reasoned like this:

If n is the number of 1s, m the number of 2s and p the number of 3s then we have

n + 2m + 3p ≤ 40  and
n  +  m    +p = 20

Subtracting

m + 2p ≤ 20

So I constructed a spreadsheet with columns for p values and rows for m values and the formula m + 2p.  Anything out of range I deleted.

I found 121 valid entries (including m=p=0) such as

m = 5, p = 9 giving 2m + 3p = 37.  n can then be 0 1 2 or 3.

and

m = 3, p = 11 giving 2m + 3p = 39, n can be  0 or 1.

As there are 121 possible values of m and p, and then lots of n possibilities, that would seem to be quite a big number altogether.

Please let me know of there's a flaw in my logic.  If not then I'll see if I can devise a simple way a finding out how many in total.

Bob

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob

Offline

## #16 2021-03-02 01:43:27

Mathegocart
Member
Registered: 2012-04-29
Posts: 2,226

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Bob wrote:

hi Mitch and Mathegocart

I've been avoiding this question because I'm not very good with them.  But I've finally plucked up the courage to have a go.  I reasoned like this:

If n is the number of 1s, m the number of 2s and p the number of 3s then we have

n + 2m + 3p ≤ 40  and
n  +  m    +p = 20

Subtracting

m + 2p ≤ 20

So I constructed a spreadsheet with columns for p values and rows for m values and the formula m + 2p.  Anything out of range I deleted.

I found 121 valid entries (including m=p=0) such as

m = 5, p = 9 giving 2m + 3p = 37.  n can then be 0 1 2 or 3.

and

m = 3, p = 11 giving 2m + 3p = 39, n can be  0 or 1.

As there are 121 possible values of m and p, and then lots of n possibilities, that would seem to be quite a big number altogether.

Please let me know of there's a flaw in my logic.  If not then I'll see if I can devise a simple way a finding out how many in total.

Bob

Looks like you're right on this. Miscounted and accidentally added 10 to my answer. Woops!

The integral of hope is reality.
May bobbym have a wonderful time in the pearly gates of heaven.
He will be sorely missed.

Offline

## #17 2021-03-02 22:01:31

Bob
Registered: 2010-06-20
Posts: 10,472

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

hi Mathegocart

Ok, thanks.

Just realised I am ignoring n + m + p = 20.

For each entry in my sheet there is one value of n only.  So my total is less than154.  Still working on eliminating cases.

I'll see if I can construct a program to print them all.

edit: I'm now getting 121 once more. (which agrees with Mathegocart's post #6)

Bob

Last edited by Bob (2021-03-02 22:34:31)

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob

Offline

## #18 2021-03-03 02:31:52

Bob
Registered: 2010-06-20
Posts: 10,472

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

n = 20   m =0   p = 0   total = 20   count = 1
n = 19   m =1   p = 0   total = 21   count = 2
n = 18   m =2   p = 0   total = 22   count = 3
n = 17   m =3   p = 0   total = 23   count = 4
n = 16   m =4   p = 0   total = 24   count = 5
n = 15   m =5   p = 0   total = 25   count = 6
n = 14   m =6   p = 0   total = 26   count = 7
n = 13   m =7   p = 0   total = 27   count = 8
n = 12   m =8   p = 0   total = 28   count = 9
n = 11   m =9   p = 0   total = 29   count = 10
n = 10   m =10   p = 0   total = 30   count = 11
n = 9   m =11   p = 0   total = 31   count = 12
n = 8   m =12   p = 0   total = 32   count = 13
n = 7   m =13   p = 0   total = 33   count = 14
n = 6   m =14   p = 0   total = 34   count = 15
n = 5   m =15   p = 0   total = 35   count = 16
n = 4   m =16   p = 0   total = 36   count = 17
n = 3   m =17   p = 0   total = 37   count = 18
n = 2   m =18   p = 0   total = 38   count = 19
n = 1   m =19   p = 0   total = 39   count = 20
n = 0   m =20   p = 0   total = 40   count = 21
n = 19   m =0   p = 1   total = 22   count = 22
n = 18   m =1   p = 1   total = 23   count = 23
n = 17   m =2   p = 1   total = 24   count = 24
n = 16   m =3   p = 1   total = 25   count = 25
n = 15   m =4   p = 1   total = 26   count = 26
n = 14   m =5   p = 1   total = 27   count = 27
n = 13   m =6   p = 1   total = 28   count = 28
n = 12   m =7   p = 1   total = 29   count = 29
n = 11   m =8   p = 1   total = 30   count = 30
n = 10   m =9   p = 1   total = 31   count = 31
n = 9   m =10   p = 1   total = 32   count = 32
n = 8   m =11   p = 1   total = 33   count = 33
n = 7   m =12   p = 1   total = 34   count = 34
n = 6   m =13   p = 1   total = 35   count = 35
n = 5   m =14   p = 1   total = 36   count = 36
n = 4   m =15   p = 1   total = 37   count = 37
n = 3   m =16   p = 1   total = 38   count = 38
n = 2   m =17   p = 1   total = 39   count = 39
n = 1   m =18   p = 1   total = 40   count = 40
n = 18   m =0   p = 2   total = 24   count = 41
n = 17   m =1   p = 2   total = 25   count = 42
n = 16   m =2   p = 2   total = 26   count = 43
n = 15   m =3   p = 2   total = 27   count = 44
n = 14   m =4   p = 2   total = 28   count = 45
n = 13   m =5   p = 2   total = 29   count = 46
n = 12   m =6   p = 2   total = 30   count = 47
n = 11   m =7   p = 2   total = 31   count = 48
n = 10   m =8   p = 2   total = 32   count = 49
n = 9   m =9   p = 2   total = 33   count = 50
n = 8   m =10   p = 2   total = 34   count = 51
n = 7   m =11   p = 2   total = 35   count = 52
n = 6   m =12   p = 2   total = 36   count = 53
n = 5   m =13   p = 2   total = 37   count = 54
n = 4   m =14   p = 2   total = 38   count = 55
n = 3   m =15   p = 2   total = 39   count = 56
n = 2   m =16   p = 2   total = 40   count = 57
n = 17   m =0   p = 3   total = 26   count = 58
n = 16   m =1   p = 3   total = 27   count = 59
n = 15   m =2   p = 3   total = 28   count = 60
n = 14   m =3   p = 3   total = 29   count = 61
n = 13   m =4   p = 3   total = 30   count = 62
n = 12   m =5   p = 3   total = 31   count = 63
n = 11   m =6   p = 3   total = 32   count = 64
n = 10   m =7   p = 3   total = 33   count = 65
n = 9   m =8   p = 3   total = 34   count = 66
n = 8   m =9   p = 3   total = 35   count = 67
n = 7   m =10   p = 3   total = 36   count = 68
n = 6   m =11   p = 3   total = 37   count = 69
n = 5   m =12   p = 3   total = 38   count = 70
n = 4   m =13   p = 3   total = 39   count = 71
n = 3   m =14   p = 3   total = 40   count = 72
n = 16   m =0   p = 4   total = 28   count = 73
n = 15   m =1   p = 4   total = 29   count = 74
n = 14   m =2   p = 4   total = 30   count = 75
n = 13   m =3   p = 4   total = 31   count = 76
n = 12   m =4   p = 4   total = 32   count = 77
n = 11   m =5   p = 4   total = 33   count = 78
n = 10   m =6   p = 4   total = 34   count = 79
n = 9   m =7   p = 4   total = 35   count = 80
n = 8   m =8   p = 4   total = 36   count = 81
n = 7   m =9   p = 4   total = 37   count = 82
n = 6   m =10   p = 4   total = 38   count = 83
n = 5   m =11   p = 4   total = 39   count = 84
n = 4   m =12   p = 4   total = 40   count = 85
n = 15   m =0   p = 5   total = 30   count = 86
n = 14   m =1   p = 5   total = 31   count = 87
n = 13   m =2   p = 5   total = 32   count = 88
n = 12   m =3   p = 5   total = 33   count = 89
n = 11   m =4   p = 5   total = 34   count = 90
n = 10   m =5   p = 5   total = 35   count = 91
n = 9   m =6   p = 5   total = 36   count = 92
n = 8   m =7   p = 5   total = 37   count = 93
n = 7   m =8   p = 5   total = 38   count = 94
n = 6   m =9   p = 5   total = 39   count = 95
n = 5   m =10   p = 5   total = 40   count = 96
n = 14   m =0   p = 6   total = 32   count = 97
n = 13   m =1   p = 6   total = 33   count = 98
n = 12   m =2   p = 6   total = 34   count = 99
n = 11   m =3   p = 6   total = 35   count = 100
n = 10   m =4   p = 6   total = 36   count = 101
n = 9   m =5   p = 6   total = 37   count = 102
n = 8   m =6   p = 6   total = 38   count = 103
n = 7   m =7   p = 6   total = 39   count = 104
n = 6   m =8   p = 6   total = 40   count = 105
n = 13   m =0   p = 7   total = 34   count = 106
n = 12   m =1   p = 7   total = 35   count = 107
n = 11   m =2   p = 7   total = 36   count = 108
n = 10   m =3   p = 7   total = 37   count = 109
n = 9   m =4   p = 7   total = 38   count = 110
n = 8   m =5   p = 7   total = 39   count = 111
n = 7   m =6   p = 7   total = 40   count = 112
n = 12   m =0   p = 8   total = 36   count = 113
n = 11   m =1   p = 8   total = 37   count = 114
n = 10   m =2   p = 8   total = 38   count = 115
n = 9   m =3   p = 8   total = 39   count = 116
n = 8   m =4   p = 8   total = 40   count = 117
n = 11   m =0   p = 9   total = 38   count = 118
n = 10   m =1   p = 9   total = 39   count = 119
n = 9   m =2   p = 9   total = 40   count = 120
n = 10   m =0   p = 10   total = 40   count = 121

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob

Offline

## #19 2021-03-04 12:19:25

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,860

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Hi all;

I got Bob's list with these two codes (haven't tried it in Excel yet, nor looked at other ways):

The BASIC code can be run online at jdoodle.com's YABASIC, here.

Both codes test each case in the order produced from the following (a)+(b)+(c) nested sequence:
(a) each value of 3p (ie, p = 0 to 13), plus
(b) each value of 2m (ie, m = 0 to 20) for every (a), plus
(c) each value of n (ie, n = 0 to 20) for every (b)

The details of each result where both n+2m+3p<41 and n+m+p=20 are printed in the order found.

Edit: Since tried it in Excel...same answer: 121 combinations.

Last edited by phrontister (2021-03-23 14:34:55)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

## #20 2021-03-08 16:22:24

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,860

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

In post #1, UCanCallMeMitch wrote:

without exceeding the sum total of 40

My post #19 was for that '<41' scenario (as per thread title "That Total No More Than 40"), with 121 combinations found.

In post #11, UCanCallMeMitch wrote:

the total sum of them equaled 40

Here's my code for the '=40' scenario, with 11 combinations found:

The BASIC code can be run online at jdoodle.com's YABASIC, here.

Last edited by phrontister (2021-03-23 14:49:54)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

## #21 2021-03-16 13:36:58

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,860

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

In Bob's list in post #18 and mine in post #19 (both with 121 combinations), I noticed an arithmetic sequence when comparing the number of combinations between adjacent groups of p values.

1. The number of combinations of m & n (where both n+2m+3p ≤ 40 and n+m+p = 20) differ by 2 for adjacent p, eg:
(a) {20n,0m,0p} to {0n,20m,0p} = 21
(b) {19n,0m,1p} to {1n,18m,1p} = 19
(c) {11n,0m,9p} to {9n,2m,9p} = 3
(d) {10n,0m,10p} = 1 (the last option)

2. From 1 above, we get:
1(a)-1(b) = 21-19 = 2, and
1(c)-1(d) = 3-1 = 2
ie, adjacent p {0p,1p} and (9p,10p} differ by 2.

3. There are 11 p groups (0p to 10p) in the full range (0p=21, 1p=19, 2p=17, 3p=15, 4p=13, 5p=11, 6p=9, 7p=7, 8p=5, 9p=3, 10p=1), and all adjacent p differ by 2.

4. Arithmetic sequence formula z(2x+y(z-1))/2 finds the total number of combinations, where:
x = the first term...which is 1 (see 1(d) above)
y = the 'common difference' between terms...which is 2 (see 2 & 3 above)
z = how many terms to add up...which is 11 (see 3 above)

5. z(2x+y(z-1))/2 = 11(2*1+2(11-1))/2 = 121 combinations.

6. x, y & z in 4 above vary according to the number of slots (OP's = 20) and the sum total (OP's is ≤40).

Last edited by phrontister (2021-03-17 22:49:22)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

## #22 2021-03-29 21:49:04

UCanCallMeMitch
Member
From: Thornton, CO
Registered: 2020-02-28
Posts: 37
Website

### Re: 20 Slots Filled With Only 3 Numbers That Total No More Than 40

Sorry for the delay of this response.

Thanks guys - you went above and beyond.

Everything makes sense.

"The more you explain it, the more I don't understand it."
-- Mark Twain

Offline