Number of compositions of a positive number n, with factors between 1 and a certain number m












2












$begingroup$


I'm trying to find the number of compositions of a positive number $n$, with factors between 1 and a certain number $m$.
That is, all the combinations of limited numbers that add up to $n$



$f(n, m)$



For example:



$f(3, 2) = |(1+1+1), (1+2), (2+1)| = 3$



$f(3, 3) = |(1+1+1), (1+2), (2+1), (3)| = 4$



$f(5, 3) = |(1+1+1+1+1), .... , (3+2), (2+3)| = 13$



Reading online I found this formula for calculating the composition, but it works only in some special cases:
$sum_{k = lceil n/m rceil}^{n} binom{n-1}{k - 1}$



Can someone tell me the general formula?










share|cite|improve this question











$endgroup$

















    2












    $begingroup$


    I'm trying to find the number of compositions of a positive number $n$, with factors between 1 and a certain number $m$.
    That is, all the combinations of limited numbers that add up to $n$



    $f(n, m)$



    For example:



    $f(3, 2) = |(1+1+1), (1+2), (2+1)| = 3$



    $f(3, 3) = |(1+1+1), (1+2), (2+1), (3)| = 4$



    $f(5, 3) = |(1+1+1+1+1), .... , (3+2), (2+3)| = 13$



    Reading online I found this formula for calculating the composition, but it works only in some special cases:
    $sum_{k = lceil n/m rceil}^{n} binom{n-1}{k - 1}$



    Can someone tell me the general formula?










    share|cite|improve this question











    $endgroup$















      2












      2








      2


      1



      $begingroup$


      I'm trying to find the number of compositions of a positive number $n$, with factors between 1 and a certain number $m$.
      That is, all the combinations of limited numbers that add up to $n$



      $f(n, m)$



      For example:



      $f(3, 2) = |(1+1+1), (1+2), (2+1)| = 3$



      $f(3, 3) = |(1+1+1), (1+2), (2+1), (3)| = 4$



      $f(5, 3) = |(1+1+1+1+1), .... , (3+2), (2+3)| = 13$



      Reading online I found this formula for calculating the composition, but it works only in some special cases:
      $sum_{k = lceil n/m rceil}^{n} binom{n-1}{k - 1}$



      Can someone tell me the general formula?










      share|cite|improve this question











      $endgroup$




      I'm trying to find the number of compositions of a positive number $n$, with factors between 1 and a certain number $m$.
      That is, all the combinations of limited numbers that add up to $n$



      $f(n, m)$



      For example:



      $f(3, 2) = |(1+1+1), (1+2), (2+1)| = 3$



      $f(3, 3) = |(1+1+1), (1+2), (2+1), (3)| = 4$



      $f(5, 3) = |(1+1+1+1+1), .... , (3+2), (2+3)| = 13$



      Reading online I found this formula for calculating the composition, but it works only in some special cases:
      $sum_{k = lceil n/m rceil}^{n} binom{n-1}{k - 1}$



      Can someone tell me the general formula?







      combinatorics






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 16 '18 at 8:29









      Sik Feng Cheong

      1579




      1579










      asked Dec 16 '18 at 8:07









      Gabriele PiccoGabriele Picco

      327




      327






















          2 Answers
          2






          active

          oldest

          votes


















          2












          $begingroup$

          There is no general formula. In order to compute $f(n,m)$ quickly, you can write the recurrence relation as a matrix equation. Let $x_n$ be the vector
          $$
          x_n=begin{bmatrix}f(n,m)\f(n-1,m)\f(n-2,m)\vdots\f(n-m+1,m)end{bmatrix}
          $$

          and let $A$ be the $mtimes m$ matrix which has ones just below the diagonal, ones on the top row, and zeroes everywhere else. When $m=4,$
          $$
          A=begin{bmatrix} 1 & 1 & 1 & 1\ 1 & 0 & 0 &0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{bmatrix}
          $$



          You can verify that
          $$
          x_n=Ax_{n-1}
          $$

          holds for all $nge 1$. Iterating this, you get
          $$
          x_n=A^nx_0=A^nbegin{bmatrix}1\0\vdots\0end{bmatrix}
          $$

          Therefore, to compute $f(n,m)$ quickly, it suffices to compute $A^n$ quickly, which can be done in $O(m^3log n)$ time using exponentiation by squaring.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
            $endgroup$
            – Gabriele Picco
            Dec 18 '18 at 9:10



















          2












          $begingroup$

          I was able to callculate $f(m,n)$ quickly by using recurrence:



          $$f(n, m)=1quad text{if} quad nin{0,1}$$
          $$f(n, m)=0quad text{if} quad n<0$$
          $$f(n,m)=sum_{k=1}^m f(n-k,m)$$



          ...or in Mathematica:



          f[n_, m_] := 1 /; n == 0 || n == 1

          f[n_, m_] := 0 /; n < 0

          f[n_, m_] := f[n, m] = Sum[f[n - k, m], {k, 1, m}]


          This gives accurate results for all your examples and calculates the number of combinations for bigger values of $n,m$ fairly quickly. For example:



          $$f(5,3)=13$$



          $$f(20,10)=521472$$



          $$f(100,20)=633800819629853453628932292608$$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:04












          • $begingroup$
            I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:12










          • $begingroup$
            @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
            $endgroup$
            – Oldboy
            Dec 16 '18 at 10:15












          • $begingroup$
            Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:27












          • $begingroup$
            if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:28











          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%2f3042357%2fnumber-of-compositions-of-a-positive-number-n-with-factors-between-1-and-a-cert%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2












          $begingroup$

          There is no general formula. In order to compute $f(n,m)$ quickly, you can write the recurrence relation as a matrix equation. Let $x_n$ be the vector
          $$
          x_n=begin{bmatrix}f(n,m)\f(n-1,m)\f(n-2,m)\vdots\f(n-m+1,m)end{bmatrix}
          $$

          and let $A$ be the $mtimes m$ matrix which has ones just below the diagonal, ones on the top row, and zeroes everywhere else. When $m=4,$
          $$
          A=begin{bmatrix} 1 & 1 & 1 & 1\ 1 & 0 & 0 &0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{bmatrix}
          $$



          You can verify that
          $$
          x_n=Ax_{n-1}
          $$

          holds for all $nge 1$. Iterating this, you get
          $$
          x_n=A^nx_0=A^nbegin{bmatrix}1\0\vdots\0end{bmatrix}
          $$

          Therefore, to compute $f(n,m)$ quickly, it suffices to compute $A^n$ quickly, which can be done in $O(m^3log n)$ time using exponentiation by squaring.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
            $endgroup$
            – Gabriele Picco
            Dec 18 '18 at 9:10
















          2












          $begingroup$

          There is no general formula. In order to compute $f(n,m)$ quickly, you can write the recurrence relation as a matrix equation. Let $x_n$ be the vector
          $$
          x_n=begin{bmatrix}f(n,m)\f(n-1,m)\f(n-2,m)\vdots\f(n-m+1,m)end{bmatrix}
          $$

          and let $A$ be the $mtimes m$ matrix which has ones just below the diagonal, ones on the top row, and zeroes everywhere else. When $m=4,$
          $$
          A=begin{bmatrix} 1 & 1 & 1 & 1\ 1 & 0 & 0 &0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{bmatrix}
          $$



          You can verify that
          $$
          x_n=Ax_{n-1}
          $$

          holds for all $nge 1$. Iterating this, you get
          $$
          x_n=A^nx_0=A^nbegin{bmatrix}1\0\vdots\0end{bmatrix}
          $$

          Therefore, to compute $f(n,m)$ quickly, it suffices to compute $A^n$ quickly, which can be done in $O(m^3log n)$ time using exponentiation by squaring.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
            $endgroup$
            – Gabriele Picco
            Dec 18 '18 at 9:10














          2












          2








          2





          $begingroup$

          There is no general formula. In order to compute $f(n,m)$ quickly, you can write the recurrence relation as a matrix equation. Let $x_n$ be the vector
          $$
          x_n=begin{bmatrix}f(n,m)\f(n-1,m)\f(n-2,m)\vdots\f(n-m+1,m)end{bmatrix}
          $$

          and let $A$ be the $mtimes m$ matrix which has ones just below the diagonal, ones on the top row, and zeroes everywhere else. When $m=4,$
          $$
          A=begin{bmatrix} 1 & 1 & 1 & 1\ 1 & 0 & 0 &0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{bmatrix}
          $$



          You can verify that
          $$
          x_n=Ax_{n-1}
          $$

          holds for all $nge 1$. Iterating this, you get
          $$
          x_n=A^nx_0=A^nbegin{bmatrix}1\0\vdots\0end{bmatrix}
          $$

          Therefore, to compute $f(n,m)$ quickly, it suffices to compute $A^n$ quickly, which can be done in $O(m^3log n)$ time using exponentiation by squaring.






          share|cite|improve this answer









          $endgroup$



          There is no general formula. In order to compute $f(n,m)$ quickly, you can write the recurrence relation as a matrix equation. Let $x_n$ be the vector
          $$
          x_n=begin{bmatrix}f(n,m)\f(n-1,m)\f(n-2,m)\vdots\f(n-m+1,m)end{bmatrix}
          $$

          and let $A$ be the $mtimes m$ matrix which has ones just below the diagonal, ones on the top row, and zeroes everywhere else. When $m=4,$
          $$
          A=begin{bmatrix} 1 & 1 & 1 & 1\ 1 & 0 & 0 &0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{bmatrix}
          $$



          You can verify that
          $$
          x_n=Ax_{n-1}
          $$

          holds for all $nge 1$. Iterating this, you get
          $$
          x_n=A^nx_0=A^nbegin{bmatrix}1\0\vdots\0end{bmatrix}
          $$

          Therefore, to compute $f(n,m)$ quickly, it suffices to compute $A^n$ quickly, which can be done in $O(m^3log n)$ time using exponentiation by squaring.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 16 '18 at 19:23









          Mike EarnestMike Earnest

          22.6k12051




          22.6k12051












          • $begingroup$
            Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
            $endgroup$
            – Gabriele Picco
            Dec 18 '18 at 9:10


















          • $begingroup$
            Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
            $endgroup$
            – Gabriele Picco
            Dec 18 '18 at 9:10
















          $begingroup$
          Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
          $endgroup$
          – Gabriele Picco
          Dec 18 '18 at 9:10




          $begingroup$
          Fantastic solution! I just think the last line of $ x_ {n} $ should be $ f (n-m, m) $
          $endgroup$
          – Gabriele Picco
          Dec 18 '18 at 9:10











          2












          $begingroup$

          I was able to callculate $f(m,n)$ quickly by using recurrence:



          $$f(n, m)=1quad text{if} quad nin{0,1}$$
          $$f(n, m)=0quad text{if} quad n<0$$
          $$f(n,m)=sum_{k=1}^m f(n-k,m)$$



          ...or in Mathematica:



          f[n_, m_] := 1 /; n == 0 || n == 1

          f[n_, m_] := 0 /; n < 0

          f[n_, m_] := f[n, m] = Sum[f[n - k, m], {k, 1, m}]


          This gives accurate results for all your examples and calculates the number of combinations for bigger values of $n,m$ fairly quickly. For example:



          $$f(5,3)=13$$



          $$f(20,10)=521472$$



          $$f(100,20)=633800819629853453628932292608$$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:04












          • $begingroup$
            I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:12










          • $begingroup$
            @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
            $endgroup$
            – Oldboy
            Dec 16 '18 at 10:15












          • $begingroup$
            Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:27












          • $begingroup$
            if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:28
















          2












          $begingroup$

          I was able to callculate $f(m,n)$ quickly by using recurrence:



          $$f(n, m)=1quad text{if} quad nin{0,1}$$
          $$f(n, m)=0quad text{if} quad n<0$$
          $$f(n,m)=sum_{k=1}^m f(n-k,m)$$



          ...or in Mathematica:



          f[n_, m_] := 1 /; n == 0 || n == 1

          f[n_, m_] := 0 /; n < 0

          f[n_, m_] := f[n, m] = Sum[f[n - k, m], {k, 1, m}]


          This gives accurate results for all your examples and calculates the number of combinations for bigger values of $n,m$ fairly quickly. For example:



          $$f(5,3)=13$$



          $$f(20,10)=521472$$



          $$f(100,20)=633800819629853453628932292608$$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:04












          • $begingroup$
            I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:12










          • $begingroup$
            @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
            $endgroup$
            – Oldboy
            Dec 16 '18 at 10:15












          • $begingroup$
            Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:27












          • $begingroup$
            if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:28














          2












          2








          2





          $begingroup$

          I was able to callculate $f(m,n)$ quickly by using recurrence:



          $$f(n, m)=1quad text{if} quad nin{0,1}$$
          $$f(n, m)=0quad text{if} quad n<0$$
          $$f(n,m)=sum_{k=1}^m f(n-k,m)$$



          ...or in Mathematica:



          f[n_, m_] := 1 /; n == 0 || n == 1

          f[n_, m_] := 0 /; n < 0

          f[n_, m_] := f[n, m] = Sum[f[n - k, m], {k, 1, m}]


          This gives accurate results for all your examples and calculates the number of combinations for bigger values of $n,m$ fairly quickly. For example:



          $$f(5,3)=13$$



          $$f(20,10)=521472$$



          $$f(100,20)=633800819629853453628932292608$$






          share|cite|improve this answer









          $endgroup$



          I was able to callculate $f(m,n)$ quickly by using recurrence:



          $$f(n, m)=1quad text{if} quad nin{0,1}$$
          $$f(n, m)=0quad text{if} quad n<0$$
          $$f(n,m)=sum_{k=1}^m f(n-k,m)$$



          ...or in Mathematica:



          f[n_, m_] := 1 /; n == 0 || n == 1

          f[n_, m_] := 0 /; n < 0

          f[n_, m_] := f[n, m] = Sum[f[n - k, m], {k, 1, m}]


          This gives accurate results for all your examples and calculates the number of combinations for bigger values of $n,m$ fairly quickly. For example:



          $$f(5,3)=13$$



          $$f(20,10)=521472$$



          $$f(100,20)=633800819629853453628932292608$$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 16 '18 at 8:55









          OldboyOldboy

          8,1751936




          8,1751936












          • $begingroup$
            Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:04












          • $begingroup$
            I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:12










          • $begingroup$
            @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
            $endgroup$
            – Oldboy
            Dec 16 '18 at 10:15












          • $begingroup$
            Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:27












          • $begingroup$
            if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:28


















          • $begingroup$
            Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:04












          • $begingroup$
            I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:12










          • $begingroup$
            @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
            $endgroup$
            – Oldboy
            Dec 16 '18 at 10:15












          • $begingroup$
            Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:27












          • $begingroup$
            if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
            $endgroup$
            – Gabriele Picco
            Dec 16 '18 at 10:28
















          $begingroup$
          Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:04






          $begingroup$
          Fantastic solution! I implemented it in Python, unfortunately in some cases it fails to compute it and generates the error: maximum recursion depth exceeded in comparison. For example: $f(99999, 3)$
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:04














          $begingroup$
          I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:12




          $begingroup$
          I'm trying to optimize it or find a closed formula that allows me to calculate it even for large numbers
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:12












          $begingroup$
          @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
          $endgroup$
          – Oldboy
          Dec 16 '18 at 10:15






          $begingroup$
          @GabrielePicco If you like the solution, please upvote it :) With my approach the recursion depth is equal to $n$ so in your example Python will have to do 99999 recursive calls which will cause the stack to overflow. Even if it had not, the result would have been a number of epic proportions :)
          $endgroup$
          – Oldboy
          Dec 16 '18 at 10:15














          $begingroup$
          Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:27






          $begingroup$
          Yes you are right. The number of recursions is $ n$ x $m $ right? in the example $ f (99999,3) $ should be 99999 x 3 recursion.
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:27














          $begingroup$
          if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:28




          $begingroup$
          if I know that I will have to apply a module to the result of the function, can I somehow simplify the calculation?
          $endgroup$
          – Gabriele Picco
          Dec 16 '18 at 10:28


















          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%2f3042357%2fnumber-of-compositions-of-a-positive-number-n-with-factors-between-1-and-a-cert%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

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei