# Challenge: What does this algorithm mean?



## zzomtceo (Feb 20, 2012)

t=(n2*2)+(((n*2)+((n-2)*2)))*(n-2))


----------



## Kirjava (Feb 20, 2012)

http://www.wolframalpha.com/input/?i=t%3D%28n^2*2%29%2B%28%28%28n*2%29%2B%28n-2%29%29*%28n-2%29%29+

not a damn clue


----------



## zzomtceo (Feb 20, 2012)

Clarification:
n= pieces per row
What does t equal?
This algorithm can be used to find _________ of any cube with equal dimensions (2x2x2, 3x3x3, etc.).

Sorry, should have been t=(n2*2)+(((n*2)+((n-2)*2)))*(n-2))
I will edit the main post.


----------



## ThomasJE (Feb 20, 2012)

Cubies in a n*3 cube I think. And it's not an algorithm, it's a formula.


----------



## zzomtceo (Feb 20, 2012)

It is the formula for finding the total external moving cubelets (t) there are on a cube.


----------



## ThomasJE (Feb 20, 2012)

Got it right! A simpler one is:
t = n*3-((n-2)*3)
So, for a 5x5 cube:
t = 5*3-(3*3) = 125-27 = 98


----------



## zzomtceo (Feb 20, 2012)

Thank you for simplifying it, good job finding the answer.
Also thank you for pointing out that it is a formula.



ThomasJE said:


> Got it right! A simpler one is:
> t = n*3-((n-2)*3)
> So, for a 5x5 cube:
> t = 5*3-(3*3) = 125-27 = 98


 How does the simplified version work?


----------



## ThomasJE (Feb 20, 2012)

ThomasJE said:


> ...A simpler one is:
> t = n*3-((n-2)*3)
> So, for a 5x5 cube:
> t = 5*3-(3*3) = 125-27 = 98


 


zzomtceo said:


> How does the simplified version work?


 
n x n x n finds out the volume of the whole cube. But, the volume where the core is wouldn't count. So, you do (n-2) x (n-2) x (n-2) to find the volume that wouldn't count. The -2 is because of the top and bottom layers that you want to keep. Then, you take that from the complete volume to get the amount of cubies.


----------



## zzomtceo (Feb 20, 2012)

ThomasJE said:


> n x n x n finds out the volume of the whole cube. But, the volume where the core is wouldn't count. So, you do (n-2) x (n-2) x (n-2) to find the volume that wouldn't count. The -2 is because of the top and bottom layers that you want to keep. Then, you take that from the complete volume to get the amount of cubies.


 
Wouldn't that be t=n^3-((n-2)^3)


----------



## ThomasJE (Feb 20, 2012)

ThomasJE said:


> ...A simpler one is:
> *t = n*3-((n-2)*3)*
> So, for a 5x5 cube:
> t = 5*3-(3*3) = 125-27 = 98


 


zzomtceo said:


> Wouldn't that be *t=n^3-((n-2)^3)*


 
Same thing, but with ^ instead of *.


----------



## zzomtceo (Feb 20, 2012)

ThomasJE said:


> Same thing, but with ^ instead of *.


 
I thought * meant multiply..


----------



## ThomasJE (Feb 20, 2012)

zzomtceo said:


> I thought * meant multiply..


 
It does in Excel. Does ^ mean 'to the power of'?


----------



## zzomtceo (Feb 20, 2012)

ThomasJE said:


> It does in Excel. Does ^ mean 'to the power of'?


 
Yes, it means go to superscript which is what exponents are written in.


----------



## ThomasJE (Feb 20, 2012)

I put =(n^3)-((n-2)^3) into Excel, and put n=1, and got that it has 2 cubelets! I put 1-17 in and here's the amount of cubies for each n x n x n cube:
n (Layers)	-	Cubelets
1	-	2
2	-	8
3	-	26
4	-	56
5	-	98
6	-	152
7	-	218
8	-	296
9	-	386
10	-	488
11	-	602
12	-	728
13	-	866
14	-	1016
15	-	1178
16	-	1352
17	-	1538


----------



## zzomtceo (Feb 20, 2012)

ThomasJE said:


> I put =(n^3)-((n-2)*3) into Excel, and put n=1, and got that it has 2 cubelets! I put 1-17 in and here's the amount of cubies for each n x n x n cube:
> n (Layers)	-	Cubelets
> 1	-	2
> 2	-	8
> ...


 
It came out as 2 because it determines how many units are in a cube. There is only 1 cubie, so it is not a cube. Also there is no empty space which is accounted for in the formula.


----------



## ThomasJE (Feb 20, 2012)

zzomtceo said:


> It came out as 2 because it determines how many units are in a cube. There is only 1 cubie, so it is not a cube. Also there is no empty space which is accounted for in the formula.


 
But it's a cube, isn't it? It just isn't a twisty puzzle. Anyone interested in checking the 17x17x17 number with an actual 17x17x17 cube?


----------



## zzomtceo (Feb 20, 2012)

ThomasJE said:


> But it's a cube, isn't it? It just isn't a twisty puzzle. Anyone interested in checking the 17x17x17 number with an actual 17x17x17 cube?


 
Yes but there is no internal void, and like I said, the formula compensates for an internal void.


----------



## ThomasJE (Feb 20, 2012)

zzomtceo said:


> Yes but there is no internal void, and like I said, the formula compensates for an internal void.


 
Let's break the formula up.
t = (n^3)-((n-2)^3)
n = 1

1^3=1

1-2=-1
-1^3=-1

1- -1 = 1+1 = 2

The 2 is because of the n-2 bit; you get a negative number. A negative number to the power of an odd number gives another negative number. Subtracting a negative number is the equivalent of adding a positive number.


----------



## Owen (Feb 20, 2012)

Am I missing something? Why multiplication?

((N^3)-((N-2)^3) Should be fine.


----------



## Lucas Garron (Feb 20, 2012)

See this thread for a more productive discussion of (formulas for) the number of visible cubies.


----------

