×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

#### Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
To Your Posts
• Keyword Search
• One-Click Access To Your
Favorite Forums
• Automated Signatures
On Your Posts
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

# Rubik's

 Forum Search FAQs Links MVPs

## Rubik's

(OP)
I know a Rubik's cube is a puzzle in and of itself, but my question involves only a small part of a Rubik's cube.

Imagine you are holding a Rubik's cube and you are looking at the white face of the cube.  If the cube is oriented such that the green face is on the right side, that will put the orange face on the bottom.

#### CODE --> Rubik's orientation

yellow (in back and hidden)
-------------
/    red     /|
/            / |
|------------|  |
|            | green
blue |    white   |  /
|            | /
--------------/

orange

Now, assuming the cube is starting out solved and alternating between only 2 moves - spinning the green face down (toward you) and the orange face to the left, how many moves will it take to scramble and then resolve the cube?  I just manually did it, so I know the answer, but this is the hard part - how can it be solved programmatically w/o using a loop and checking for a solved state after each move?  After doing it manually it took this many moves to solve:

#### Spoiler:

210

So, alternating between the 2 moves:
1. Spin right side face (green) down toward you
2. Spin bottom side face (orange) to the left
3. GOTO 1
How long does it take for the cube to resolve itself, and why?

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

Replies continue below

### RE: Rubik's

First thought:

Just concentrated on the red-white-green corner, it takes N moves to come  so you have to do 3N moves to have it back in the original rotation. Then surely something else will still be out of whack and adds another factor to the formula.

Regarding N: There are 6 stations on the way of it's original position back to it. But it's not moved in every move. It's moved in the 1st, 2nd, 4th, 6th, 7th and 9th move and not in the 10th. But I'd count that too, because afterwards that pattern repeats. So it's 30xM, Figure out M.

Bye, Olaf.

### RE: Rubik's

(OP)
Well, on the bright side the solution is a multiple of 30, so I think that you are on the right track

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

### RE: Rubik's

Maybe I'm off because I was trying to track the movement of one square on a piece of paper.  But it the bottom right had to move 15 times to return to its original position.  What I didn't count was how many times a turn was made and it didn't move. :P

### RE: Rubik's

I must not understand your instructions because when I follow them manually my cube returns to its original position in 6 moves.

mmerlinn

"Political correctness is the BADGE of a COWARD!"

### RE: Rubik's

Now if I had a cube, it's hard to do moves just in the mind. We need to concentrate on other single elements and find out how many moves it takes to put them in their original position and rotation. Then find out the least common multiple.

Bye, Olaf.

### RE: Rubik's

mmerlin, I think you spin the green and white face, while you should spin the orange (bottom) face of the cube.

It takes the white-green edge 14 moves to come back.

14=2*7
30=2*3*5

least common multiple is 2*3*5*7=210

I wonder if any other period for a certain other corner or edge would include a higher prime number like 11. But even 7 is rather odd, so could be the case.

Assuming you would not have taken your time for 2*3*5*7*11=4620 moves or even higher (if there is a period of n*13 etc.), it should be 210 moves.

But that's no proof, just taking probabilities into account and making assumptions on your patience.

Bye, Olaf.

### RE: Rubik's

sorry, 2*3*5*7 is of course 2310, half of 4620. Still a low probability, that you would have had the patience for 2310 moves...

Bye, Olaf.

### RE: Rubik's

2*3*5*7*11. Bad at copy & paste this time.

Bye, Olaf.

### RE: Rubik's

Again,

hmm, could also be something like 2*2*3*7 or 2*3*3*7, the least common multiple. A prime number can be a factor twice or more. So could also be 420 or 630. Hmm.

Bye, Olaf.

### RE: Rubik's

(OP)
mmerlinn, I'll try the best with my makeshift ascii drawing - but here's what I'm trying to explain:

#### CODE

yellow (in back and hidden)
-------------
/    red     /|
/            / |
|------------|  |
|          | | green
blue |   white | |  /
|  <---    V | /
--------------/

orange
Start by turning the green face down (towards you) From a solved position, the first move would make the white face look like this:

#### CODE

|   |
-----------
|   |
-----------
|   |
Then the 2nd move would be to spin the orange face, which is on the bottom, to the left.  After doing that, the white face of the cube would look like this:

#### CODE

|   |
-----------
|   |
-----------
|   |
Then, continue to alternate those 2 moves until the cube becomes solved again.  It will take much more than 6 moves.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

### RE: Rubik's

(OP)
Olaf, what is the reasoning behind the least common multiples?  Your answer is correct, but I'm not sure why.  Could you explain?

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

### RE: Rubik's

The reasoning behing least common multiples? Well, looking at each piece on it's own, you have a certan period of moves, after which it restores position and orientation.

All pieces will be in their initial position and orientation when all these independant periods end together. And that is surely the case, if you multiply all the periods, but the least common multiple is sufficient.

It's comparable to several gearwheels with a certain amount of cogs. If you take one with 6 cogs and one with 15, you need need to spin the 6-cog-gearwheel 5 times to move the 15-cog-gearwheel twice and be in the initial position. Or you need to spin the 15 gear-wheel twice to have the 6-cog-gearwheel in its original position. Because then both gearwheels have moved 30 cogs, which is the least common multiple of 6 and 15.

Bye, Olaf.

### RE: Rubik's

The middle pieces of the green and orange faces don't move, but they rotate. But as you spin each face 105 times 90 degrees, that finally rotates them 90 degrees. So if you not only care about the colors but also the rotation, then you would need 4*210=840 moves to put the cube back to it's initial state including rotation of the middle pieces.

Bye, Olaf.

### RE: Rubik's

But, is there a way to figure the number of turns without manually counting them (or number crunching with a script) to identify the number of turns.

Am I correct in saying:
We must end on an even number of rotations.
We're only dealing with 15 cogs.
7 rotate on green
7 rotate on orange
1 shared

Maybe it's just making the numbers fit Olaf's post, but it'd provide primes 2, 3, 5, & 7.

If we add another rotation, say on blue, would it take 154 (2 * 7 * 11) moves?  Or do I have it wrong and it's really 322 (2 * 7 * 23) moves?  Or, am I entirely incorrect because my numbers are made up? ;)

### RE: Rubik's

My numbers (made up though they may be) are off if we add another rotation.  I think there'd be a * 3 in there.

even = 2
22 cogs = 11 * 2
7 blue = 7
7 green = 7
6 orange = 3 * 2
1 orange/blue = 1
1 orange/green = 1

2 * 3 * 7 * 11 = 462.

### RE: Rubik's

Skie,

I think you are getting my gearwheel analogon a little wrong.

There are 15 elements of the cube moving if you count the middle ones. I'd say 3 shared plus 6 other elements on both faces, but okay. You got that right.

So the analogon to the problem would be 15 gearwheels, not 15 cogs. Each gearwheel will have as much cogs, as you need moves to put the corresponding element back to initial position and rotation.

But there's a cathc: As I said in the first example of the red-white-green I counted 10 to put the corner back (rotated though), although it's back after 9 moves already. The thing is, after 18 moves it will not be back. The (partly) period is not done, because the first move of the first period moved that corner, the 10th move would not, so it belongs to that period. And you need to do that 3 times to get the rotation right, which results in 30 moves.

My results so far are:
red-white-green: 30 = 2*3*5
white-green: 14 = 2*7
middle orange: 8 = 2*2*2
middle green: 8 = 2*2*2

That alone makes 4 of the 15 gearwheels. It gives a least common multiple of 840, due to the rotation of the middle elements, for which you don't really need to care. Without them it's 210 so far.

It would matter if any other element would contribute more prime factors to the overall result. For a proof I need to provide those periods too. I only argued on the fact, kaht has done this by trying. And he might have given up after more moves. I didn't proove it yet.

more periods:
white-green-orange: 6 moves - we alreasdy have 2*3, no new factor.

blue-white-orange: 30 moves - again what we already have.

All in all that corner takes the same root as the red-white-green corner, only starts/ends at a different position. The same goes for all other corners, except the white-green-orange. But no new prime factors from 6 too.

And if I think about it, all edges take the same route too. Then it's 210 or 840 respectively, depending on taking the middle elements into account or not.

Bye, Olaf.

### RE: Rubik's

Thanks for the explanation Olaf, I see where I went wrong.  When only green is rotated, there's a gear with 4 cogs.  Adding the secondary rotation on orange creates a new gear for each unique path a cube takes.

### RE: Rubik's

Credit goes to Olaf for figuring this out.  Here's my explanation based on his findings:

6 corner blocks are affected by the turns
of these positions, a block will spend two turns in each of 4 positions, and one turn in each of 2 positions.

Thus, it takes 10 turns (2*4 + 1*2) for a corner block to make a full rotation.

However, to return to its original orientation, it must complete 3 rotations.

Thus, period for corner blocks = 30.

7 side blocks are affected
of these positions, a block will spend two turns in each of 6 positions, and one turn in the remaining position, but will visit it twice in a rotation.

Thus, it takes 14 turns (2*6 + 2*1*1) to make a full rotation.  A rotation does not change a side block's orientation.

Thus, period for side blocks = 14.

If we count the orientation of the middle blocks (which I think is a nice twist), there are two blocks affected, but neither changes position.  Thus, each block makes a rotation every 2 turns.  It takes 4 rotations to return to its original orientation.

Thus, period for middle blocks is 8.

The least common denominator of 30, 14, and 8 is 840.

Ignoring the middle blocks, lcd of 30 and 14 is 210.

This is a fun mathematical exercise.  Thanks for the distraction.

Thus, it takes

### RE: Rubik's

kaht,

You weren't by chance using one of these were you?
http://jpbrown.i8.com/cubesolver.html

Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.

### RE: Rubik's

(OP)
Nah, I learned how to solve one a few years back, but that's a pretty neat machine

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

### RE: Rubik's

From being a tad of a "cubist" myself, I know of some variations. I have three Rubik's cubes on my desk at work: a 3x3x3, a 4x4x4, and a 5x5x5.

• Rotate the rightt face 90 degrees clockwise about its face. Rotate the entire cube so that the top face does not change and the rear face becomes the right face. Repeat process. How many iterations of this before the cube is solved?

• Rotate the right face 90 degrees clockwise about its face and the leftmost face 90 degrees clockwise about its face. Rotate the entire cube so that the top face does not change and the rear face becomes the right face. Repeat. How many iterations to solve? If you start again but only perform half the number of iterations, you will find a neat zig-zag pattern on the sides of the cube with the top and bottom solved. If you then perform the same half-tranformation again only starting with the "wrong" pair of faces, you will find another interesting transformation, again with the top and bottom faces solved.

My alarm clock causes time travel. When I hit snooze, no apparent time passes before the alarm sounds again, but the universe has in fact moved forward through time by ten minutes!

### RE: Rubik's

I have a Rubik's cube with pictures in place of the colors.  It makes an interesting twist as you get it solved only to realize the center square is not oriented correctly with the rest of the picture and have to start all over.

Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

### Reply To This Thread

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!

Already a member? Close this window and log in.