length*width*colors isn't right. You are finding the area, then multiplying by the total possible colors. That is the number of times when all pixels are the same color. You're leaving out all else. It would, in fact, be much larger: 16,777,215^(256*256). It's so huge, I don't even want to post it here, because of it's massiveness would span a couple pages.