Determine the number of different variable names












4














Let name of a variable be a string of between 1 and 65535, inclusive, where each character can be an uppercase or a lowercase letter , a dollar sign, an underscore or a digit, except that the first character must not be a digit. What is the number of different variable names possible ?
Solution




  1. Given that the first char must not be a digit, this first character can be chosen in 26(lowercase) + 26(uppercase) + 1(dollar sign) + 1(underscore) = 54 ways.

  2. All subsequent chars can be chosen in $64^{65534}$ ways. As each subsequent digit cab be chosen in (26(uppercase) + 26(lowercase) + 1(dollar sign) + 1(underscore) + 10(digits)) = 64. As there are 65534 digits left, to get the number of possible combination 64 is multiplied 65534 times = $64^{65534}$.


  3. Hence total number of possible names is:
    $$
    54 * 64^{65534}
    $$
    Can this be the correct answer or I'm missing something ?











share|cite|improve this question
























  • Could you explain, how you did get $64^{65536}-1$ ?
    – callculus
    Sep 19 '15 at 7:46












  • that is a mistake. corrected it to $64^{65535}$....
    – dmytro.poliarush
    Sep 19 '15 at 8:01












  • What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
    – Erick Wong
    Sep 19 '15 at 8:03












  • This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
    – joriki
    Sep 19 '15 at 8:10












  • It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
    – dmytro.poliarush
    Sep 19 '15 at 8:16
















4














Let name of a variable be a string of between 1 and 65535, inclusive, where each character can be an uppercase or a lowercase letter , a dollar sign, an underscore or a digit, except that the first character must not be a digit. What is the number of different variable names possible ?
Solution




  1. Given that the first char must not be a digit, this first character can be chosen in 26(lowercase) + 26(uppercase) + 1(dollar sign) + 1(underscore) = 54 ways.

  2. All subsequent chars can be chosen in $64^{65534}$ ways. As each subsequent digit cab be chosen in (26(uppercase) + 26(lowercase) + 1(dollar sign) + 1(underscore) + 10(digits)) = 64. As there are 65534 digits left, to get the number of possible combination 64 is multiplied 65534 times = $64^{65534}$.


  3. Hence total number of possible names is:
    $$
    54 * 64^{65534}
    $$
    Can this be the correct answer or I'm missing something ?











share|cite|improve this question
























  • Could you explain, how you did get $64^{65536}-1$ ?
    – callculus
    Sep 19 '15 at 7:46












  • that is a mistake. corrected it to $64^{65535}$....
    – dmytro.poliarush
    Sep 19 '15 at 8:01












  • What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
    – Erick Wong
    Sep 19 '15 at 8:03












  • This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
    – joriki
    Sep 19 '15 at 8:10












  • It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
    – dmytro.poliarush
    Sep 19 '15 at 8:16














4












4








4







Let name of a variable be a string of between 1 and 65535, inclusive, where each character can be an uppercase or a lowercase letter , a dollar sign, an underscore or a digit, except that the first character must not be a digit. What is the number of different variable names possible ?
Solution




  1. Given that the first char must not be a digit, this first character can be chosen in 26(lowercase) + 26(uppercase) + 1(dollar sign) + 1(underscore) = 54 ways.

  2. All subsequent chars can be chosen in $64^{65534}$ ways. As each subsequent digit cab be chosen in (26(uppercase) + 26(lowercase) + 1(dollar sign) + 1(underscore) + 10(digits)) = 64. As there are 65534 digits left, to get the number of possible combination 64 is multiplied 65534 times = $64^{65534}$.


  3. Hence total number of possible names is:
    $$
    54 * 64^{65534}
    $$
    Can this be the correct answer or I'm missing something ?











share|cite|improve this question















Let name of a variable be a string of between 1 and 65535, inclusive, where each character can be an uppercase or a lowercase letter , a dollar sign, an underscore or a digit, except that the first character must not be a digit. What is the number of different variable names possible ?
Solution




  1. Given that the first char must not be a digit, this first character can be chosen in 26(lowercase) + 26(uppercase) + 1(dollar sign) + 1(underscore) = 54 ways.

  2. All subsequent chars can be chosen in $64^{65534}$ ways. As each subsequent digit cab be chosen in (26(uppercase) + 26(lowercase) + 1(dollar sign) + 1(underscore) + 10(digits)) = 64. As there are 65534 digits left, to get the number of possible combination 64 is multiplied 65534 times = $64^{65534}$.


  3. Hence total number of possible names is:
    $$
    54 * 64^{65534}
    $$
    Can this be the correct answer or I'm missing something ?








combinatorics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Sep 19 '15 at 8:10

























asked Sep 19 '15 at 7:37









dmytro.poliarush

564




564












  • Could you explain, how you did get $64^{65536}-1$ ?
    – callculus
    Sep 19 '15 at 7:46












  • that is a mistake. corrected it to $64^{65535}$....
    – dmytro.poliarush
    Sep 19 '15 at 8:01












  • What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
    – Erick Wong
    Sep 19 '15 at 8:03












  • This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
    – joriki
    Sep 19 '15 at 8:10












  • It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
    – dmytro.poliarush
    Sep 19 '15 at 8:16


















  • Could you explain, how you did get $64^{65536}-1$ ?
    – callculus
    Sep 19 '15 at 7:46












  • that is a mistake. corrected it to $64^{65535}$....
    – dmytro.poliarush
    Sep 19 '15 at 8:01












  • What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
    – Erick Wong
    Sep 19 '15 at 8:03












  • This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
    – joriki
    Sep 19 '15 at 8:10












  • It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
    – dmytro.poliarush
    Sep 19 '15 at 8:16
















Could you explain, how you did get $64^{65536}-1$ ?
– callculus
Sep 19 '15 at 7:46






Could you explain, how you did get $64^{65536}-1$ ?
– callculus
Sep 19 '15 at 7:46














that is a mistake. corrected it to $64^{65535}$....
– dmytro.poliarush
Sep 19 '15 at 8:01






that is a mistake. corrected it to $64^{65535}$....
– dmytro.poliarush
Sep 19 '15 at 8:01














What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
– Erick Wong
Sep 19 '15 at 8:03






What happened to the $54$? How can the possibly not be relevant to your final answer? And why do you say there are $65535$ digits left? The string is anywhere from $1$ to $65535$ characters long, it certainly isn't $65536$. You are definitely missing something.
– Erick Wong
Sep 19 '15 at 8:03














This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
– joriki
Sep 19 '15 at 8:10






This is wrong; see the Java language specification. A variable name is an identifier. The characters in an identifier are not limited to the ones you list; the specification states only that these are included, immediately going on to say that others are included, too. Also, according to the specification, there is no length limit; if you encountered a length limit, it may have been imposed by a non-compliant implementation.
– joriki
Sep 19 '15 at 8:10














It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
– dmytro.poliarush
Sep 19 '15 at 8:16




It is not about JAVA (corrected that). Main goal - is to find number of possible combinations given the conditions.
– dmytro.poliarush
Sep 19 '15 at 8:16










1 Answer
1






active

oldest

votes


















1














The correct answer is:



$$54(65^0)+54(64^1)+54(64^2)+...+54(64^{65534})$$



Apply the formula of sum of geometry series:



$$sum_{i=0}^n ar^j = frac{ar^{n+1}-a}{r-1}, if r neq 1$$



The nicer answer is:



$$frac{54(64^{65535} - 1)}{63}$$



You have to take variable length into account. Your solution is only for variables of max length.






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


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1441885%2fdetermine-the-number-of-different-variable-names%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The correct answer is:



    $$54(65^0)+54(64^1)+54(64^2)+...+54(64^{65534})$$



    Apply the formula of sum of geometry series:



    $$sum_{i=0}^n ar^j = frac{ar^{n+1}-a}{r-1}, if r neq 1$$



    The nicer answer is:



    $$frac{54(64^{65535} - 1)}{63}$$



    You have to take variable length into account. Your solution is only for variables of max length.






    share|cite|improve this answer




























      1














      The correct answer is:



      $$54(65^0)+54(64^1)+54(64^2)+...+54(64^{65534})$$



      Apply the formula of sum of geometry series:



      $$sum_{i=0}^n ar^j = frac{ar^{n+1}-a}{r-1}, if r neq 1$$



      The nicer answer is:



      $$frac{54(64^{65535} - 1)}{63}$$



      You have to take variable length into account. Your solution is only for variables of max length.






      share|cite|improve this answer


























        1












        1








        1






        The correct answer is:



        $$54(65^0)+54(64^1)+54(64^2)+...+54(64^{65534})$$



        Apply the formula of sum of geometry series:



        $$sum_{i=0}^n ar^j = frac{ar^{n+1}-a}{r-1}, if r neq 1$$



        The nicer answer is:



        $$frac{54(64^{65535} - 1)}{63}$$



        You have to take variable length into account. Your solution is only for variables of max length.






        share|cite|improve this answer














        The correct answer is:



        $$54(65^0)+54(64^1)+54(64^2)+...+54(64^{65534})$$



        Apply the formula of sum of geometry series:



        $$sum_{i=0}^n ar^j = frac{ar^{n+1}-a}{r-1}, if r neq 1$$



        The nicer answer is:



        $$frac{54(64^{65535} - 1)}{63}$$



        You have to take variable length into account. Your solution is only for variables of max length.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Nov 26 '18 at 7:06

























        answered Nov 26 '18 at 6:27









        Alexander Crescent

        113




        113






























            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.





            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%2f1441885%2fdetermine-the-number-of-different-variable-names%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

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...