Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Duncan Idaho Newsgroups: comp.lang.java.programmer Subject: Re: Mathematics, Java, good enough Date: Tue, 17 May 2016 13:29:42 +0100 Organization: A noiseless patient Spider Lines: 66 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 17 May 2016 12:26:09 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="5b04f7a4689ff95db8587c13f9721cc1"; logging-data="6583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/e4+uBoNjKwum2GJTnSEvcqen8fB0OGs8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 In-Reply-To: Cancel-Lock: sha1:8Pi277MNqfsjkzZCF0pZKuPehtA= Xref: csiph.com comp.lang.java.programmer:34319 On 17/05/16 12:56, Nigel Wade wrote: > On 17/05/16 11:49, Duncan Idaho wrote: >> Hello again >> >> I have a question that involves mathematics. I agree that it's off topic but as I am writing in Java >> I thought I'd give it a go (tenuous I know but it's the best I've got). >> >> I'm dredging up set theory from the furthest reaches of my memory. I'll probably get it wrong. >> Homework? If only, that would mean I could have the last 50 years again ... perhaps not. %-) >> >> Anyway >> >> I have a set of characters S of cardinality C >> example >> if S = {a..z, 0..9, A..Z} then C = er, um ..,62. >> >> For any given result string X, X need not be a set. >> >> eg if L = 8 then >> "abcdefgh", "AAAAAAAA", "AABBCCDD" are all valid values for X >> >> how many strings of length L are possible from S >> >> I don't even know what to call the question and I probably won't understand the answer but it will be fun trying. >> > > The answer is pretty simple. 62^8. > The reasoning is also pretty simple. Well strangely enough I did try that but according to my Ubuntu desktop calculator 62^8 is 2.183401056×10^14 I think that means move the decimal point 14 places to the right which gives 218340105600000 or 218,340,105,600,000 which I think is (deep breath) two hundred and eighteen trillion three hundred and forty billion one hundred and five million six hundred thousand 8 character strings and I thought it must be wrong, that's an *huge* number Is this correct Thanks to you both for taking the time to reply Idaho > > The first character has 62 possibilities. > The second character also has 62 possibilities, so the first 2 characters have 62*62 possibilities (62^2) > The third character also has 62 possibilities, so the first 3 characters have 62*62*62 possibilities (62^3) > In general, for L from S, the number of possibilities is S^L. > > If you are not convinced, then just remove the letters and work with the numbers. > The first digit can be 0-9. The second digit can be 0-9, so the allowed values are 00-99. And so on. This ought to be quite > familiar. For 8 digits the range of possibilities would be 00000000-99999999. > > > I'm not sure of the specific name is, most likely combination of probabilities. > > > -- Duncan Idaho !(ghola mentat)