Calculating sum of consecutive powers of a number












11












$begingroup$


Here is my problem, I want to compute the $$sum_{i=0}^n P^i : Pin ℤ_{>1}$$
I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?



Thanks.










share|cite|improve this question









$endgroup$

















    11












    $begingroup$


    Here is my problem, I want to compute the $$sum_{i=0}^n P^i : Pin ℤ_{>1}$$
    I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?



    Thanks.










    share|cite|improve this question









    $endgroup$















      11












      11








      11


      1



      $begingroup$


      Here is my problem, I want to compute the $$sum_{i=0}^n P^i : Pin ℤ_{>1}$$
      I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?



      Thanks.










      share|cite|improve this question









      $endgroup$




      Here is my problem, I want to compute the $$sum_{i=0}^n P^i : Pin ℤ_{>1}$$
      I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?



      Thanks.







      summation exponentiation






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Oct 13 '14 at 14:44









      sasanjsasanj

      58114




      58114






















          4 Answers
          4






          active

          oldest

          votes


















          15












          $begingroup$

          If we call the sum $S_n$, then $$P cdot S_n = P + P^2 + P^3 + cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$



          Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = frac{P^{n+1}-1}{P-1}$$



          This is a partial sum of a geometric series.






          share|cite|improve this answer









          $endgroup$









          • 3




            $begingroup$
            Thank you very much. What a dump I was! Back to elementary mathematics.
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:56










          • $begingroup$
            I am glad I could help
            $endgroup$
            – Joel
            Oct 13 '14 at 14:56



















          3












          $begingroup$

          The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :



          $$sum_{i=0}^n P^i = dfrac{P^{n+1} -1}{P-1}$$



          EDIT : Let's prove this !



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



          You have the result by dividing both sides by $P-1$.






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Thanks for answering that fast. But is there a mathematical proof you can point me to?
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:50



















          0












          $begingroup$

          That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $displaystyle frac{P^{n+1}-1}{P-1}$






          share|cite|improve this answer









          $endgroup$





















            0












            $begingroup$

            We have
            $$begin{array}{l}
            S_n&=1+P+P^2+P^3+cdots+P^n\
            Pcdot S_n&=0+P+P^2+P^3+cdots+P^n+P^{n+1}
            end{array}$$
            Subtracting two above equations gives
            $$
            S_n-Pcdot S_n=1-P^{n+1}
            $$
            divide by $S_n$
            $$
            1-P=dfrac{1-P^{n+1}}{S_n}\
            S_n=dfrac{1-P^{n+1}}{1-P}
            $$






            share|cite|improve this answer











            $endgroup$













            • $begingroup$
              This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
              $endgroup$
              – Ethan Bolker
              Oct 21 '17 at 13:50











            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%2f971761%2fcalculating-sum-of-consecutive-powers-of-a-number%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            15












            $begingroup$

            If we call the sum $S_n$, then $$P cdot S_n = P + P^2 + P^3 + cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$



            Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = frac{P^{n+1}-1}{P-1}$$



            This is a partial sum of a geometric series.






            share|cite|improve this answer









            $endgroup$









            • 3




              $begingroup$
              Thank you very much. What a dump I was! Back to elementary mathematics.
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:56










            • $begingroup$
              I am glad I could help
              $endgroup$
              – Joel
              Oct 13 '14 at 14:56
















            15












            $begingroup$

            If we call the sum $S_n$, then $$P cdot S_n = P + P^2 + P^3 + cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$



            Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = frac{P^{n+1}-1}{P-1}$$



            This is a partial sum of a geometric series.






            share|cite|improve this answer









            $endgroup$









            • 3




              $begingroup$
              Thank you very much. What a dump I was! Back to elementary mathematics.
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:56










            • $begingroup$
              I am glad I could help
              $endgroup$
              – Joel
              Oct 13 '14 at 14:56














            15












            15








            15





            $begingroup$

            If we call the sum $S_n$, then $$P cdot S_n = P + P^2 + P^3 + cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$



            Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = frac{P^{n+1}-1}{P-1}$$



            This is a partial sum of a geometric series.






            share|cite|improve this answer









            $endgroup$



            If we call the sum $S_n$, then $$P cdot S_n = P + P^2 + P^3 + cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$



            Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = frac{P^{n+1}-1}{P-1}$$



            This is a partial sum of a geometric series.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Oct 13 '14 at 14:50









            JoelJoel

            14.3k12240




            14.3k12240








            • 3




              $begingroup$
              Thank you very much. What a dump I was! Back to elementary mathematics.
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:56










            • $begingroup$
              I am glad I could help
              $endgroup$
              – Joel
              Oct 13 '14 at 14:56














            • 3




              $begingroup$
              Thank you very much. What a dump I was! Back to elementary mathematics.
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:56










            • $begingroup$
              I am glad I could help
              $endgroup$
              – Joel
              Oct 13 '14 at 14:56








            3




            3




            $begingroup$
            Thank you very much. What a dump I was! Back to elementary mathematics.
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:56




            $begingroup$
            Thank you very much. What a dump I was! Back to elementary mathematics.
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:56












            $begingroup$
            I am glad I could help
            $endgroup$
            – Joel
            Oct 13 '14 at 14:56




            $begingroup$
            I am glad I could help
            $endgroup$
            – Joel
            Oct 13 '14 at 14:56











            3












            $begingroup$

            The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :



            $$sum_{i=0}^n P^i = dfrac{P^{n+1} -1}{P-1}$$



            EDIT : Let's prove this !



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



            You have the result by dividing both sides by $P-1$.






            share|cite|improve this answer











            $endgroup$













            • $begingroup$
              Thanks for answering that fast. But is there a mathematical proof you can point me to?
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:50
















            3












            $begingroup$

            The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :



            $$sum_{i=0}^n P^i = dfrac{P^{n+1} -1}{P-1}$$



            EDIT : Let's prove this !



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



            You have the result by dividing both sides by $P-1$.






            share|cite|improve this answer











            $endgroup$













            • $begingroup$
              Thanks for answering that fast. But is there a mathematical proof you can point me to?
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:50














            3












            3








            3





            $begingroup$

            The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :



            $$sum_{i=0}^n P^i = dfrac{P^{n+1} -1}{P-1}$$



            EDIT : Let's prove this !



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



            You have the result by dividing both sides by $P-1$.






            share|cite|improve this answer











            $endgroup$



            The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :



            $$sum_{i=0}^n P^i = dfrac{P^{n+1} -1}{P-1}$$



            EDIT : Let's prove this !



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



            You have the result by dividing both sides by $P-1$.







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited Oct 13 '14 at 14:55

























            answered Oct 13 '14 at 14:48









            TraklonTraklon

            2,70711127




            2,70711127












            • $begingroup$
              Thanks for answering that fast. But is there a mathematical proof you can point me to?
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:50


















            • $begingroup$
              Thanks for answering that fast. But is there a mathematical proof you can point me to?
              $endgroup$
              – sasanj
              Oct 13 '14 at 14:50
















            $begingroup$
            Thanks for answering that fast. But is there a mathematical proof you can point me to?
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:50




            $begingroup$
            Thanks for answering that fast. But is there a mathematical proof you can point me to?
            $endgroup$
            – sasanj
            Oct 13 '14 at 14:50











            0












            $begingroup$

            That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $displaystyle frac{P^{n+1}-1}{P-1}$






            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $displaystyle frac{P^{n+1}-1}{P-1}$






              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $displaystyle frac{P^{n+1}-1}{P-1}$






                share|cite|improve this answer









                $endgroup$



                That's a geometric series. There are $n+1$ terms starting from the first term of $P^0 = 1$, and the sum is given by $displaystyle frac{P^{n+1}-1}{P-1}$







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Oct 13 '14 at 14:50









                DeepakDeepak

                16.8k11436




                16.8k11436























                    0












                    $begingroup$

                    We have
                    $$begin{array}{l}
                    S_n&=1+P+P^2+P^3+cdots+P^n\
                    Pcdot S_n&=0+P+P^2+P^3+cdots+P^n+P^{n+1}
                    end{array}$$
                    Subtracting two above equations gives
                    $$
                    S_n-Pcdot S_n=1-P^{n+1}
                    $$
                    divide by $S_n$
                    $$
                    1-P=dfrac{1-P^{n+1}}{S_n}\
                    S_n=dfrac{1-P^{n+1}}{1-P}
                    $$






                    share|cite|improve this answer











                    $endgroup$













                    • $begingroup$
                      This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                      $endgroup$
                      – Ethan Bolker
                      Oct 21 '17 at 13:50
















                    0












                    $begingroup$

                    We have
                    $$begin{array}{l}
                    S_n&=1+P+P^2+P^3+cdots+P^n\
                    Pcdot S_n&=0+P+P^2+P^3+cdots+P^n+P^{n+1}
                    end{array}$$
                    Subtracting two above equations gives
                    $$
                    S_n-Pcdot S_n=1-P^{n+1}
                    $$
                    divide by $S_n$
                    $$
                    1-P=dfrac{1-P^{n+1}}{S_n}\
                    S_n=dfrac{1-P^{n+1}}{1-P}
                    $$






                    share|cite|improve this answer











                    $endgroup$













                    • $begingroup$
                      This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                      $endgroup$
                      – Ethan Bolker
                      Oct 21 '17 at 13:50














                    0












                    0








                    0





                    $begingroup$

                    We have
                    $$begin{array}{l}
                    S_n&=1+P+P^2+P^3+cdots+P^n\
                    Pcdot S_n&=0+P+P^2+P^3+cdots+P^n+P^{n+1}
                    end{array}$$
                    Subtracting two above equations gives
                    $$
                    S_n-Pcdot S_n=1-P^{n+1}
                    $$
                    divide by $S_n$
                    $$
                    1-P=dfrac{1-P^{n+1}}{S_n}\
                    S_n=dfrac{1-P^{n+1}}{1-P}
                    $$






                    share|cite|improve this answer











                    $endgroup$



                    We have
                    $$begin{array}{l}
                    S_n&=1+P+P^2+P^3+cdots+P^n\
                    Pcdot S_n&=0+P+P^2+P^3+cdots+P^n+P^{n+1}
                    end{array}$$
                    Subtracting two above equations gives
                    $$
                    S_n-Pcdot S_n=1-P^{n+1}
                    $$
                    divide by $S_n$
                    $$
                    1-P=dfrac{1-P^{n+1}}{S_n}\
                    S_n=dfrac{1-P^{n+1}}{1-P}
                    $$







                    share|cite|improve this answer














                    share|cite|improve this answer



                    share|cite|improve this answer








                    edited Oct 21 '17 at 13:46

























                    answered Oct 21 '17 at 13:39









                    BrightBright

                    200111




                    200111












                    • $begingroup$
                      This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                      $endgroup$
                      – Ethan Bolker
                      Oct 21 '17 at 13:50


















                    • $begingroup$
                      This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                      $endgroup$
                      – Ethan Bolker
                      Oct 21 '17 at 13:50
















                    $begingroup$
                    This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                    $endgroup$
                    – Ethan Bolker
                    Oct 21 '17 at 13:50




                    $begingroup$
                    This is of course correct. But it's a duplicate of the three other good answers to this three year old question. You're an experienced user of the site, asking questions and accepting answers. Why not spend your answering time on new questions?
                    $endgroup$
                    – Ethan Bolker
                    Oct 21 '17 at 13:50


















                    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%2f971761%2fcalculating-sum-of-consecutive-powers-of-a-number%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

                    MongoDB - Not Authorized To Execute Command

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                    Npm cannot find a required file even through it is in the searched directory