Advertisement

counting problem

Started by January 21, 2003 01:13 PM
7 comments, last by lucinpub 22 years, 1 month ago
ok. Now, this is a problem from my school book, but it is an unassigned odd number. I usually try to do a few odd numbers cause I have the answers so I can see how I am faring in general. I have also spent a good amount of time trying to get it myself. But I am getting over count. heres the prob: How many strings of five ASCII contain the @ character at least once. There 128 ASCII characters. Now, I thought it would be nk-1 * k = approx 1.342 billion. But that is an over count of 21 million. The answer I see in the back of the text is 1.321 billion. I have tried everything, even stuff not yet covered in the lectures, and still cant seem to get it. any help would much appreciated, this problem is ruining my sleep, and it's not even that hard! edit1: super script edit2: spelling [edited by - lucinpub on January 21, 2003 2:29:17 PM] [edited by - lucinpub on January 21, 2003 2:32:23 PM]
Lucas Henekswww.ionforge.com
Since I can't remember much from stats class, I broke it down probably further than I needed to:

5*(127^4)
+10*(127^3)
+10*(127^2)
+5*(127)
+1
= 1321368961


For the 32 possibilities of strings of @, NOT @, I gathered the count of each frequency 1-5 (5,10,10,5,1).

EDIT: I typed a number in wrong to the calulator.

[edited by - Nypyren on January 21, 2003 5:43:18 PM]
Advertisement
An easier way to think about it is to take all the ascii strings, of which there are 128^5, and subtract all the ones with no occurence of ''@'', of which there are 127^5. This gives about 1.321 billion.

"Math is hard" -Barbie
"Math is hard" -Barbie
That makes sense... but the answer to that is 1321368963 (SLIGHTLY different than my try)

What makes up the difference (2)??

Does the back of the book say "1.321 billion" or does it exactly display the number?


[edited by - Nypyren on January 21, 2003 5:46:01 PM]
128^5 = 34359738368
127^5 = 33038369407

128^5 - 127^5 = 1321368961

At least, that''s what I get from my calculator.
quote:
Original post by Nypyren
Does the back of the book say "1.321 billion" or does it exactly display the number?



Maths books traditionally round off to between 2 and 4 decimal places. It''s to save room/money!

Timkin
Advertisement
it actually gives the full answer 1,321,368,961.
So it looks like pragma gets the points on this one. Man...I knew it would be simple, and I should have seen that one. Thanks.

edit: just realized nypyren answered first, not dragonskin or pragma, tho I like pragmas reasoning of the problem the best. OOPS!

[edited by - lucinpub on January 21, 2003 8:52:58 PM]

[edited by - lucinpub on January 21, 2003 8:55:36 PM]
Lucas Henekswww.ionforge.com
i used to do the same thing with my maths books, and ran into similar problems and i learnt that maths books usually have typo''s. its all a conspiracy. lock your door.
http://fusi.basscut.net"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle
I''ll also point out that sometimes the answers in the back of math books are wrong! (But not in this case.)

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement