How to count the number of solutions to linear Diophantine equation with multiple variables recursively?












1












$begingroup$


Consider the diophantine equation of the form
$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$
where $n,kgeq 1$ and $a_i$ are non-negative integers. Then we are concerned $v(n)$ denote the number of solutions for a fixed tuple $(a_1,a_2,cdots ,a_k).$ Can $v(n)$ be expressed recursively, that is, in terms of $v(n-1),v(n-2),$ etc?



I considered the following example to see if I could generalize
$$x_1+2x_2 = n.$$
I noticed that if $(x_1,x_2)$ is a solution of $x_1+2x_2 = n-k$ then $(x_1+k,x_2)$ is a solution of $x_1+2x_2=n.$ Furthermore for $k=2p$ then if $x_1+2x_2 = n-k=n - 2p$ then $(x_1,x_2+p)$ is a solution of $x_1+2x_2=n.$ Therefore,
$$v(n) = sum_{k=1}^{n}v(n-k)+v(n-2)+v(n-4)+cdots $$



Is this correct? How do I get a general formula for $v(n)?$ Any ideas will be much appreciated?










share|cite|improve this question









$endgroup$












  • $begingroup$
    Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
    $endgroup$
    – coffeemath
    Dec 29 '18 at 22:27






  • 1




    $begingroup$
    $x_k$ are non-negative.
    $endgroup$
    – Hello_World
    Dec 29 '18 at 22:48










  • $begingroup$
    In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
    $endgroup$
    – coffeemath
    Dec 30 '18 at 0:37








  • 1




    $begingroup$
    Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
    $endgroup$
    – Hello_World
    Dec 30 '18 at 0:48










  • $begingroup$
    Yes, that link of your comment seems to be to a proven recurrence.
    $endgroup$
    – coffeemath
    Dec 30 '18 at 1:07
















1












$begingroup$


Consider the diophantine equation of the form
$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$
where $n,kgeq 1$ and $a_i$ are non-negative integers. Then we are concerned $v(n)$ denote the number of solutions for a fixed tuple $(a_1,a_2,cdots ,a_k).$ Can $v(n)$ be expressed recursively, that is, in terms of $v(n-1),v(n-2),$ etc?



I considered the following example to see if I could generalize
$$x_1+2x_2 = n.$$
I noticed that if $(x_1,x_2)$ is a solution of $x_1+2x_2 = n-k$ then $(x_1+k,x_2)$ is a solution of $x_1+2x_2=n.$ Furthermore for $k=2p$ then if $x_1+2x_2 = n-k=n - 2p$ then $(x_1,x_2+p)$ is a solution of $x_1+2x_2=n.$ Therefore,
$$v(n) = sum_{k=1}^{n}v(n-k)+v(n-2)+v(n-4)+cdots $$



Is this correct? How do I get a general formula for $v(n)?$ Any ideas will be much appreciated?










share|cite|improve this question









$endgroup$












  • $begingroup$
    Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
    $endgroup$
    – coffeemath
    Dec 29 '18 at 22:27






  • 1




    $begingroup$
    $x_k$ are non-negative.
    $endgroup$
    – Hello_World
    Dec 29 '18 at 22:48










  • $begingroup$
    In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
    $endgroup$
    – coffeemath
    Dec 30 '18 at 0:37








  • 1




    $begingroup$
    Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
    $endgroup$
    – Hello_World
    Dec 30 '18 at 0:48










  • $begingroup$
    Yes, that link of your comment seems to be to a proven recurrence.
    $endgroup$
    – coffeemath
    Dec 30 '18 at 1:07














1












1








1


0



$begingroup$


Consider the diophantine equation of the form
$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$
where $n,kgeq 1$ and $a_i$ are non-negative integers. Then we are concerned $v(n)$ denote the number of solutions for a fixed tuple $(a_1,a_2,cdots ,a_k).$ Can $v(n)$ be expressed recursively, that is, in terms of $v(n-1),v(n-2),$ etc?



I considered the following example to see if I could generalize
$$x_1+2x_2 = n.$$
I noticed that if $(x_1,x_2)$ is a solution of $x_1+2x_2 = n-k$ then $(x_1+k,x_2)$ is a solution of $x_1+2x_2=n.$ Furthermore for $k=2p$ then if $x_1+2x_2 = n-k=n - 2p$ then $(x_1,x_2+p)$ is a solution of $x_1+2x_2=n.$ Therefore,
$$v(n) = sum_{k=1}^{n}v(n-k)+v(n-2)+v(n-4)+cdots $$



Is this correct? How do I get a general formula for $v(n)?$ Any ideas will be much appreciated?










share|cite|improve this question









$endgroup$




Consider the diophantine equation of the form
$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$
where $n,kgeq 1$ and $a_i$ are non-negative integers. Then we are concerned $v(n)$ denote the number of solutions for a fixed tuple $(a_1,a_2,cdots ,a_k).$ Can $v(n)$ be expressed recursively, that is, in terms of $v(n-1),v(n-2),$ etc?



I considered the following example to see if I could generalize
$$x_1+2x_2 = n.$$
I noticed that if $(x_1,x_2)$ is a solution of $x_1+2x_2 = n-k$ then $(x_1+k,x_2)$ is a solution of $x_1+2x_2=n.$ Furthermore for $k=2p$ then if $x_1+2x_2 = n-k=n - 2p$ then $(x_1,x_2+p)$ is a solution of $x_1+2x_2=n.$ Therefore,
$$v(n) = sum_{k=1}^{n}v(n-k)+v(n-2)+v(n-4)+cdots $$



Is this correct? How do I get a general formula for $v(n)?$ Any ideas will be much appreciated?







combinatorics number-theory






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Dec 29 '18 at 22:15









Hello_WorldHello_World

4,14121931




4,14121931












  • $begingroup$
    Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
    $endgroup$
    – coffeemath
    Dec 29 '18 at 22:27






  • 1




    $begingroup$
    $x_k$ are non-negative.
    $endgroup$
    – Hello_World
    Dec 29 '18 at 22:48










  • $begingroup$
    In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
    $endgroup$
    – coffeemath
    Dec 30 '18 at 0:37








  • 1




    $begingroup$
    Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
    $endgroup$
    – Hello_World
    Dec 30 '18 at 0:48










  • $begingroup$
    Yes, that link of your comment seems to be to a proven recurrence.
    $endgroup$
    – coffeemath
    Dec 30 '18 at 1:07


















  • $begingroup$
    Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
    $endgroup$
    – coffeemath
    Dec 29 '18 at 22:27






  • 1




    $begingroup$
    $x_k$ are non-negative.
    $endgroup$
    – Hello_World
    Dec 29 '18 at 22:48










  • $begingroup$
    In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
    $endgroup$
    – coffeemath
    Dec 30 '18 at 0:37








  • 1




    $begingroup$
    Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
    $endgroup$
    – Hello_World
    Dec 30 '18 at 0:48










  • $begingroup$
    Yes, that link of your comment seems to be to a proven recurrence.
    $endgroup$
    – coffeemath
    Dec 30 '18 at 1:07
















$begingroup$
Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
$endgroup$
– coffeemath
Dec 29 '18 at 22:27




$begingroup$
Are the $x_k$ to be any integers? (then infinitely many solutions can happen), or are the $x_k$ to be non-negative?
$endgroup$
– coffeemath
Dec 29 '18 at 22:27




1




1




$begingroup$
$x_k$ are non-negative.
$endgroup$
– Hello_World
Dec 29 '18 at 22:48




$begingroup$
$x_k$ are non-negative.
$endgroup$
– Hello_World
Dec 29 '18 at 22:48












$begingroup$
In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
$endgroup$
– coffeemath
Dec 30 '18 at 0:37






$begingroup$
In your formula, in the sum part are many terms which coincide with the extra terms after the sum. Have you tried your formula in some cases of reasonably small $n$? It would be good to include them. [I assume the extra terms are restricted so no terms $v( rm{negative})$ occur.]
$endgroup$
– coffeemath
Dec 30 '18 at 0:37






1




1




$begingroup$
Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
$endgroup$
– Hello_World
Dec 30 '18 at 0:48




$begingroup$
Yeah, I will try that. In the meantime I found this: nipne.ro/rjp/2013_58_9-10/1408_1417.pdf Refer to page 2. I think it is interesting.
$endgroup$
– Hello_World
Dec 30 '18 at 0:48












$begingroup$
Yes, that link of your comment seems to be to a proven recurrence.
$endgroup$
– coffeemath
Dec 30 '18 at 1:07




$begingroup$
Yes, that link of your comment seems to be to a proven recurrence.
$endgroup$
– coffeemath
Dec 30 '18 at 1:07










1 Answer
1






active

oldest

votes


















0












$begingroup$

Let's denote with $v(k,n)$ the number of solutions of the following equation:



$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$



Take a look at the last item $x_k$. It can take any value from 0 to $lfloor{frac{n}{a_k}}rfloor$. So we have the following recurrence relation:



$$v(k,n)=sum_{i=0}^{lfloor{frac{n}{a_k}}rfloor} v(k-1,n-icdot a_k)tag{1}$$



...with the following exit criteria:



$$v(1,n)=begin{cases}
1, & text{if} a_1mid n \
0, & text{if} a_1nmid n
end{cases}$$



Here is an example: let's count the number of solutions for the following equation:



$$x_1+2x_2+3x_3+2x_4+6x_5+2x_6=100$$



You can do this in Java:



public class SolutionCounter {
public static int count(int a, int k, int n) {
if(k == 1) {
return (n % a[0] == 0)? 1: 0;
}
int cnt = 0;
for(int i = 0; i <= n / a[k - 1]; i++) {
cnt += count(a, k - 1, n - i * a[k - 1]);
}
return cnt;
}

public static void main(String args) {
int a = {1,2,3,2,6,2};
int sum = 100;
int cnt = count(a, a.length, sum);
System.out.println(cnt);
}

}


or with this ridiculously short Python script:



def cnt(a, k, n):
if k == 1:
return 1 if n % a[0] == 0 else 0
return sum(cnt(a, k - 1, n - i * a[k - 1]) for i in range(0, int(n / a[k - 1]) + 1))

print(cnt([1,2,3,2,6,2], 6, 100))


...and the result is: 847875.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Could you give a recurrence in terms of $n$?
    $endgroup$
    – Hello_World
    Jan 2 at 9:31










  • $begingroup$
    (1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
    $endgroup$
    – Oldboy
    Jan 2 at 10:54










  • $begingroup$
    Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
    $endgroup$
    – Hello_World
    Jan 2 at 11:00










  • $begingroup$
    @Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
    $endgroup$
    – Oldboy
    Jan 2 at 11:20













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3056309%2fhow-to-count-the-number-of-solutions-to-linear-diophantine-equation-with-multipl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

Let's denote with $v(k,n)$ the number of solutions of the following equation:



$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$



Take a look at the last item $x_k$. It can take any value from 0 to $lfloor{frac{n}{a_k}}rfloor$. So we have the following recurrence relation:



$$v(k,n)=sum_{i=0}^{lfloor{frac{n}{a_k}}rfloor} v(k-1,n-icdot a_k)tag{1}$$



...with the following exit criteria:



$$v(1,n)=begin{cases}
1, & text{if} a_1mid n \
0, & text{if} a_1nmid n
end{cases}$$



Here is an example: let's count the number of solutions for the following equation:



$$x_1+2x_2+3x_3+2x_4+6x_5+2x_6=100$$



You can do this in Java:



public class SolutionCounter {
public static int count(int a, int k, int n) {
if(k == 1) {
return (n % a[0] == 0)? 1: 0;
}
int cnt = 0;
for(int i = 0; i <= n / a[k - 1]; i++) {
cnt += count(a, k - 1, n - i * a[k - 1]);
}
return cnt;
}

public static void main(String args) {
int a = {1,2,3,2,6,2};
int sum = 100;
int cnt = count(a, a.length, sum);
System.out.println(cnt);
}

}


or with this ridiculously short Python script:



def cnt(a, k, n):
if k == 1:
return 1 if n % a[0] == 0 else 0
return sum(cnt(a, k - 1, n - i * a[k - 1]) for i in range(0, int(n / a[k - 1]) + 1))

print(cnt([1,2,3,2,6,2], 6, 100))


...and the result is: 847875.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Could you give a recurrence in terms of $n$?
    $endgroup$
    – Hello_World
    Jan 2 at 9:31










  • $begingroup$
    (1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
    $endgroup$
    – Oldboy
    Jan 2 at 10:54










  • $begingroup$
    Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
    $endgroup$
    – Hello_World
    Jan 2 at 11:00










  • $begingroup$
    @Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
    $endgroup$
    – Oldboy
    Jan 2 at 11:20


















0












$begingroup$

Let's denote with $v(k,n)$ the number of solutions of the following equation:



$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$



Take a look at the last item $x_k$. It can take any value from 0 to $lfloor{frac{n}{a_k}}rfloor$. So we have the following recurrence relation:



$$v(k,n)=sum_{i=0}^{lfloor{frac{n}{a_k}}rfloor} v(k-1,n-icdot a_k)tag{1}$$



...with the following exit criteria:



$$v(1,n)=begin{cases}
1, & text{if} a_1mid n \
0, & text{if} a_1nmid n
end{cases}$$



Here is an example: let's count the number of solutions for the following equation:



$$x_1+2x_2+3x_3+2x_4+6x_5+2x_6=100$$



You can do this in Java:



public class SolutionCounter {
public static int count(int a, int k, int n) {
if(k == 1) {
return (n % a[0] == 0)? 1: 0;
}
int cnt = 0;
for(int i = 0; i <= n / a[k - 1]; i++) {
cnt += count(a, k - 1, n - i * a[k - 1]);
}
return cnt;
}

public static void main(String args) {
int a = {1,2,3,2,6,2};
int sum = 100;
int cnt = count(a, a.length, sum);
System.out.println(cnt);
}

}


or with this ridiculously short Python script:



def cnt(a, k, n):
if k == 1:
return 1 if n % a[0] == 0 else 0
return sum(cnt(a, k - 1, n - i * a[k - 1]) for i in range(0, int(n / a[k - 1]) + 1))

print(cnt([1,2,3,2,6,2], 6, 100))


...and the result is: 847875.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Could you give a recurrence in terms of $n$?
    $endgroup$
    – Hello_World
    Jan 2 at 9:31










  • $begingroup$
    (1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
    $endgroup$
    – Oldboy
    Jan 2 at 10:54










  • $begingroup$
    Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
    $endgroup$
    – Hello_World
    Jan 2 at 11:00










  • $begingroup$
    @Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
    $endgroup$
    – Oldboy
    Jan 2 at 11:20
















0












0








0





$begingroup$

Let's denote with $v(k,n)$ the number of solutions of the following equation:



$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$



Take a look at the last item $x_k$. It can take any value from 0 to $lfloor{frac{n}{a_k}}rfloor$. So we have the following recurrence relation:



$$v(k,n)=sum_{i=0}^{lfloor{frac{n}{a_k}}rfloor} v(k-1,n-icdot a_k)tag{1}$$



...with the following exit criteria:



$$v(1,n)=begin{cases}
1, & text{if} a_1mid n \
0, & text{if} a_1nmid n
end{cases}$$



Here is an example: let's count the number of solutions for the following equation:



$$x_1+2x_2+3x_3+2x_4+6x_5+2x_6=100$$



You can do this in Java:



public class SolutionCounter {
public static int count(int a, int k, int n) {
if(k == 1) {
return (n % a[0] == 0)? 1: 0;
}
int cnt = 0;
for(int i = 0; i <= n / a[k - 1]; i++) {
cnt += count(a, k - 1, n - i * a[k - 1]);
}
return cnt;
}

public static void main(String args) {
int a = {1,2,3,2,6,2};
int sum = 100;
int cnt = count(a, a.length, sum);
System.out.println(cnt);
}

}


or with this ridiculously short Python script:



def cnt(a, k, n):
if k == 1:
return 1 if n % a[0] == 0 else 0
return sum(cnt(a, k - 1, n - i * a[k - 1]) for i in range(0, int(n / a[k - 1]) + 1))

print(cnt([1,2,3,2,6,2], 6, 100))


...and the result is: 847875.






share|cite|improve this answer











$endgroup$



Let's denote with $v(k,n)$ the number of solutions of the following equation:



$$a_1x_1+a_2x_2+cdots +a_kx_k=n$$



Take a look at the last item $x_k$. It can take any value from 0 to $lfloor{frac{n}{a_k}}rfloor$. So we have the following recurrence relation:



$$v(k,n)=sum_{i=0}^{lfloor{frac{n}{a_k}}rfloor} v(k-1,n-icdot a_k)tag{1}$$



...with the following exit criteria:



$$v(1,n)=begin{cases}
1, & text{if} a_1mid n \
0, & text{if} a_1nmid n
end{cases}$$



Here is an example: let's count the number of solutions for the following equation:



$$x_1+2x_2+3x_3+2x_4+6x_5+2x_6=100$$



You can do this in Java:



public class SolutionCounter {
public static int count(int a, int k, int n) {
if(k == 1) {
return (n % a[0] == 0)? 1: 0;
}
int cnt = 0;
for(int i = 0; i <= n / a[k - 1]; i++) {
cnt += count(a, k - 1, n - i * a[k - 1]);
}
return cnt;
}

public static void main(String args) {
int a = {1,2,3,2,6,2};
int sum = 100;
int cnt = count(a, a.length, sum);
System.out.println(cnt);
}

}


or with this ridiculously short Python script:



def cnt(a, k, n):
if k == 1:
return 1 if n % a[0] == 0 else 0
return sum(cnt(a, k - 1, n - i * a[k - 1]) for i in range(0, int(n / a[k - 1]) + 1))

print(cnt([1,2,3,2,6,2], 6, 100))


...and the result is: 847875.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Jan 2 at 10:51

























answered Dec 30 '18 at 9:44









OldboyOldboy

8,59011036




8,59011036












  • $begingroup$
    Could you give a recurrence in terms of $n$?
    $endgroup$
    – Hello_World
    Jan 2 at 9:31










  • $begingroup$
    (1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
    $endgroup$
    – Oldboy
    Jan 2 at 10:54










  • $begingroup$
    Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
    $endgroup$
    – Hello_World
    Jan 2 at 11:00










  • $begingroup$
    @Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
    $endgroup$
    – Oldboy
    Jan 2 at 11:20




















  • $begingroup$
    Could you give a recurrence in terms of $n$?
    $endgroup$
    – Hello_World
    Jan 2 at 9:31










  • $begingroup$
    (1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
    $endgroup$
    – Oldboy
    Jan 2 at 10:54










  • $begingroup$
    Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
    $endgroup$
    – Hello_World
    Jan 2 at 11:00










  • $begingroup$
    @Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
    $endgroup$
    – Oldboy
    Jan 2 at 11:20


















$begingroup$
Could you give a recurrence in terms of $n$?
$endgroup$
– Hello_World
Jan 2 at 9:31




$begingroup$
Could you give a recurrence in terms of $n$?
$endgroup$
– Hello_World
Jan 2 at 9:31












$begingroup$
(1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
$endgroup$
– Oldboy
Jan 2 at 10:54




$begingroup$
(1) already gives recurrence formula for $v(n)$ in terms of $v(n-1)$, $v(n-2)$,... but you must also take values of $a_i$ into account. I doubt that simpler recurrence formula exists.
$endgroup$
– Oldboy
Jan 2 at 10:54












$begingroup$
Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
$endgroup$
– Hello_World
Jan 2 at 11:00




$begingroup$
Say you have $x_1+2x_2=n$ and the number of solutions to this is $v(n).$ Is there a way to express $v(n)$ in terms of $v(1),v(2),cdots,v(n-1)?$ In your recurrence, it like you are conditioning on one variable and therefore getting rid of a term. Whereas I want to condition on $n$. I hope this makes sense?
$endgroup$
– Hello_World
Jan 2 at 11:00












$begingroup$
@Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
$endgroup$
– Oldboy
Jan 2 at 11:20






$begingroup$
@Hello_World Can you explain your request on the simplest possible example: $4x_1=n$. What is the recurrence formula for $v(n)$ in this simplest case? If we don't find a cute formula for one variable, chances are we won't find it for many more.
$endgroup$
– Oldboy
Jan 2 at 11:20




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3056309%2fhow-to-count-the-number-of-solutions-to-linear-diophantine-equation-with-multipl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei