How many numbers are there which only contain digits 4 and 7 in them?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I wanna know how many numbers n are there which only contain digits 4 and 7 in them, where n (1  ≤  n  ≤ 10 9).



Ex: 4, 7, 44, 47, 74, 77, ....



I am trying to find a general equation to compute the numbers, given how many digits which is 2 in this case and the range which (1  ≤  n  ≤ 10 9).










share|cite|improve this question

























    up vote
    2
    down vote

    favorite












    I wanna know how many numbers n are there which only contain digits 4 and 7 in them, where n (1  ≤  n  ≤ 10 9).



    Ex: 4, 7, 44, 47, 74, 77, ....



    I am trying to find a general equation to compute the numbers, given how many digits which is 2 in this case and the range which (1  ≤  n  ≤ 10 9).










    share|cite|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I wanna know how many numbers n are there which only contain digits 4 and 7 in them, where n (1  ≤  n  ≤ 10 9).



      Ex: 4, 7, 44, 47, 74, 77, ....



      I am trying to find a general equation to compute the numbers, given how many digits which is 2 in this case and the range which (1  ≤  n  ≤ 10 9).










      share|cite|improve this question













      I wanna know how many numbers n are there which only contain digits 4 and 7 in them, where n (1  ≤  n  ≤ 10 9).



      Ex: 4, 7, 44, 47, 74, 77, ....



      I am trying to find a general equation to compute the numbers, given how many digits which is 2 in this case and the range which (1  ≤  n  ≤ 10 9).







      combinatorics discrete-mathematics






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked 53 mins ago









      Basma Ashour

      134




      134




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          4
          down vote













          Well, how do you create a number of $i$ digits where all the digits are $4$ and $7$? For each of the $i$ digits you have to choose if it will be $4$ or $7$, so for each digit you have $2$ options. Hence the number of such numbers is $2^i$. Now, how is that related to your problem? You are interested in finding how many numbers are there that contain only digits $4$ and $7$ when the number of digits is between $1$ and $9$. Well, there are $2^1$ numbers with $1$ digit, $2^2$ with $2$ digits and so on. So the final answer is:



          $sum_k=1^9 2^k=2(2^9-1)$



          I used the formula for geometric sum.






          share|cite|improve this answer




















          • I got it, thanks for the great and straightforward explanation!
            – Basma Ashour
            41 mins ago

















          up vote
          1
          down vote













          There are $2$ with length $1$, $2^2$ with length $2$, $2^3$ with length $3$, et cetera.



          That observation leads to a total of:$$2+2^2+2^3+cdots+2^9=2^10-2$$



          The last equation on base of: $$(2-1)(2+2^2+2^3+cdots+2^9)=(2^2+2^3+cdots+2^10)-(2+2^2+2^3+cdots+2^9)=2^10-2$$






          share|cite|improve this answer




















          • Nice explanation, thanks for your help.
            – Basma Ashour
            32 mins ago

















          up vote
          0
          down vote













          You may consider the following recursive formula:
          $$f(n) = 2f(n-1)+f(n-1), f(1) = 2$$






          share|cite|improve this answer
















          • 1




            It's nice to think about it recursively, thank you.
            – Basma Ashour
            33 mins ago










          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',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          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%2f2943101%2fhow-many-numbers-are-there-which-only-contain-digits-4-and-7-in-them%23new-answer', 'question_page');

          );

          Post as a guest






























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote













          Well, how do you create a number of $i$ digits where all the digits are $4$ and $7$? For each of the $i$ digits you have to choose if it will be $4$ or $7$, so for each digit you have $2$ options. Hence the number of such numbers is $2^i$. Now, how is that related to your problem? You are interested in finding how many numbers are there that contain only digits $4$ and $7$ when the number of digits is between $1$ and $9$. Well, there are $2^1$ numbers with $1$ digit, $2^2$ with $2$ digits and so on. So the final answer is:



          $sum_k=1^9 2^k=2(2^9-1)$



          I used the formula for geometric sum.






          share|cite|improve this answer




















          • I got it, thanks for the great and straightforward explanation!
            – Basma Ashour
            41 mins ago














          up vote
          4
          down vote













          Well, how do you create a number of $i$ digits where all the digits are $4$ and $7$? For each of the $i$ digits you have to choose if it will be $4$ or $7$, so for each digit you have $2$ options. Hence the number of such numbers is $2^i$. Now, how is that related to your problem? You are interested in finding how many numbers are there that contain only digits $4$ and $7$ when the number of digits is between $1$ and $9$. Well, there are $2^1$ numbers with $1$ digit, $2^2$ with $2$ digits and so on. So the final answer is:



          $sum_k=1^9 2^k=2(2^9-1)$



          I used the formula for geometric sum.






          share|cite|improve this answer




















          • I got it, thanks for the great and straightforward explanation!
            – Basma Ashour
            41 mins ago












          up vote
          4
          down vote










          up vote
          4
          down vote









          Well, how do you create a number of $i$ digits where all the digits are $4$ and $7$? For each of the $i$ digits you have to choose if it will be $4$ or $7$, so for each digit you have $2$ options. Hence the number of such numbers is $2^i$. Now, how is that related to your problem? You are interested in finding how many numbers are there that contain only digits $4$ and $7$ when the number of digits is between $1$ and $9$. Well, there are $2^1$ numbers with $1$ digit, $2^2$ with $2$ digits and so on. So the final answer is:



          $sum_k=1^9 2^k=2(2^9-1)$



          I used the formula for geometric sum.






          share|cite|improve this answer












          Well, how do you create a number of $i$ digits where all the digits are $4$ and $7$? For each of the $i$ digits you have to choose if it will be $4$ or $7$, so for each digit you have $2$ options. Hence the number of such numbers is $2^i$. Now, how is that related to your problem? You are interested in finding how many numbers are there that contain only digits $4$ and $7$ when the number of digits is between $1$ and $9$. Well, there are $2^1$ numbers with $1$ digit, $2^2$ with $2$ digits and so on. So the final answer is:



          $sum_k=1^9 2^k=2(2^9-1)$



          I used the formula for geometric sum.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 46 mins ago









          Mark

          3,995114




          3,995114











          • I got it, thanks for the great and straightforward explanation!
            – Basma Ashour
            41 mins ago
















          • I got it, thanks for the great and straightforward explanation!
            – Basma Ashour
            41 mins ago















          I got it, thanks for the great and straightforward explanation!
          – Basma Ashour
          41 mins ago




          I got it, thanks for the great and straightforward explanation!
          – Basma Ashour
          41 mins ago










          up vote
          1
          down vote













          There are $2$ with length $1$, $2^2$ with length $2$, $2^3$ with length $3$, et cetera.



          That observation leads to a total of:$$2+2^2+2^3+cdots+2^9=2^10-2$$



          The last equation on base of: $$(2-1)(2+2^2+2^3+cdots+2^9)=(2^2+2^3+cdots+2^10)-(2+2^2+2^3+cdots+2^9)=2^10-2$$






          share|cite|improve this answer




















          • Nice explanation, thanks for your help.
            – Basma Ashour
            32 mins ago














          up vote
          1
          down vote













          There are $2$ with length $1$, $2^2$ with length $2$, $2^3$ with length $3$, et cetera.



          That observation leads to a total of:$$2+2^2+2^3+cdots+2^9=2^10-2$$



          The last equation on base of: $$(2-1)(2+2^2+2^3+cdots+2^9)=(2^2+2^3+cdots+2^10)-(2+2^2+2^3+cdots+2^9)=2^10-2$$






          share|cite|improve this answer




















          • Nice explanation, thanks for your help.
            – Basma Ashour
            32 mins ago












          up vote
          1
          down vote










          up vote
          1
          down vote









          There are $2$ with length $1$, $2^2$ with length $2$, $2^3$ with length $3$, et cetera.



          That observation leads to a total of:$$2+2^2+2^3+cdots+2^9=2^10-2$$



          The last equation on base of: $$(2-1)(2+2^2+2^3+cdots+2^9)=(2^2+2^3+cdots+2^10)-(2+2^2+2^3+cdots+2^9)=2^10-2$$






          share|cite|improve this answer












          There are $2$ with length $1$, $2^2$ with length $2$, $2^3$ with length $3$, et cetera.



          That observation leads to a total of:$$2+2^2+2^3+cdots+2^9=2^10-2$$



          The last equation on base of: $$(2-1)(2+2^2+2^3+cdots+2^9)=(2^2+2^3+cdots+2^10)-(2+2^2+2^3+cdots+2^9)=2^10-2$$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 39 mins ago









          drhab

          90.1k542123




          90.1k542123











          • Nice explanation, thanks for your help.
            – Basma Ashour
            32 mins ago
















          • Nice explanation, thanks for your help.
            – Basma Ashour
            32 mins ago















          Nice explanation, thanks for your help.
          – Basma Ashour
          32 mins ago




          Nice explanation, thanks for your help.
          – Basma Ashour
          32 mins ago










          up vote
          0
          down vote













          You may consider the following recursive formula:
          $$f(n) = 2f(n-1)+f(n-1), f(1) = 2$$






          share|cite|improve this answer
















          • 1




            It's nice to think about it recursively, thank you.
            – Basma Ashour
            33 mins ago














          up vote
          0
          down vote













          You may consider the following recursive formula:
          $$f(n) = 2f(n-1)+f(n-1), f(1) = 2$$






          share|cite|improve this answer
















          • 1




            It's nice to think about it recursively, thank you.
            – Basma Ashour
            33 mins ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          You may consider the following recursive formula:
          $$f(n) = 2f(n-1)+f(n-1), f(1) = 2$$






          share|cite|improve this answer












          You may consider the following recursive formula:
          $$f(n) = 2f(n-1)+f(n-1), f(1) = 2$$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 38 mins ago









          Maged Saeed

          1597




          1597







          • 1




            It's nice to think about it recursively, thank you.
            – Basma Ashour
            33 mins ago












          • 1




            It's nice to think about it recursively, thank you.
            – Basma Ashour
            33 mins ago







          1




          1




          It's nice to think about it recursively, thank you.
          – Basma Ashour
          33 mins ago




          It's nice to think about it recursively, thank you.
          – Basma Ashour
          33 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2943101%2fhow-many-numbers-are-there-which-only-contain-digits-4-and-7-in-them%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery