sequence that adds its previous results












0














Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3cdot 0.3)$.
The third number is the second number + $(0.3cdot 0.3cdot 0.3)$.



This is a recursive formula:



$a_1 = 0.3$
$a_{n+1} = a_n + 0.3^{n-1}$



Is it possible to write this equation without recursion?

I want to write a programming function in JavaScript that encodes this without using recursion if possible.










share|cite|improve this question









New contributor




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




















  • $0.428571, -0.428571 times 0.3^n$
    – David G. Stork
    Jan 4 at 18:49








  • 1




    Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
    – Henning Makholm
    Jan 4 at 18:50










  • Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
    – Aditya Dua
    Jan 4 at 19:18










  • Google geometric series.
    – fleablood
    Jan 4 at 19:57
















0














Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3cdot 0.3)$.
The third number is the second number + $(0.3cdot 0.3cdot 0.3)$.



This is a recursive formula:



$a_1 = 0.3$
$a_{n+1} = a_n + 0.3^{n-1}$



Is it possible to write this equation without recursion?

I want to write a programming function in JavaScript that encodes this without using recursion if possible.










share|cite|improve this question









New contributor




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




















  • $0.428571, -0.428571 times 0.3^n$
    – David G. Stork
    Jan 4 at 18:49








  • 1




    Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
    – Henning Makholm
    Jan 4 at 18:50










  • Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
    – Aditya Dua
    Jan 4 at 19:18










  • Google geometric series.
    – fleablood
    Jan 4 at 19:57














0












0








0







Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3cdot 0.3)$.
The third number is the second number + $(0.3cdot 0.3cdot 0.3)$.



This is a recursive formula:



$a_1 = 0.3$
$a_{n+1} = a_n + 0.3^{n-1}$



Is it possible to write this equation without recursion?

I want to write a programming function in JavaScript that encodes this without using recursion if possible.










share|cite|improve this question









New contributor




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











Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3cdot 0.3)$.
The third number is the second number + $(0.3cdot 0.3cdot 0.3)$.



This is a recursive formula:



$a_1 = 0.3$
$a_{n+1} = a_n + 0.3^{n-1}$



Is it possible to write this equation without recursion?

I want to write a programming function in JavaScript that encodes this without using recursion if possible.







sequences-and-series recursion computability recursive-algorithms






share|cite|improve this question









New contributor




penfold1992 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




penfold1992 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








edited Jan 4 at 18:51









amWhy

192k28225439




192k28225439






New contributor




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









asked Jan 4 at 18:41









penfold1992penfold1992

1




1




New contributor




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





New contributor





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






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












  • $0.428571, -0.428571 times 0.3^n$
    – David G. Stork
    Jan 4 at 18:49








  • 1




    Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
    – Henning Makholm
    Jan 4 at 18:50










  • Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
    – Aditya Dua
    Jan 4 at 19:18










  • Google geometric series.
    – fleablood
    Jan 4 at 19:57


















  • $0.428571, -0.428571 times 0.3^n$
    – David G. Stork
    Jan 4 at 18:49








  • 1




    Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
    – Henning Makholm
    Jan 4 at 18:50










  • Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
    – Aditya Dua
    Jan 4 at 19:18










  • Google geometric series.
    – fleablood
    Jan 4 at 19:57
















$0.428571, -0.428571 times 0.3^n$
– David G. Stork
Jan 4 at 18:49






$0.428571, -0.428571 times 0.3^n$
– David G. Stork
Jan 4 at 18:49






1




1




Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
– Henning Makholm
Jan 4 at 18:50




Is the second of your recursion equations supposed to be $a_{n+1}=a_n + 0.3^{n-1}$ or $a_{n+1}=a_n + 0.3^{n+1}$? The latter would match better with your $a_1$.
– Henning Makholm
Jan 4 at 18:50












Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
– Aditya Dua
Jan 4 at 19:18




Slight discrepancy in your text and your recursive equation. I have posted an answer based on your recursion, which can be easily modified to match your text if needed.
– Aditya Dua
Jan 4 at 19:18












Google geometric series.
– fleablood
Jan 4 at 19:57




Google geometric series.
– fleablood
Jan 4 at 19:57










3 Answers
3






active

oldest

votes


















2














Your sequence seems to be $a_n = x + x^2 + x^3 + ..... + x^n$



$= (1 + x + x^2 + x^3 + ...... + x^n) - 1$



$= frac {1-x^{n+1}}{1-x}-1$



$=frac {1-.3^{n+1}}{.7} - 1$



Google geometric series



Or maybe more straightforward:



$a_n = x + x^2 + ...... + x^n =$



$x(1 + ..... + x^{n-1}) =$



$x frac {1-x^n}{1-x} = frac {x - x^{n+1}}{1-x}=$



$frac {.3-.3^{n+1}}{.7}$



Which can be what $frac {1 - .3^{n+1}}{.7} -1 = frac {1 - .3^{n+1}}{.7} -frac {.7}{.7} = frac {.3-.3^{n+1}}{.7}$ is also equal to.



You can also express it as $frac {3 - 10*(.3)^{n+1}}{7}$






share|cite|improve this answer































    0














    You can write:



    $a_{n+1} = a_n + 0.3^{n-1}$



    $= a_{n-1} + 0.3^{n-2} + 0.3^{n-1}$



    $ = a_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$



    $ ... $



    $ = a_1 + sum_{k=1}^n 0.3^{n-k+1}$



    $ = a_1 + sum_{k=1}^n 0.3^k$



    $ = a_1 + frac{3}{7}(1-0.3^n)$



    $ = 0.3 + frac{3}{7}(1-0.3^n)$



    $ = 0.7286 - 0.4286 times 0.3^n$






    share|cite|improve this answer





























      0














      If we write $$a_n=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}$$then we have $$a_{n+1}=a_n+(0.3)^{n-1}=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+cdots + (0.3)^{n-2}={1-(0.3)^{n-1}over 1-0.3}$$therefore $$a_n={1-(0.3)^{n-1}over 0.7}$$






      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
        });


        }
        });






        penfold1992 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%2f3061956%2fsequence-that-adds-its-previous-results%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









        2














        Your sequence seems to be $a_n = x + x^2 + x^3 + ..... + x^n$



        $= (1 + x + x^2 + x^3 + ...... + x^n) - 1$



        $= frac {1-x^{n+1}}{1-x}-1$



        $=frac {1-.3^{n+1}}{.7} - 1$



        Google geometric series



        Or maybe more straightforward:



        $a_n = x + x^2 + ...... + x^n =$



        $x(1 + ..... + x^{n-1}) =$



        $x frac {1-x^n}{1-x} = frac {x - x^{n+1}}{1-x}=$



        $frac {.3-.3^{n+1}}{.7}$



        Which can be what $frac {1 - .3^{n+1}}{.7} -1 = frac {1 - .3^{n+1}}{.7} -frac {.7}{.7} = frac {.3-.3^{n+1}}{.7}$ is also equal to.



        You can also express it as $frac {3 - 10*(.3)^{n+1}}{7}$






        share|cite|improve this answer




























          2














          Your sequence seems to be $a_n = x + x^2 + x^3 + ..... + x^n$



          $= (1 + x + x^2 + x^3 + ...... + x^n) - 1$



          $= frac {1-x^{n+1}}{1-x}-1$



          $=frac {1-.3^{n+1}}{.7} - 1$



          Google geometric series



          Or maybe more straightforward:



          $a_n = x + x^2 + ...... + x^n =$



          $x(1 + ..... + x^{n-1}) =$



          $x frac {1-x^n}{1-x} = frac {x - x^{n+1}}{1-x}=$



          $frac {.3-.3^{n+1}}{.7}$



          Which can be what $frac {1 - .3^{n+1}}{.7} -1 = frac {1 - .3^{n+1}}{.7} -frac {.7}{.7} = frac {.3-.3^{n+1}}{.7}$ is also equal to.



          You can also express it as $frac {3 - 10*(.3)^{n+1}}{7}$






          share|cite|improve this answer


























            2












            2








            2






            Your sequence seems to be $a_n = x + x^2 + x^3 + ..... + x^n$



            $= (1 + x + x^2 + x^3 + ...... + x^n) - 1$



            $= frac {1-x^{n+1}}{1-x}-1$



            $=frac {1-.3^{n+1}}{.7} - 1$



            Google geometric series



            Or maybe more straightforward:



            $a_n = x + x^2 + ...... + x^n =$



            $x(1 + ..... + x^{n-1}) =$



            $x frac {1-x^n}{1-x} = frac {x - x^{n+1}}{1-x}=$



            $frac {.3-.3^{n+1}}{.7}$



            Which can be what $frac {1 - .3^{n+1}}{.7} -1 = frac {1 - .3^{n+1}}{.7} -frac {.7}{.7} = frac {.3-.3^{n+1}}{.7}$ is also equal to.



            You can also express it as $frac {3 - 10*(.3)^{n+1}}{7}$






            share|cite|improve this answer














            Your sequence seems to be $a_n = x + x^2 + x^3 + ..... + x^n$



            $= (1 + x + x^2 + x^3 + ...... + x^n) - 1$



            $= frac {1-x^{n+1}}{1-x}-1$



            $=frac {1-.3^{n+1}}{.7} - 1$



            Google geometric series



            Or maybe more straightforward:



            $a_n = x + x^2 + ...... + x^n =$



            $x(1 + ..... + x^{n-1}) =$



            $x frac {1-x^n}{1-x} = frac {x - x^{n+1}}{1-x}=$



            $frac {.3-.3^{n+1}}{.7}$



            Which can be what $frac {1 - .3^{n+1}}{.7} -1 = frac {1 - .3^{n+1}}{.7} -frac {.7}{.7} = frac {.3-.3^{n+1}}{.7}$ is also equal to.



            You can also express it as $frac {3 - 10*(.3)^{n+1}}{7}$







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited Jan 4 at 20:06

























            answered Jan 4 at 19:58









            fleabloodfleablood

            68.7k22685




            68.7k22685























                0














                You can write:



                $a_{n+1} = a_n + 0.3^{n-1}$



                $= a_{n-1} + 0.3^{n-2} + 0.3^{n-1}$



                $ = a_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$



                $ ... $



                $ = a_1 + sum_{k=1}^n 0.3^{n-k+1}$



                $ = a_1 + sum_{k=1}^n 0.3^k$



                $ = a_1 + frac{3}{7}(1-0.3^n)$



                $ = 0.3 + frac{3}{7}(1-0.3^n)$



                $ = 0.7286 - 0.4286 times 0.3^n$






                share|cite|improve this answer


























                  0














                  You can write:



                  $a_{n+1} = a_n + 0.3^{n-1}$



                  $= a_{n-1} + 0.3^{n-2} + 0.3^{n-1}$



                  $ = a_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$



                  $ ... $



                  $ = a_1 + sum_{k=1}^n 0.3^{n-k+1}$



                  $ = a_1 + sum_{k=1}^n 0.3^k$



                  $ = a_1 + frac{3}{7}(1-0.3^n)$



                  $ = 0.3 + frac{3}{7}(1-0.3^n)$



                  $ = 0.7286 - 0.4286 times 0.3^n$






                  share|cite|improve this answer
























                    0












                    0








                    0






                    You can write:



                    $a_{n+1} = a_n + 0.3^{n-1}$



                    $= a_{n-1} + 0.3^{n-2} + 0.3^{n-1}$



                    $ = a_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$



                    $ ... $



                    $ = a_1 + sum_{k=1}^n 0.3^{n-k+1}$



                    $ = a_1 + sum_{k=1}^n 0.3^k$



                    $ = a_1 + frac{3}{7}(1-0.3^n)$



                    $ = 0.3 + frac{3}{7}(1-0.3^n)$



                    $ = 0.7286 - 0.4286 times 0.3^n$






                    share|cite|improve this answer












                    You can write:



                    $a_{n+1} = a_n + 0.3^{n-1}$



                    $= a_{n-1} + 0.3^{n-2} + 0.3^{n-1}$



                    $ = a_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$



                    $ ... $



                    $ = a_1 + sum_{k=1}^n 0.3^{n-k+1}$



                    $ = a_1 + sum_{k=1}^n 0.3^k$



                    $ = a_1 + frac{3}{7}(1-0.3^n)$



                    $ = 0.3 + frac{3}{7}(1-0.3^n)$



                    $ = 0.7286 - 0.4286 times 0.3^n$







                    share|cite|improve this answer












                    share|cite|improve this answer



                    share|cite|improve this answer










                    answered Jan 4 at 19:17









                    Aditya DuaAditya Dua

                    90418




                    90418























                        0














                        If we write $$a_n=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}$$then we have $$a_{n+1}=a_n+(0.3)^{n-1}=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+cdots + (0.3)^{n-2}={1-(0.3)^{n-1}over 1-0.3}$$therefore $$a_n={1-(0.3)^{n-1}over 0.7}$$






                        share|cite|improve this answer


























                          0














                          If we write $$a_n=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}$$then we have $$a_{n+1}=a_n+(0.3)^{n-1}=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+cdots + (0.3)^{n-2}={1-(0.3)^{n-1}over 1-0.3}$$therefore $$a_n={1-(0.3)^{n-1}over 0.7}$$






                          share|cite|improve this answer
























                            0












                            0








                            0






                            If we write $$a_n=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}$$then we have $$a_{n+1}=a_n+(0.3)^{n-1}=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+cdots + (0.3)^{n-2}={1-(0.3)^{n-1}over 1-0.3}$$therefore $$a_n={1-(0.3)^{n-1}over 0.7}$$






                            share|cite|improve this answer












                            If we write $$a_n=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}$$then we have $$a_{n+1}=a_n+(0.3)^{n-1}=1+0.3+(0.3)^2+cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+cdots + (0.3)^{n-2}={1-(0.3)^{n-1}over 1-0.3}$$therefore $$a_n={1-(0.3)^{n-1}over 0.7}$$







                            share|cite|improve this answer












                            share|cite|improve this answer



                            share|cite|improve this answer










                            answered Jan 5 at 6:40









                            Mostafa AyazMostafa Ayaz

                            14.5k3937




                            14.5k3937






















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










                                draft saved

                                draft discarded


















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













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












                                penfold1992 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%2f3061956%2fsequence-that-adds-its-previous-results%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

                                1300-talet

                                1300-talet

                                Display a custom attribute below product name in the front-end Magento 1.9.3.8