+ Reply to Thread
Results 1 to 9 of 9

Thread: HELP! probability that a 7 digit number is divisible by 7?

  1. #1
    Points: 12, Level: 1
    Level completed: 23%, Points required for next Level: 38

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HELP! probability that a 7 digit number is divisible by 7?




    The seven digits {1; 2; 3; 4; 5; 6; 7} are written down in a random order. What is the
    chance that the resulting number is divisible by 7? For instance, 1234576 works, but
    1234567 doesn’t.

  2. #2
    Devorador de queso
    Points: 95,995, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,938
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    Hi! We are glad that you posted here! This looks like a homework question though. Our homework help policy can be found here. We mainly just want to see what you have tried so far and that you have put some effort into the problem. I would also suggest checking out this thread for some guidelines on smart posting behavior that can help you get answers that are better much more quickly.
    I don't have emotions and sometimes that makes me very sad.

  3. #3
    Omega Contributor
    Points: 38,432, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,006
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    What Dason said. Or you could see how may of the 5040 combinations (i.e., 7!) of the numbers are divisible by 7. Then take that number divided by 5040 to get the probability.
    Stop cowardice, ban guns!

  4. #4
    Devorador de queso
    Points: 95,995, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,938
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    I brute forced the solution and the answer is quite nice. The problem is I can't find a nice alternative reason for why that answer is what it is...
    I don't have emotions and sometimes that makes me very sad.

  5. #5
    Omega Contributor
    Points: 38,432, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,006
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    Is it something cool like 77?
    Stop cowardice, ban guns!

  6. #6
    TS Contributor
    Points: 22,472, Level: 93
    Level completed: 13%, Points required for next Level: 878
    spunky's Avatar
    Location
    vancouver, canada
    Posts
    2,137
    Thanks
    166
    Thanked 538 Times in 432 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    Quote Originally Posted by Dason View Post
    I brute forced the solution and the answer is quite nice. The problem is I can't find a nice alternative reason for why that answer is what it is...
    how did you do it? i was thinking on taking that approach as well.

    i know it's inefficient but i was basically planning on have a list of numbers from 1111111 to 7777777 and then just let R see whether there were any repeated digits in any given numbers and, if they were, throw them out so i ended up with the sub-set that's needed.
    for all your psychometric needs! https://psychometroscar.wordpress.com/about/

  7. #7
    Devorador de queso
    Points: 95,995, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,938
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    Quote Originally Posted by spunky View Post
    how did you do it? i was thinking on taking that approach as well.

    i know it's inefficient but i was basically planning on have a list of numbers from 1111111 to 7777777 and then just let R see whether there were any repeated digits in any given numbers and, if they were, throw them out so i ended up with the sub-set that's needed.
    The permn function in the combinat package will create all the permutations for you. Alternatively - check the chatbox.
    I don't have emotions and sometimes that makes me very sad.

  8. #8
    Omega Contributor
    Points: 38,432, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,006
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?

    Spunky I like you straight forward idea. Dason would Spunky's code run faster than yours or within 3-4Xs the other package?

    Side note, I think the OP was looking for a formula style equation just to plug numbers into, does one of those exist, if so would that run faster than your code Dason, probably. Not ripping on your code but woundering about the most efficient method. Seems like a BGM question. Somebody put out the factorial bat signal.

    Looks like the cyclone > golden hurricane + residuals.
    Stop cowardice, ban guns!

  9. #9
    Devorador de queso
    Points: 95,995, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,938
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: HELP! probability that a 7 digit number is divisible by 7?


    The issue is that I don't know of a nice test for divisibility by 7. It's not like 2 or 5 where you can just look at the digit in the 1s place or like 3 where you can look at if the sum of all the digits is divisible by 3...

    And I doubt Spunky's code would run faster than mine. spunky would need to check 7777777-1111111 = 6666666 values whereas mine just needs to check 7!=5040 values.

    Edit: Although you could make spunky's approach slightly better by only starting at 1234567 and ending at 7654321.
    Last edited by Dason; 09-26-2013 at 09:51 PM.
    I don't have emotions and sometimes that makes me very sad.

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats