# Quiz#3 NOT(Rubik's Cube)



## drsarao (Aug 8, 2012)

A cube is painted Red, Green and Blue with opposing faces  having same colour. The cube is now sawed with 3 cuts in each plane resulting in 64 equal cubes.

How many of following would you find?

Cubes with at-least TWO sides of different color.
Cubes with paint on ONE face only.
Cubes without ANY paint.
Cubes with ONE side without paint.
Cubes with THREE painted surfaces.
Cubes with RED and BLUE paints only.

Bonus question:
In the original uncut cube, how many SQUARES can you count?

Quiz#1 The-age-of-three-daughters

Quiz#2 Johnny-come-early


----------



## BiocideJ (Aug 8, 2012)

Here is what I came up with, although I have some reservations on the accuracy of some of my responses (as noted)

Cubes with at-least TWO sides of different color: 32 (2*12 edges on the opposite sides + 4*2 non-corner edges on each of the adjacent sides [24+8])
Cubes with paint on ONE face only: 24 (the 4 interior non-edge cubes from all 6 sides [4x6])
Cubes without ANY paint: 8 (the 2x2x2 cube in the center)
Cubes with ONE side without paint: 64 (all of the cubes would have at least one side without paint so perhaps I don't understand the question)
Cubes with THREE painted surfaces: 8 (the corners of the original cube [1*8])
Cubes with RED and BLUE paints only: 8 (the non-corner edges of the 2 common sides [2+2+2+2])

Bonus question:
In the original uncut cube, how many SQUARES can you count?
I would think 6 (each of the sides of the cube), however, that seems too simplistic so perhaps I don't understand the question.


----------



## drsarao (Aug 9, 2012)

Biocide,
You are right on all counts.

Two questions were wrongly worded by me. (Hence the ambiguity). Should be read as:
Cubes with exactly ONE side without paint.
In the original uncut cube (after the cut lines are marked), how many SQUARES can you count?

(I typed instead of copy-pasting to make it more difficult for a google-solution! But then Lost in Translation)


----------



## BiocideJ (Aug 9, 2012)

Cubes with exactly ONE side without paint: 0 (at most a cube could have 3 sides painted if it was a corner of the original cube)
In the original uncut cube (after the cut lines are marked), how many SQUARES can you count?
I believe it would be 126.  (16:1x1 squares + 9:2x2 squares + 4:3x3 squares + 1:4x4 square = 21 squares on a face * 6 faces to a cube = 126.


----------



## Joe4 (Aug 9, 2012)

I have moved this quiz to the Lounge. Please post all the quizzes there.
(With less traffic in the Lounge too, they will stay up on the front page longer)


----------



## drsarao (Aug 10, 2012)

Thanks Joe!



> I believe it would be 126. (*16*:1x1 squares + *9*:2x2 squares + *4*:3x3 squares + *1*:4x4 square = 21 squares on a face * 6 faces to a cube = 126.



Biocide,
I can't believe, you were done in by simple sum in the end! The answer is 30*6=180.

I created a general formula using SUMPRODUCT() with segments for chessboard filled-in: (This is for ONE face only)
(_Not at all elegant_ and limited to SUMPRODUCT() range)
Next iteration will be better.
Anybody else give it a try?
For other conditions also?Excel WorkbookABCDEFGHIJ12Segments on one side87654321034Total Nos of Squares204Sheet12*Excel 2003*Cell FormulasRangeFormulaC2=IF(B2>1,B2-1,0)D2=IF(C2>1,C2-1,0)E2=IF(D2>1,D2-1,0)F2=IF(E2>1,E2-1,0)G2=IF(F2>1,F2-1,0)H2=IF(G2>1,G2-1,0)I2=IF(H2>1,H2-1,0)J2=IF(I2>1,I2-1,0)B4=SUMPRODUCT(B2:J2,B2:J2)


----------



## BiocideJ (Aug 10, 2012)

Oops... Not exactly sure how I did that.  especially since I had the right numbers in my explanation... 16+9+4+1 = 30 like you said.
I think there is a life lesson here.  When you focus so hard on the difficult parts you are prone to overlook the obvious, simple things that are staring you right in the face.


----------



## drsarao (Aug 11, 2012)

A better formula for 'squares within squares':Excel WorkbookAB1Segments on one side2002Total Nos of Squares2686700Sheet12*Excel 2003*Cell FormulasRangeFormulaB2=SUMPRODUCT(ROW(INDIRECT("$A$1:$A$" & B1)),ROW(INDIRECT("$A$1:$A$" & B1)))


----------



## taurean (Aug 11, 2012)

Array Entered:
=SUM(POWER(ROW($A$1:INDEX(A:A,B1)),2))
OR
=SUM(ROW($A$1:INDEX(A:A,B1))^2)


----------



## drsarao (Aug 13, 2012)

Taurean,
Crisp!
I could also shorten my formula based on it:

=SUMPRODUCT(ROW(INDIRECT("$A$1:$A$" & B1))^2)

(I _had_ thought of it. But there was a mental block to putting only one argument in SUMPRODUCT()!)

Here is the complete generalized Excel solution. (I think it is correct. Submitted for peer review.)Excel WorkbookAB1CUBE Quiz2No of cuts23No of segments34Total resulting cubes2756Atleast 2 different colours207Exactly 2 different colours88Exactly 2 specific colours49Atleast 3 different colours810Only one face painted611No paint at all112Total Nos of Squares84Sheet12*Excel 2003*Cell FormulasRangeFormulaB3=B2+1B4=B3^3B6=B4-B11-B10B7=(B3-2)*8B8=(B3-2)*4B9=1*8B10=(B3-2)*(B3-2)*6B11=(B3-2)^3B12=SUMPRODUCT(ROW(INDIRECT("$A$1:$A$" & B3))^2)*6


----------



## BiocideJ (Aug 13, 2012)

Formulas look good to me with one exception that you may or may not care about. If you enter Number of Cuts = 0 (i.e. the original cube) the results are incorrect. These formulas correct that (if you care about case 0)


Excel 2007AB1CUBE QUIT2No of cuts03No of segments14Total resulting cubes156Atleast 2 different colours17Exactly 2 different colours08Exactly 2 specific colours09Atleast 3 different colours110Only one face painted011No paint at all012Total Nos of Squares6Sheet1Cell FormulasRangeFormulaB3=B2+1B4=B3^3B6=B4-B10-B11B7=(B3-MIN(B4,2))*8B8=(B3-MIN(B4,2))*4B9=MIN(B4,8)B10=(B3-MIN(B4,2))^2*6B11=(B3-MIN(B4,2))^3B12=SUMPRODUCT(ROW(INDIRECT("$A$1:$A$" & B3))^2)*6

Editted cells are B7:B11 (using MIN) which basically just makes sure that your resultant counts for each query cannot be larger than the total number of cubes you have.


----------



## Fazza (Aug 14, 2012)

Always best to avoid array formulas, IMHO. Suggest instead some variation of
	
	
	
	
	
	



```
=A1*(A1+1)*(2*A1+1)/6
```
to count the squares: base count in A1


----------



## BiocideJ (Aug 15, 2012)

Fazza said:


> Always best to avoid array formulas, IMHO



I'm curious why feel that way. SUMPRODUCT isn't any more an array formula than SUM(A1:Z700) is it?  I'm not saying you are wrong, I would just like to understand your reasoning.


----------



## Fazza (Aug 15, 2012)

From Excel 2003 help,

SUM


> Adds all the numbers in a range of cells.



SUMPRODUCT





> Multiplies corresponding components in the given arrays, and returns the sum of those products.



SUMPRODUCT is an array formula. SUM is not.


----------



## BiocideJ (Aug 17, 2012)

Getting into semantics now, but what is a range, but an array of cells.

I.E. given
*Excel 2007*
ABC11152215334455

<COLGROUP><COL><COL><COL><COL></COLGROUP><THEAD>

</THEAD><TBODY>

</TBODY>*Sheet3*​

*Worksheet Formulas*
CellFormulaC1=SUM(A1:A5)C2=SUMPRODUCT(A1:A5)

<THEAD>

</THEAD><TBODY>

</TBODY>

<TBODY>

</TBODY>


SUM and SUMPRODUCT are fed the same information and give the same output. I am assuming your claim is that Excel handles the two differently, which is probably true since you shouldn't use SUMPRODUCT on an entire column of 1M+ rows. I'll concede that all things being equal if you can use a non-array formula you are probably better off which I think is what you meant. 
In this example, however, I don't think there is a way to dynamically calculate the factorial without using an array formula.
Thanks for the reply.


----------



## taurean (Aug 17, 2012)

Not totally correct interpretation.

In your example, the formulas are "giving" the same result but that doesn't mean they are "behaving" the same way. Since the array supplied is only one, SUMPRODUCT is giving a result which SUM of ARRAY calculated by multiplying each range by 1 which is a lot different than mere adding which SUM does.

So SUM acts as : 1 + 2 + 3 + 4 + 5 = 15
while SUMPRODUCT acts as:1*1 + 2*1 + 3*1 + 4*1 + 5*1 = 15

Instead try it like this and the results will differ:
*Sheet1*


 ABC111302225533355444 555 

 <colgroup> <col style="WIDTH: 30px; FONT-WEIGHT: bold"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"></colgroup> <tbody> 

</tbody>

*Spreadsheet Formulas* 
CellFormulaC1=SUM(A1:A5,B1:B5)C2=SUMPRODUCT(A1:A5,B1:B5)C3=A5*(A5+1)*(2*A5+1)/6

 <tbody> 

</tbody>

 <tbody> 

</tbody>

*Excel  tables to the web >> *Excel Jeanie  HTML 4 

Instead what Fazza has suggested is simple mathematical formula which is used for summing a series of squares of natural numbers and the results match!


----------



## BiocideJ (Aug 17, 2012)

I understand what you are saying, but I was not attempting to say that SUM and SUMPRODUCT were the same, but rather that both can be given a RANGE and that that range is converted to an array of cells in both formulas.

At any rate, I am beginning to derail the thread, so really, the issue at hand then is the question (Is there a way to determine the number without using an 'array' formula where N can be any number.)


It is easy to say that 
=A1*(A1+1)*(2*A1+1)/6 is better, but I don't see how that helps the original question when what really needs to be calculating is...
=A1*(A1+1)*(2*A1+1)*...*(n*A1+1)/6


----------



## taurean (Aug 17, 2012)

Wouldn't it become simpler when we need to multiply the result by 6 (as the original series formula divides by 6)?
=A5*(A5+1)*(2*A5+1)
shall give you the same result.


----------



## drsarao (Aug 18, 2012)

BiocideJ said:


> I understand what you are saying, but I was not attempting to say that SUM and SUMPRODUCT were the same, but rather that both can be given a RANGE and that that range is converted to an array of cells in both formulas.
> 
> At any rate, I am beginning to derail the thread, so really, the issue at hand then is the question (*Is there a way to determine the number without using an 'array' formula where N can be any number.*)
> 
> ...



Is _there _a general formula for _*n*_ without using arrays?

I ended up using array formula because I could *NOT *find a way.

One array formula in a sheet is not going to crash Excel!

But I would still be interested to know if a NON array solution is possible.


----------



## taurean (Aug 18, 2012)

hi drsarao,

See the formula based on Fazza's suggestion works as you want:

Formula in B2 and C2 to be copied down.

*Sheet2*


 ABC1No. of cutsArrayNon-Array21663230304384845418018065330330

 <colgroup> <col style="WIDTH: 30px; FONT-WEIGHT: bold"> <col style="WIDTH: 73px"> <col style="WIDTH: 64px"> <col style="WIDTH: 71px"></colgroup> <tbody> 

</tbody>

*Spreadsheet Formulas* 
CellFormulaB2=SUMPRODUCT(ROW(INDIRECT("$A$1:$A$" & A2))^2)*6C2=A2*(A2+1)*(A2*2+1)

 <tbody> 

</tbody>

 <tbody> 

</tbody>

*Excel  tables to the web >> *Excel Jeanie  HTML 4


----------



## drsarao (Aug 21, 2012)

Taurean,
Thanks for opening my eyes!
Fazza's solution is really elegant. 
I 'thought' it was a 'series' solution with n expressions. And never even checked it out.
Now, I tried (honest) but could not figure it out. (Algebra is not a very strong point for me!)

I would be delighted if Fazza can throw some light. Thanks.

Array solution: would multiply _each _integer upto (and including) the given number X to itself. Sum all and then multiply with 6.

Fazza's solution: X*(X+1)*(2X+1) Can't wrap my brain around it.

What would be the solution if there was no multiplication with 6 at the end?


----------



## taurean (Aug 21, 2012)

Hi drsarao,

Here's one *derivation*. You will see that the actual series is for calculating SUM of SQUARES on one side of the cube. 

The sum of the squares of the first n natural numbers is in its various forms:






So when we had to calculate it for all 6 sides the divisor 6 disappeared.


----------



## BiocideJ (Aug 21, 2012)

That is absolutely brilliant. I am with drsarao that I believed this could only be accomplished with some form of series expression and didn't realize that fazza's initial response wasn't giving that.

Thank you for the enlightenment.


----------



## Fazza (Aug 21, 2012)

Shrivallabha, thank you. Best regards, Fazza


----------



## drsarao (Aug 22, 2012)

taurean said:


> Hi drsarao,
> 
> Here's one *derivation*. You will see that the actual series is for calculating SUM of SQUARES on one side of the cube.
> 
> ...



Plain Nirvana!

Thanks Srivallabha and Fazza.

So the original equation would be: ( X*(X+1)*(2X+1))/6
(multiplying by 6 in fact simplified the equation!)

PS
I honestly _tried _to follow the explanations in Ken Ward's Mathematics Pages. I have bookmarked it for future revisit!


----------

