In how many ways can I write $0$ as a sum of $n; 0s, 1s ;text{and}; -1s?$
$begingroup$
In how many ways can I write $0$ as a sum of $n; 0s, 1s ;text{or}; -1s?$ (Taking the order into account).
I suspect there is no closed formula to express the result, but I'd like someone to confirm it, or deny it.
Edit:
e.g., if $n=3$
$$begin{aligned}0&=;;;0+0+0,\ 0&=;;;1-1+0,\ 0&=;;;1+0-1,\ 0&=;;;0+1-1,\ 0&=-1+1+0,\ 0&=-1+0+1,\ 0&=;;;0-1+1.end{aligned}$$
So for $n=3;$ there are $7$ ways.
combinatorics
$endgroup$
|
show 1 more comment
$begingroup$
In how many ways can I write $0$ as a sum of $n; 0s, 1s ;text{or}; -1s?$ (Taking the order into account).
I suspect there is no closed formula to express the result, but I'd like someone to confirm it, or deny it.
Edit:
e.g., if $n=3$
$$begin{aligned}0&=;;;0+0+0,\ 0&=;;;1-1+0,\ 0&=;;;1+0-1,\ 0&=;;;0+1-1,\ 0&=-1+1+0,\ 0&=-1+0+1,\ 0&=;;;0-1+1.end{aligned}$$
So for $n=3;$ there are $7$ ways.
combinatorics
$endgroup$
1
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25
|
show 1 more comment
$begingroup$
In how many ways can I write $0$ as a sum of $n; 0s, 1s ;text{or}; -1s?$ (Taking the order into account).
I suspect there is no closed formula to express the result, but I'd like someone to confirm it, or deny it.
Edit:
e.g., if $n=3$
$$begin{aligned}0&=;;;0+0+0,\ 0&=;;;1-1+0,\ 0&=;;;1+0-1,\ 0&=;;;0+1-1,\ 0&=-1+1+0,\ 0&=-1+0+1,\ 0&=;;;0-1+1.end{aligned}$$
So for $n=3;$ there are $7$ ways.
combinatorics
$endgroup$
In how many ways can I write $0$ as a sum of $n; 0s, 1s ;text{or}; -1s?$ (Taking the order into account).
I suspect there is no closed formula to express the result, but I'd like someone to confirm it, or deny it.
Edit:
e.g., if $n=3$
$$begin{aligned}0&=;;;0+0+0,\ 0&=;;;1-1+0,\ 0&=;;;1+0-1,\ 0&=;;;0+1-1,\ 0&=-1+1+0,\ 0&=-1+0+1,\ 0&=;;;0-1+1.end{aligned}$$
So for $n=3;$ there are $7$ ways.
combinatorics
combinatorics
edited Dec 29 '18 at 22:01
user376343
3,8483829
3,8483829
asked Dec 29 '18 at 16:31
Lucio TanziniLucio Tanzini
346114
346114
1
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25
|
show 1 more comment
1
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25
1
1
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25
|
show 1 more comment
2 Answers
2
active
oldest
votes
$begingroup$
$s(n) = sum_{k=0}^{n/2} binom{n}{n-2k} cdot binom{2k}{k}$ The first term is the number of ways to arrange the zeroes, and then the second term arranges the parities. Now, we can simplify further:
$s(n) = sum_{k=0}^{n/2} frac{2k!}{2k!} cdot frac{n!}{(n-2k)!(k!)(k!)} = sum_{k=0}^{n/2} frac{n!}{(n-2k)!(k!)(k!)}$
Edit: put a few values into the OIES and came across trinomial coeffecients. In particular, s(n) is the n-th central trinomial coefficient, which has several closed forms, which you can find in the second link.
$endgroup$
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
add a comment |
$begingroup$
The number of $0s, 1s$ and $-1s$ possible for a particular $n$ can be seen by the number of solutions to:
$$2p+q=n| p,q in Bbb Z^+$$
This can be done in $frac{n+1}{2}$ ways for odd $n$ and $frac{n+2}{2}$ ways for even $n$
You'll just need to account for positioning after this.
$endgroup$
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3056013%2fin-how-many-ways-can-i-write-0-as-a-sum-of-n-0s-1s-textand-1s%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
$s(n) = sum_{k=0}^{n/2} binom{n}{n-2k} cdot binom{2k}{k}$ The first term is the number of ways to arrange the zeroes, and then the second term arranges the parities. Now, we can simplify further:
$s(n) = sum_{k=0}^{n/2} frac{2k!}{2k!} cdot frac{n!}{(n-2k)!(k!)(k!)} = sum_{k=0}^{n/2} frac{n!}{(n-2k)!(k!)(k!)}$
Edit: put a few values into the OIES and came across trinomial coeffecients. In particular, s(n) is the n-th central trinomial coefficient, which has several closed forms, which you can find in the second link.
$endgroup$
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
add a comment |
$begingroup$
$s(n) = sum_{k=0}^{n/2} binom{n}{n-2k} cdot binom{2k}{k}$ The first term is the number of ways to arrange the zeroes, and then the second term arranges the parities. Now, we can simplify further:
$s(n) = sum_{k=0}^{n/2} frac{2k!}{2k!} cdot frac{n!}{(n-2k)!(k!)(k!)} = sum_{k=0}^{n/2} frac{n!}{(n-2k)!(k!)(k!)}$
Edit: put a few values into the OIES and came across trinomial coeffecients. In particular, s(n) is the n-th central trinomial coefficient, which has several closed forms, which you can find in the second link.
$endgroup$
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
add a comment |
$begingroup$
$s(n) = sum_{k=0}^{n/2} binom{n}{n-2k} cdot binom{2k}{k}$ The first term is the number of ways to arrange the zeroes, and then the second term arranges the parities. Now, we can simplify further:
$s(n) = sum_{k=0}^{n/2} frac{2k!}{2k!} cdot frac{n!}{(n-2k)!(k!)(k!)} = sum_{k=0}^{n/2} frac{n!}{(n-2k)!(k!)(k!)}$
Edit: put a few values into the OIES and came across trinomial coeffecients. In particular, s(n) is the n-th central trinomial coefficient, which has several closed forms, which you can find in the second link.
$endgroup$
$s(n) = sum_{k=0}^{n/2} binom{n}{n-2k} cdot binom{2k}{k}$ The first term is the number of ways to arrange the zeroes, and then the second term arranges the parities. Now, we can simplify further:
$s(n) = sum_{k=0}^{n/2} frac{2k!}{2k!} cdot frac{n!}{(n-2k)!(k!)(k!)} = sum_{k=0}^{n/2} frac{n!}{(n-2k)!(k!)(k!)}$
Edit: put a few values into the OIES and came across trinomial coeffecients. In particular, s(n) is the n-th central trinomial coefficient, which has several closed forms, which you can find in the second link.
edited Dec 29 '18 at 21:48
answered Dec 29 '18 at 18:53
Zachary HunterZachary Hunter
592111
592111
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
add a comment |
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
This looks wrong to me. There are $k$ $1$'s, $k$ $(-1)$'s and $n-2k$ zeroes, so the denominator should be $(k!)^2(n-2k)!$.
$endgroup$
– timtfj
Dec 29 '18 at 19:07
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Whoops yeah I forgot a term
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:12
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
Yes, I got the same formula. Do you think It can be simplified into a closed formula?
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 19:31
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
@LucioTanzini nothing immediately comes to mind without getting my hands dirty, but I’m thinking on it.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 19:37
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
$begingroup$
Update: found closed form.
$endgroup$
– Zachary Hunter
Dec 29 '18 at 20:43
add a comment |
$begingroup$
The number of $0s, 1s$ and $-1s$ possible for a particular $n$ can be seen by the number of solutions to:
$$2p+q=n| p,q in Bbb Z^+$$
This can be done in $frac{n+1}{2}$ ways for odd $n$ and $frac{n+2}{2}$ ways for even $n$
You'll just need to account for positioning after this.
$endgroup$
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
add a comment |
$begingroup$
The number of $0s, 1s$ and $-1s$ possible for a particular $n$ can be seen by the number of solutions to:
$$2p+q=n| p,q in Bbb Z^+$$
This can be done in $frac{n+1}{2}$ ways for odd $n$ and $frac{n+2}{2}$ ways for even $n$
You'll just need to account for positioning after this.
$endgroup$
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
add a comment |
$begingroup$
The number of $0s, 1s$ and $-1s$ possible for a particular $n$ can be seen by the number of solutions to:
$$2p+q=n| p,q in Bbb Z^+$$
This can be done in $frac{n+1}{2}$ ways for odd $n$ and $frac{n+2}{2}$ ways for even $n$
You'll just need to account for positioning after this.
$endgroup$
The number of $0s, 1s$ and $-1s$ possible for a particular $n$ can be seen by the number of solutions to:
$$2p+q=n| p,q in Bbb Z^+$$
This can be done in $frac{n+1}{2}$ ways for odd $n$ and $frac{n+2}{2}$ ways for even $n$
You'll just need to account for positioning after this.
edited Dec 29 '18 at 17:16
answered Dec 29 '18 at 16:55
Rhys HughesRhys Hughes
6,8601530
6,8601530
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
add a comment |
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
$begingroup$
Yes, but I'm afraid positioning is the main problem Indeed
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 17:34
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3056013%2fin-how-many-ways-can-i-write-0-as-a-sum-of-n-0s-1s-textand-1s%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
$begingroup$
Set up a recurrence perhaps.
$endgroup$
– paw88789
Dec 29 '18 at 16:35
$begingroup$
do you mean n each or a total of n?
$endgroup$
– player100
Dec 29 '18 at 16:45
$begingroup$
Sorry I meant that in total, the number of 0's, 1's and -1's is n
$endgroup$
– Lucio Tanzini
Dec 29 '18 at 16:59
$begingroup$
@MJD Thsnks for pointing out that I'd missed the $n$. I've deleted the answer!
$endgroup$
– timtfj
Dec 29 '18 at 17:11
$begingroup$
I'd start here: for each $n$, we can choose how many times $0$ occurs ,and how many times $1$ occurs. $-1$ then has to match $1$. So if $0$ is used $r$ times and $1$ is used $s$ times, $r=n-2s$.Then for each choice of $r$ and $s$ you've got a defined permutation problem, with $r, s$ and $s$ items..
$endgroup$
– timtfj
Dec 29 '18 at 17:25