A Rubik cube usually have 6 sides. Take 3×3 rubik cube because that example, each side has actually 9 tiny squares (1×1), 4 tool squares (2×2) and also 1 large square (3×3). Therefore, there are 6 x (9 + 4 + 1) = 84 squares top top a 3×3 rubik cube.

You are watching: How many squares on a rubik cube

rubik-cube-3×3

How around counting the rectangles? the is a bit tough to count. Let’s write a function to counting it. The algorithm is to bruteforce a pair of clues (from optimal left edge to the best bottom). Then us compute the two sides the the rectangle to view if it is a square.

 123456789101112131415161718192021 function countSquaresAndRectangles(N) let squares = 0; let rectangles = 0; because that (let a = 0; a N; a ++) because that (let b = 0; b N; b ++) because that (let c = a + 1; c N; c ++) because that (let d = b + 1; d N; d ++) if (d - b === c - a) squares ++; rather rectangles ++; return <6 * squares, 6 * rectangles>;let ans = countSquaresAndRectangles(3);console.log(\"There room \" + ans<0> + \" squares, and \" + ans<1> + \" rectangles.\");

There room 84 squares, and also 132 rectangles in a 3×3 rubik cube. Because that a 7×7 rubik cube, it will certainly be hard to count. Yet the computer systems are really good at it (in fact, the over Javascript code runs quite fast, for a tiny N).

See more: How Much Is A 1898 Penny Worth, 1898 Indian Head Cent rubik-cube-7×7

There room 840 squares, and also 3864 rectangles for a 7×7 rubik cube.

–EOF (The Ultimate computing & technology Blog) —

382 wordsLast Post: find the 10001st element Number following Post: exactly how to usage Priority Queue in Java or C++ come Compute Last rock Weight? ### Coding because that Speed 