tetrahedral number test
Tetrahedral numbers (https://oeis.org/A000292) are:
1, 4, 10, 20, 35, 56, 84, etc
WHERE Tetrahedral(n) = (n * (n+1) * (n+2)) / 6
But what is the test for whether a given number is a tetrahedral number?
I also need to know, if it is a tetrahedral number, then which term in the tetrahedral sequence is it? I am looking for a formula or something that would enable me to get these results:
input result ("is tetrahedral")
1 1
2 false
3 false
4 2
5 false
6 false
7 false
8 false
9 false
10 3
11 false
12 false
I can't find any formula on the Internet for this. Any pointers in the right direction would be great - thx
sequences-and-series
New contributor
add a comment |
Tetrahedral numbers (https://oeis.org/A000292) are:
1, 4, 10, 20, 35, 56, 84, etc
WHERE Tetrahedral(n) = (n * (n+1) * (n+2)) / 6
But what is the test for whether a given number is a tetrahedral number?
I also need to know, if it is a tetrahedral number, then which term in the tetrahedral sequence is it? I am looking for a formula or something that would enable me to get these results:
input result ("is tetrahedral")
1 1
2 false
3 false
4 2
5 false
6 false
7 false
8 false
9 false
10 3
11 false
12 false
I can't find any formula on the Internet for this. Any pointers in the right direction would be great - thx
sequences-and-series
New contributor
1
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago
add a comment |
Tetrahedral numbers (https://oeis.org/A000292) are:
1, 4, 10, 20, 35, 56, 84, etc
WHERE Tetrahedral(n) = (n * (n+1) * (n+2)) / 6
But what is the test for whether a given number is a tetrahedral number?
I also need to know, if it is a tetrahedral number, then which term in the tetrahedral sequence is it? I am looking for a formula or something that would enable me to get these results:
input result ("is tetrahedral")
1 1
2 false
3 false
4 2
5 false
6 false
7 false
8 false
9 false
10 3
11 false
12 false
I can't find any formula on the Internet for this. Any pointers in the right direction would be great - thx
sequences-and-series
New contributor
Tetrahedral numbers (https://oeis.org/A000292) are:
1, 4, 10, 20, 35, 56, 84, etc
WHERE Tetrahedral(n) = (n * (n+1) * (n+2)) / 6
But what is the test for whether a given number is a tetrahedral number?
I also need to know, if it is a tetrahedral number, then which term in the tetrahedral sequence is it? I am looking for a formula or something that would enable me to get these results:
input result ("is tetrahedral")
1 1
2 false
3 false
4 2
5 false
6 false
7 false
8 false
9 false
10 3
11 false
12 false
I can't find any formula on the Internet for this. Any pointers in the right direction would be great - thx
sequences-and-series
sequences-and-series
New contributor
New contributor
New contributor
asked 3 hours ago
danday74
1264
1264
New contributor
New contributor
1
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago
add a comment |
1
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago
1
1
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago
add a comment |
3 Answers
3
active
oldest
votes
Notice that $n(n+1)(n+2)/6approx n^3/6$ for large values of $n$. Thus, if you have a suspected tetrahedral number $k$, and you compute $n_0=lfloorsqrt[3]{6k}rfloor$ you will have a pretty good guess as to which index you need to check to confirm or refute your suspicions.
This of course won't work for small $k$, and your initial guess $n_0$ need not be correct, but you have at least vastly reduced the number of operations you need to finish your problem. The full algorithm now would look something like this:
1) Take the input number $k$ and compute $n_0=lfloorsqrt[3]{6k}rfloor$.
2) If $text{Tetra}(n_0)>k$, begin testing all naturals $n<n_0$ (in decreasing order) until $text{Tetra}(n)leq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
3) If $text{Tetra}(n_0)<k$, begin testing all naturals $n>n_0$ until $text{Tetra}(n)geq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
4) If $text{Tetra}(n_0)=k$, then you are done, and the index is $n_0$.
New contributor
add a comment |
Another way to look at that: $frac{n(n+1)(n+2)}{6}=frac{(n+1)^3-(n+1)}{6}$.
So then, if we have some $m$ we want to test? Multiply it by $6$. Add its cube root, rounded up - $k^3-k > (k-1)^3$ for all $k > 1$. If we get a perfect cube ($6m+lceilsqrt[3]{6m}rceil=k^3$ for some integer $k$), it's a tetrahedral number (Specifically, for $n=k-1$). If not, it isn't.
add a comment |
For a given $k$, you want to know if it exists an integer $n$ such that
$$frac{n(n+1)(n+2)}{6}=k$$ A simple way is to look at the cubic equation
$$n^3+3n^2+2n-6k=0$$ which has only one real root. Using the hyperbolic solution for this case, the solution is given by
$$n=-1+frac{2 }{sqrt{3}}cosh left(frac{1}{3} cosh ^{-1}left(9 sqrt{3},
kright)right)$$ If this $n$ is an integer (or very very close to because of possible rounding errors), then you are done.
If you prefer "simpler" analytical formulae, you also have
$$n=-1+t_1+t_2$$ where
$$t_1^3=frac{1}{3 left(sqrt{3} sqrt{243 k^2-1}+27 kright)}qquad text{and} qquad t_2^3=frac{1}{9} left(sqrt{3} sqrt{243 k^2-1}+27 kright)$$
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
});
}
});
danday74 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f3060249%2ftetrahedral-number-test%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Notice that $n(n+1)(n+2)/6approx n^3/6$ for large values of $n$. Thus, if you have a suspected tetrahedral number $k$, and you compute $n_0=lfloorsqrt[3]{6k}rfloor$ you will have a pretty good guess as to which index you need to check to confirm or refute your suspicions.
This of course won't work for small $k$, and your initial guess $n_0$ need not be correct, but you have at least vastly reduced the number of operations you need to finish your problem. The full algorithm now would look something like this:
1) Take the input number $k$ and compute $n_0=lfloorsqrt[3]{6k}rfloor$.
2) If $text{Tetra}(n_0)>k$, begin testing all naturals $n<n_0$ (in decreasing order) until $text{Tetra}(n)leq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
3) If $text{Tetra}(n_0)<k$, begin testing all naturals $n>n_0$ until $text{Tetra}(n)geq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
4) If $text{Tetra}(n_0)=k$, then you are done, and the index is $n_0$.
New contributor
add a comment |
Notice that $n(n+1)(n+2)/6approx n^3/6$ for large values of $n$. Thus, if you have a suspected tetrahedral number $k$, and you compute $n_0=lfloorsqrt[3]{6k}rfloor$ you will have a pretty good guess as to which index you need to check to confirm or refute your suspicions.
This of course won't work for small $k$, and your initial guess $n_0$ need not be correct, but you have at least vastly reduced the number of operations you need to finish your problem. The full algorithm now would look something like this:
1) Take the input number $k$ and compute $n_0=lfloorsqrt[3]{6k}rfloor$.
2) If $text{Tetra}(n_0)>k$, begin testing all naturals $n<n_0$ (in decreasing order) until $text{Tetra}(n)leq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
3) If $text{Tetra}(n_0)<k$, begin testing all naturals $n>n_0$ until $text{Tetra}(n)geq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
4) If $text{Tetra}(n_0)=k$, then you are done, and the index is $n_0$.
New contributor
add a comment |
Notice that $n(n+1)(n+2)/6approx n^3/6$ for large values of $n$. Thus, if you have a suspected tetrahedral number $k$, and you compute $n_0=lfloorsqrt[3]{6k}rfloor$ you will have a pretty good guess as to which index you need to check to confirm or refute your suspicions.
This of course won't work for small $k$, and your initial guess $n_0$ need not be correct, but you have at least vastly reduced the number of operations you need to finish your problem. The full algorithm now would look something like this:
1) Take the input number $k$ and compute $n_0=lfloorsqrt[3]{6k}rfloor$.
2) If $text{Tetra}(n_0)>k$, begin testing all naturals $n<n_0$ (in decreasing order) until $text{Tetra}(n)leq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
3) If $text{Tetra}(n_0)<k$, begin testing all naturals $n>n_0$ until $text{Tetra}(n)geq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
4) If $text{Tetra}(n_0)=k$, then you are done, and the index is $n_0$.
New contributor
Notice that $n(n+1)(n+2)/6approx n^3/6$ for large values of $n$. Thus, if you have a suspected tetrahedral number $k$, and you compute $n_0=lfloorsqrt[3]{6k}rfloor$ you will have a pretty good guess as to which index you need to check to confirm or refute your suspicions.
This of course won't work for small $k$, and your initial guess $n_0$ need not be correct, but you have at least vastly reduced the number of operations you need to finish your problem. The full algorithm now would look something like this:
1) Take the input number $k$ and compute $n_0=lfloorsqrt[3]{6k}rfloor$.
2) If $text{Tetra}(n_0)>k$, begin testing all naturals $n<n_0$ (in decreasing order) until $text{Tetra}(n)leq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
3) If $text{Tetra}(n_0)<k$, begin testing all naturals $n>n_0$ until $text{Tetra}(n)geq k$. If you achieve equality, then $k$ is tetrahedral with index $n$. If you don't have equality, then $k$ is not tetrahedral.
4) If $text{Tetra}(n_0)=k$, then you are done, and the index is $n_0$.
New contributor
New contributor
answered 3 hours ago
ItsJustASeriesBro
1413
1413
New contributor
New contributor
add a comment |
add a comment |
Another way to look at that: $frac{n(n+1)(n+2)}{6}=frac{(n+1)^3-(n+1)}{6}$.
So then, if we have some $m$ we want to test? Multiply it by $6$. Add its cube root, rounded up - $k^3-k > (k-1)^3$ for all $k > 1$. If we get a perfect cube ($6m+lceilsqrt[3]{6m}rceil=k^3$ for some integer $k$), it's a tetrahedral number (Specifically, for $n=k-1$). If not, it isn't.
add a comment |
Another way to look at that: $frac{n(n+1)(n+2)}{6}=frac{(n+1)^3-(n+1)}{6}$.
So then, if we have some $m$ we want to test? Multiply it by $6$. Add its cube root, rounded up - $k^3-k > (k-1)^3$ for all $k > 1$. If we get a perfect cube ($6m+lceilsqrt[3]{6m}rceil=k^3$ for some integer $k$), it's a tetrahedral number (Specifically, for $n=k-1$). If not, it isn't.
add a comment |
Another way to look at that: $frac{n(n+1)(n+2)}{6}=frac{(n+1)^3-(n+1)}{6}$.
So then, if we have some $m$ we want to test? Multiply it by $6$. Add its cube root, rounded up - $k^3-k > (k-1)^3$ for all $k > 1$. If we get a perfect cube ($6m+lceilsqrt[3]{6m}rceil=k^3$ for some integer $k$), it's a tetrahedral number (Specifically, for $n=k-1$). If not, it isn't.
Another way to look at that: $frac{n(n+1)(n+2)}{6}=frac{(n+1)^3-(n+1)}{6}$.
So then, if we have some $m$ we want to test? Multiply it by $6$. Add its cube root, rounded up - $k^3-k > (k-1)^3$ for all $k > 1$. If we get a perfect cube ($6m+lceilsqrt[3]{6m}rceil=k^3$ for some integer $k$), it's a tetrahedral number (Specifically, for $n=k-1$). If not, it isn't.
answered 3 hours ago
jmerry
1,87229
1,87229
add a comment |
add a comment |
For a given $k$, you want to know if it exists an integer $n$ such that
$$frac{n(n+1)(n+2)}{6}=k$$ A simple way is to look at the cubic equation
$$n^3+3n^2+2n-6k=0$$ which has only one real root. Using the hyperbolic solution for this case, the solution is given by
$$n=-1+frac{2 }{sqrt{3}}cosh left(frac{1}{3} cosh ^{-1}left(9 sqrt{3},
kright)right)$$ If this $n$ is an integer (or very very close to because of possible rounding errors), then you are done.
If you prefer "simpler" analytical formulae, you also have
$$n=-1+t_1+t_2$$ where
$$t_1^3=frac{1}{3 left(sqrt{3} sqrt{243 k^2-1}+27 kright)}qquad text{and} qquad t_2^3=frac{1}{9} left(sqrt{3} sqrt{243 k^2-1}+27 kright)$$
add a comment |
For a given $k$, you want to know if it exists an integer $n$ such that
$$frac{n(n+1)(n+2)}{6}=k$$ A simple way is to look at the cubic equation
$$n^3+3n^2+2n-6k=0$$ which has only one real root. Using the hyperbolic solution for this case, the solution is given by
$$n=-1+frac{2 }{sqrt{3}}cosh left(frac{1}{3} cosh ^{-1}left(9 sqrt{3},
kright)right)$$ If this $n$ is an integer (or very very close to because of possible rounding errors), then you are done.
If you prefer "simpler" analytical formulae, you also have
$$n=-1+t_1+t_2$$ where
$$t_1^3=frac{1}{3 left(sqrt{3} sqrt{243 k^2-1}+27 kright)}qquad text{and} qquad t_2^3=frac{1}{9} left(sqrt{3} sqrt{243 k^2-1}+27 kright)$$
add a comment |
For a given $k$, you want to know if it exists an integer $n$ such that
$$frac{n(n+1)(n+2)}{6}=k$$ A simple way is to look at the cubic equation
$$n^3+3n^2+2n-6k=0$$ which has only one real root. Using the hyperbolic solution for this case, the solution is given by
$$n=-1+frac{2 }{sqrt{3}}cosh left(frac{1}{3} cosh ^{-1}left(9 sqrt{3},
kright)right)$$ If this $n$ is an integer (or very very close to because of possible rounding errors), then you are done.
If you prefer "simpler" analytical formulae, you also have
$$n=-1+t_1+t_2$$ where
$$t_1^3=frac{1}{3 left(sqrt{3} sqrt{243 k^2-1}+27 kright)}qquad text{and} qquad t_2^3=frac{1}{9} left(sqrt{3} sqrt{243 k^2-1}+27 kright)$$
For a given $k$, you want to know if it exists an integer $n$ such that
$$frac{n(n+1)(n+2)}{6}=k$$ A simple way is to look at the cubic equation
$$n^3+3n^2+2n-6k=0$$ which has only one real root. Using the hyperbolic solution for this case, the solution is given by
$$n=-1+frac{2 }{sqrt{3}}cosh left(frac{1}{3} cosh ^{-1}left(9 sqrt{3},
kright)right)$$ If this $n$ is an integer (or very very close to because of possible rounding errors), then you are done.
If you prefer "simpler" analytical formulae, you also have
$$n=-1+t_1+t_2$$ where
$$t_1^3=frac{1}{3 left(sqrt{3} sqrt{243 k^2-1}+27 kright)}qquad text{and} qquad t_2^3=frac{1}{9} left(sqrt{3} sqrt{243 k^2-1}+27 kright)$$
edited 13 mins ago
answered 55 mins ago
Claude Leibovici
119k1157132
119k1157132
add a comment |
add a comment |
danday74 is a new contributor. Be nice, and check out our Code of Conduct.
danday74 is a new contributor. Be nice, and check out our Code of Conduct.
danday74 is a new contributor. Be nice, and check out our Code of Conduct.
danday74 is a new contributor. Be nice, and check out our Code of Conduct.
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
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%2f3060249%2ftetrahedral-number-test%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
Hi & welcome to MSE. You could assume your number to test is a constant & $n$ is a variable, plug it into the equation for a tetrahedron # and solve for $n$ from the resulting $3$rd degree (i.e., cubic) polynomial.
– John Omielan
3 hours ago