Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

lucinpub

counting problem

This topic is 5690 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!