Divisibility test by 6 mapping reducible (in linear time!) to Rubik's Cube?

badmephisto

Veteran
Joined
Aug 29, 2007
Messages
836
YouTube
Visit Channel
I call upon fellow computer scientists here, I think I came up with a proof of reducibility for division test by 6 for base 10 numbers up to 8 digits long to solving the Rubik's cube, in linear time. yes I was bored today. I wanted to double check my results here with someone before publishing. (ROFL yea right haha)

anyway, i thought it was pretty cool.

let D6 = {x| x is base10, up to 8 digits long and divisible by 6}
let C = {c| c encodes rubiks cube that is solvable}

claim: D6 <= C in linear time.
proof:

given x= d1,d2,d3...d8, a base 10 number up to 8 digits long, construct c as follows:
let c be the solved cube initially
for i = 1..8:
twist corner i di times in CW direction
if d8 is odd:
flip some edge on the cube

recall that x is divisible by 6 iff it is divisible by 2 AND it is divisible by 3.
a number is divisible by 2 iff last digit is even.
a number is divisible by 3 iff the sum of all of its digits is divisible by 3
rubiks cube is solvable iff flips of edges are even, and twists of corners % 3 = 0. (counting twists 0=normal, 1=CW, 2=CCW). (and of course the #swaps is even, but i dont change that)
The above reduction can be clearly accomplished in linear time on size of input.

It follows that x in D6 iff c in C.
QED?


so to determine divisibility of a base10 number by 6, I need a rubik's cube, linear time in size of the number, and up to 20 seconds thereafter.
if we assume that each twist or flip takes 2 seconds, then to test divisibility of an 8digit number I need 8x2+2+20=38 seconds using the cube? :D

Am I right or what? :)

EDIT:
The reduction above is actually constant time as Lucas pointed out. Originally I did not have the restriction to 8 digits, and the algorithm was instead
for i = 1...n:
twist a corner di times
then thats linear reduction, and works for arbitrarily large number of digits. But its boring because you are only twisting the same corner the whole time. pfft
 
Last edited:
I don't really get what you're trying to prove here.
a) If you use a number larger than 10^7 your divisibility test doesn't work.
b) If you use your test for numbers up to 8 digits, you can just use a big map. What's the rubik's cube for? It looks like you created the rubik's cube thing around your map.

I'm sorry if i'm totally wrong.
 
hahah! I get it

Maybe swap two corners if d8 is not 0 and not 5? (div-by-30 test :))

Unfortunately my cubing skill hasn't surpassed my summing skill (yet). ;)
 
I don't really get what you're trying to prove here.
a) If you use a number larger than 10^7 your divisibility test doesn't work.
b) If you use your test for numbers up to 8 digits, you can just use a big map. What's the rubik's cube for? It looks like you created the rubik's cube thing around your map.

I'm sorry if i'm totally wrong.

I *think* i know what you mean. You are saying that my claim is about finitely many elements so in theory of course you can construct a giant map and reduce in constant time. In fact you don't even need to reduce because its pointless because everything is finite.. it takes all the fun away.

I guess I'm just excited because this reduction has (almost) "practical" applications. Whereas constructing a map of a few billion of elements kinda ruins that.
 
Why use all 8 corners or limit to 8 digits?

Just turn the same corner clockwise for every digit, and flip an edge if the last digit is even. If the cube is solved at the end, divisible by 6.

Even better:
Get a pyraminx. Do R for every digit, same way, and check whether the last digit is even.

Also, I don't think you mean linear time, but rather constant time. But anything finite is O(constant time) if your alg runs only up to 8 digits. :p

Anyhow, Pyraminx thing is log n, if you can't do rolling addition mod 3 in your head.
 
Why use all 8 corners or limit to 8 digits?

Just turn the same corner clockwise for every digit, and flip an edge if the last digit is even. If the cube is solved at the end, divisible by 6.

Even better:
Get a pyraminx. Do R for every digit, same way, and check whether the last digit is even.

Also, I don't think you mean linear time, but rather constant time. But anything finite is O(constant time) if your alg runs only up to 8 digits. :p

Anyhow, Pyraminx thing is log n, if you can't do rolling addition mod 3 in your head.

of course, turning the same corner would indeed work :) My only problem with that is that this cube in the end would not be too exciting, and it would be very easy to see that it is solvable or not solvable... that takes the fun away too. DAMN MATHEMATICS it makes everything finite trivial.


EDIT:
Oh and yes its constant not linear. Its because originally I had it exactly as you said it, with arbitrary number of digits, and then later i restricted to 8 so that its "cooler". Yes the reduction i quoted is constant time.
Of course TECHNICALLY, it still is linear even if it is constant :D
 
Last edited:
Back
Top