tetrahedral number test












1














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










share|cite|improve this question







New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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
    2 hours ago


















1














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










share|cite|improve this question







New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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
    2 hours ago
















1












1








1







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










share|cite|improve this question







New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|cite|improve this question







New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question







New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question






New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









danday74

1264




1264




New contributor




danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






danday74 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 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
    2 hours ago
















  • 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
    2 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
2 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
2 hours ago












3 Answers
3






active

oldest

votes


















3














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$.






share|cite|improve this answer








New contributor




ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    2














    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.






    share|cite|improve this answer





























      0














      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.






      share|cite|improve this answer





















        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.










        draft saved

        draft discarded


















        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









        3














        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$.






        share|cite|improve this answer








        New contributor




        ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.























          3














          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$.






          share|cite|improve this answer








          New contributor




          ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















            3












            3








            3






            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$.






            share|cite|improve this answer








            New contributor




            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            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$.







            share|cite|improve this answer








            New contributor




            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|cite|improve this answer



            share|cite|improve this answer






            New contributor




            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered 2 hours ago









            ItsJustASeriesBro

            1213




            1213




            New contributor




            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            ItsJustASeriesBro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.























                2














                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.






                share|cite|improve this answer


























                  2














                  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.






                  share|cite|improve this answer
























                    2












                    2








                    2






                    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.






                    share|cite|improve this answer












                    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.







                    share|cite|improve this answer












                    share|cite|improve this answer



                    share|cite|improve this answer










                    answered 2 hours ago









                    jmerry

                    1,87229




                    1,87229























                        0














                        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.






                        share|cite|improve this answer


























                          0














                          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.






                          share|cite|improve this answer
























                            0












                            0








                            0






                            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.






                            share|cite|improve this answer












                            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.







                            share|cite|improve this answer












                            share|cite|improve this answer



                            share|cite|improve this answer










                            answered 13 mins ago









                            Claude Leibovici

                            119k1157132




                            119k1157132






















                                danday74 is a new contributor. Be nice, and check out our Code of Conduct.










                                draft saved

                                draft discarded


















                                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.




                                draft saved


                                draft discarded














                                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





















































                                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

                                Eastern Orthodox Church

                                Zagreb

                                Understanding the information contained in the Deep Space Network XML data?