There are one thousand 1x1x1 cubes in a 10x10x10 cube. If we took a can of spray paint, and completed painted the entire outside of the larger cube, how many smaller cubes will have paint on them?

Total # of cubes: 1000

# of small cubes with 3 sides painted: 8

# of small cubes with 2 sides painted: 8 *12 = 96

# of small cubes with 1 side painted: 8 * 8 * 6 = 384

static public int numberOfCubePaint(int n) {

if (n==0) return 0;

else if (n==1) return 1;

else

return 8+(12 * (n-2))+((n-2)*(n-2)*6);