Skip to content
← Back to Community
Rubik's Cube Combinations
Profile icon
bgrubert

Hello!

Because of Covid-19(The coronavirus), I have had lot more time to work on repl.it so I decided to make this fun code!

Did you know that a 3 x 3 x 3 Rubik's cube has over 43 Quintillion or 43 Million Trillion different positions?

Calculate how many different combinations, visualize the Rubik's cube, and learn how many digits the number is with this simple program!

*** Instructions ***

  • Enter a number 1 - 100 into the input( you can put higher numbers later)
  • Press "Calculate" and wait.
  • A simulated version of the top-view of the Rubik's cube will be displayed to the left, and to the right, the number of possible combinations for that Rubik's cube (the 3d version of course).
  • If the number you chose was big enough, you will be able to scroll through the number to the bottom, otherwise, the whole number will be displayed in front of you.
  • If you didn't listen to me and chose a number higher than 100, you may get a few "Page Unresponsive" popups but you can just close them out and ignore them

*** Stats ***

Here are some of the results that I got for varying cube sizes!

  • 2 x 2 x 2 - 7 digits
  • 3 x 3 x 3 - 20 digits
  • 4 x 4 x 4 - 46 digits
  • 5 x 5 x 5 - 59 digits
  • 6 x 6 x 6 - 117 digits
  • 7 x 7 x 7 - 130 digits
  • 8 x 8 x 8 - 218 digits
  • 9 x 9 x 9 - 231 digits
  • 10 x 10 x 10 - 350 digits
  • 33 x 33 x 33 (Largest Rubik's Cube) - 3,867 digits
  • 100 x 100 x 100 - 38,416 digits (Takes a few seconds)
  • 150 x 150 x 150 - 86,708 digits
  • 200 x 200 x 200 - 154,390 digits
  • 250 x 250 x 250 - 241,461 digits
  • 300 x 300 x 300 - 347,922 digits
  • 350 x 350 x 350 - 473,771 digits
  • 400 x 400 x 400 - 619,010 digits (Took like half an hour)
  • 450 x 450 x 450 - 783,639 digits
  • 500 x 500 x 500 - 967,656 digits (Took several hours)
  • Feel free to share with me higher results i.e. 800 x 800 x 800 (You'll be mentioned here)!

Thanks!

Voters
Profile icon
wjnb
Profile icon
hawazen
Profile icon
seanlnge
Profile icon
mkhoi
Profile icon
Joseph_Parsons
Profile icon
GODLY343234323
Profile icon
JosiahKnisely
Profile icon
AgastyaSandhuja
Profile icon
Timur0th
Profile icon
SixBeeps
Comments
hotnewtop
Profile icon
OliverChen1

Nah 500x500x500 is impossible.
It throws RangeError: BigInt is too large to allocate.
But it did give me the picture :)
And, as a bonus, it only took less than one minute.

image

Profile icon
bgrubert

@OliverChen1 I managed to calculate 500 x 500 x 500

Profile icon
person11121

its working on 1k x 1k x 1k

Profile icon
avibeskrowni

410 by 410!
Beat you!

Screen Shot 2020-03-20 at 8.07.46 PM

Profile icon
bgrubert

@avibeskrowni
411x411
Screenshot 2020-03-20 at 9.56.54 PM

Edit: 500 x 500 x 500

Screenshot 2020-03-20 at 11.26.14 PM

Profile icon
avibeskrowni

@bgrubert

Screen Shot 2020-03-21 at 5.22.00 PM
oh it's on

Profile icon
staticvoidliam7

oh god this isnt going to be good

999x999x999
edit:
theeee laaaag

Profile icon
staticvoidliam7

alright ima go get a snack or something lol this is going to take a while @LiamDonohue

Profile icon
bgrubert

@LiamDonohue I don't think that's going to work - maybe try something more like 300

Profile icon
staticvoidliam7

lol im going to still try (well if it doesn't blow up my Chromebook lol) @bgrubert

Profile icon
staticvoidliam7

yeah nope it shut itself down @bgrubert

Profile icon
bgrubert

@LiamDonohue 400 is my record on my Chromebook(it took about half an hour)
Edit: my record is now 500

Profile icon
staticvoidliam7
Profile icon
Coder39182

3 x 3 x 3 Rubik's cube has over 43 Quintillion or 43 Million Trillion different positions. Is that more then or less then 5 xD?

Profile icon
JosiahKnisely

Awesome!

Profile icon
Thehappysquid

It is broken... It seems like you didn’t define the variable change.

Profile icon
[deleted]

If the numbers are big, you have to wait a loooooooong time. So be patient. @Thehappysquid

Profile icon
Thehappysquid

@CodeABC123 It gave me a syntax error

Profile icon
[deleted]

Oh... I see now... @Thehappysquid

Profile icon
bgrubert

@Thehappysquid Can you explain the bug more clearly?

Profile icon
Thehappysquid

@bgrubert when I run the program, it gives me a syntax error in the console, usually related to different things when I try to run it.

Profile icon
bgrubert

@Thehappysquid What were you inputting? The code works for me!

Profile icon
SixBeeps

Haven't seen a cubing project before. Nicely done!

Profile icon
Coder100

Next up: How to solve a rubik's cube lol
How is 1x1 not a valid input >:(

Profile icon
bgrubert

@Coder100 1x1 bugged out I'll add it in now

Profile icon
Coder100

yay lol

if(value == 1) return 1

70x70: 18747 digits
Quick question: Can you solve a Rubik's cube? I'm guessing you can :P
@bgrubert

Profile icon
bgrubert

@Coder100 I used to be able to - I forgot the ending now

Profile icon
Coder100

ending?
like pll?
;(
100 x 100 x 100 : 38416 digits @bgrubert

Profile icon
bgrubert

@Coder100 I used to know beginners method - not CFOP

Profile icon
Coder100

0 is an invalid input ;(
and so is -1
;(
0 -> 0 permutations
-1 -> -1 permutations @bgrubert

Profile icon
bgrubert

@Coder100 Shouldn't 0 have 1 permutation - just nothingness
Edit: It works now

Profile icon
Coder100

yay lol
then -1 should have 0
and -2 should have -1 @bgrubert

Profile icon
bgrubert

@Coder100 That doesn't make a lot of sense but it would make for a good easter egg

Profile icon
Coder100

or
it could be random ascii
corrupted data! @bgrubert

Profile icon
bgrubert
Profile icon
Coder100

Like this

String.fromCharCode(Math.floor(Math.random()*10000))

@bgrubert

Profile icon
bgrubert

@Coder100 I just used chance.js

Profile icon
Coder100

~~What is that? ~~
EDIT: How dare you add flavor to the JavaScript without jquery @bgrubert

Profile icon
bgrubert

@Coder100 A js library

Profile icon
avibeskrowni

@bgrubert @Coder100's not wrong. jquery is nice. although i usually use vanilla js

Profile icon
Coder100
Profile icon
DynamicSquid

I tried running your code with a 500x500 cube, but it took too long lol

Profile icon
bgrubert

@DynamicSquid You can't really go over 200 - 500

Profile icon
DynamicSquid

@bgrubert In theory, is it possible to computer big numbers? Or does the code just take too long and the computer stops running it?

Profile icon
bgrubert

@DynamicSquid The output would be millions of digits long and my chromebook just can't handle that. My code should be able to handle it - I have no idea how large you can go with Javascript Bigint

Profile icon
DynamicSquid

@bgrubert I see... Still a cool code btw

Profile icon
bgrubert

@DynamicSquid There is another website that does this but it bugs out with higher than 30 cube size