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?

Leave a answer Cancel reply

Notice: It appears you have actually Javascript disabled in your Browser. In stimulate to send a comment to this post, please create this code along with your comment: a063f175e4cecbce1dec023286e3c107


\"*\"
Free $25 credit when you sign up v Vultr Cloud VPS (10 month Giveaway!)Free $20 credit once you authorize up v Linode Cloud VPS (4 months Giveaway!) - (Promotional Code: PodcastInIt2018)Free $10 credit once you authorize up through DigitalOcean Cloud VPS (2 months Giveaway!)Free $10 credit once you sign up with Aliyun Cloud VPS (2 months Giveaway!)Get more promotion transaction by using VPS Database and VPS search Tool

\"*\"
Coding because that Speed


This domain is hosted proudly top top QuickHostUK & Namesilo Domain
\"*\"
Free $25 credit as soon as you authorize up with Vultr Cloud VPS (10 month Giveaway!)Free $20 credit when you authorize up with Linode Cloud VPS (4 months Giveaway!) - (Promotional Code: podcastinit2018)Free $10 credit as soon as you sign up v DigitalOcean Cloud VPS (2 months Giveaway!)Free $10 credit as soon as you sign up through Aliyun Cloud VPS (2 month Giveaway!)Get an ext promotion transaction by using VPS Database and VPS search Tool