All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Bug on a Cube 3 (Posted on 2023-12-05) Difficulty: 3 of 5
A bug is placed at one corner of a wire frame in the shape of a cube. This cube currently does not have any sugar for the hungry bug.

The bug crawls along the 12 wires of the frame searching for something to eat. At each of the 8 corners the bug randomly chooses one of the 3 wires to follow next (including the one it just traveled).

The moment the bug crosses the first wire to the next corner, a piece of sugar is placed on the original starting corner. At some point, the bug will return to the starting corner and reach the sugar.

What is the probability that the bug will have visited all 8 corners by the time it returns to the starting corner?

No Solution Yet Submitted by Larry    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution via simulation | Comment 1 of 3
totCt=0; succ=0;
for trial=1:1000000
  bug='b'; 
  while bug(end)~='a'
    switch bug(end)
      case 'a'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='b';
          case(2)
            bug(end+1)='c';
          case(3)
            bug(end+1)='d';
        end
      case 'b'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='a';
          case(2)
            bug(end+1)='e';
          case(3)
            bug(end+1)='f';
        end
      case 'c'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='a';
          case(2)
            bug(end+1)='f';
          case(3)
            bug(end+1)='g';
        end
      case 'd'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='a';
          case(2)
            bug(end+1)='g';
          case(3)
            bug(end+1)='e';
        end
      case 'e'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='h';
          case(2)
            bug(end+1)='b';
          case(3)
            bug(end+1)='d';
        end
      case 'f'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='h';
          case(2)
            bug(end+1)='b';
          case(3)
            bug(end+1)='c';
        end
      case 'g'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='h';
          case(2)
            bug(end+1)='d';
          case(3)
            bug(end+1)='c';
        end
      case 'h'
        r=randi(3);
        switch(r)
          case(1)
            bug(end+1)='e';
          case(2)
            bug(end+1)='g';
          case(3)
            bug(end+1)='f';
        end
    end
  end
  if length(unique(bug))==8
    succ=succ+1;
  end
end


produces



succ
succ/trial

succ =
      128945
ans =
                  0.128945

This is slightly more than 1/8, and the latter is within the range of possibilities though the next run was also high:

succ =
      129077
ans =
                  0.129077

 and the next:

succ =
      129077
ans =
                  0.129077

(That was weird; it actually happened twice in a row)

then:

succ =
      128772
ans =
                  0.128772

then:

succ =
      128644
ans =
                  0.128644

So it looks like it's definitely higher than 1/8

  Posted by Charlie on 2023-12-05 10:41:28
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information