Why is there a 4 4 with d d ? Foolish Number !

Consider the equation:

a + b + c + 4 d = 20 a+b+c+4d=20 .

How many non-negative integer solutions are there of this equation?

Details and Assumptions:

  • Non-Negative Integer Solutions means that 0 0 is also to be counted as a solution.
  • This problem is not entirely original.


The answer is 536.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

The problem can be solved with stars=and-bars method with a twice, as d d has a 4 4 as coefficient.

There are 6 6 acceptable values for d = 0 , 1 , 2 , 3 , 4 , 5 d = 0,1,2,3,4,5 .

When d = 0 d = 0 , then we need to find the number of solutions for a + b + c = 20 a+b+c = 20 . This is equivalent to finding the number of solutions for x + y + z = 23 x+y+z = 23 using the stars-and-bars method, which requires x , y , z 1 x, y, z \ge 1 , while a , b , c a, b, c can be 0 0 . The number of solutions is given by: N 0 = ( 23 1 3 1 ) = ( 22 2 ) N_0 = \left( \begin{matrix} 23-1 \\ 3-1 \end{matrix} \right) = \left( \begin{matrix} 22 \\ 2 \end{matrix} \right) . The number of solutions when d = n , n = 0 , 1 , 2 , 3 , 4 , 5 d = n, n = 0,1,2,3,4,5 is therefore, N n = ( 22 4 n 2 ) N_n = \left( \begin{matrix} 22-4n \\ 2 \end{matrix} \right) . Therefore, the total number of solutions:

N = N 0 + N 1 + N 2 + N 3 + N 4 + N 5 N = N_0+N_1+N_2+N_3+N_4+N_5

= ( 22 2 ) + ( 18 2 ) + ( 14 2 ) + ( 10 2 ) + ( 6 2 ) + ( 2 2 ) \quad = \left( \begin{matrix} 22 \\ 2 \end{matrix} \right) + \left( \begin{matrix} 18 \\ 2 \end{matrix} \right) + \left( \begin{matrix} 14 \\ 2 \end{matrix} \right) + \left( \begin{matrix} 10 \\ 2 \end{matrix} \right) + \left( \begin{matrix} 6 \\ 2 \end{matrix} \right) + \left( \begin{matrix} 2 \\ 2 \end{matrix} \right)

= 231 + 153 + 91 + 45 + 15 + 1 = 536 \quad = 231 + 153 + 91 + 45 + 15 + 1 = \boxed {536}

There is an especially useful function in Mathematica for this kind of problem: (FrobeniusSolve[{a, b, c}, s] for finding the list of all solutions to the equation a x + b y + c z = = s a x + b y + c z == s , where a , b , c a,b,c are given positive integers and d is an integer, while x , y , z x,y,z are non-negative integers to be found.

The formula is FrobeniusSolve[{1, 1, 1, 4}, 20] // Length

Ar Agarwal
Oct 8, 2014

Here's a python script to achieve the same:

 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
def factors_set():
    factors_set = ((i,j,k,l) for i in range(21) for j in range(21) for k in range(21) for l in range(6))
    for factor in factors_set:
        yield factor

def memoize(f):
    results = {}
    def helper(x):
        if x not in results:
            results[x] = f(x)
        return results[x]
    return helper

@memoize        
def linear_combination(n):
    weigh = (1,1,1,4)
    count = 0
    for factors in factors_set():
        sum = 0
        for i in range(len(factors)):
            sum += factors[i]*weigh[i]
        if sum == n:
            count +=1
    print (count)

linear_combination(20)

Hey I used a python script as well!

1
2
3
4
5
6
7
8
9
def bad_6():
    count=0   
    for a in range(0,21):
        for b in range(0,21):
            for c in range(0,21):
                for d in range(0,21):
                    if a+b+c+4*d==20:
                        count+=1
    return count

john c - 6 years, 7 months ago
Adarsh Kumar
Oct 8, 2014

The equation we have is 20 = a + b + c + 4 d . 20=a+b+c+4d. Now,because there is a 4 d 4d in that equation it makes our job easier as now we know the range of d d which is from 0 0 to 5. 5. C a s e 1 : d = 0 Case\ 1:\\ d=0 a + b + c = 20 \Longrightarrow\ a+b+c=20 .Let us first consider the non-zero cases.We have a theorem for that which is ( n 1 k 1 ) \dbinom{n-1}{k-1} where n = 20 ( a + b + c ) n=20(a+b+c) and k = 3 ( a , b , c ) k=3(a,b,c) the proof of this is very simple if one uses stars and bars.Now,let us consider the cases which have one or two or all of a , b , c = 0. a,b,c=0. C a s e 1 : a = 0 , b = 1 , 2...10 , c = 19 , 18...10. Case\ 1:a=0,b=1,2...10,c=19,18...10. Now,it is easy to do the permutations. C a s e 2 : a = b = 0 , c = 20. Case\ 2:a=b=0,c=20. This gives a total of ( 19 2 ) \dbinom{19}{2} (non-zero cases+ 60 60 (zero cases). C a s e 2 : d = 1 Case\ 2:\\d=1 a + b + c = 16. \Longrightarrow\ a+b+c=16. Again,let us first consider the non-zero cases = ( 16 1 3 1 ) , =\dbinom{16-1}{3-1}, Now let us consider the zero cases a = 0 , b = 1 , 2 , 3....7 , c = 15 , 14 , 13..8. a=0,b=1,2,3....7,c=15,14,13..8. We can easily do the permutations giving us 40 40 cases.So,total= ( 15 2 ) + 48. \dbinom{15}{2}+48. We do the same thing with d = 3 d=3 and see that their is a pattern ( 19 2 ) + 60 , ( 15 2 ) + 48 , ( 11 2 ) + 36... \dbinom{19}{2}+60,\dbinom{15}{2}+48,\dbinom{11}{2}+36... Last case is d = 5 d=5 which has only one solution = ( a , b , c , d ) = ( 0 , 0 , 0 , 20 ) . =(a,b,c,d)=(0,0,0,20).

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...