While playing one day, Thomas decided to build larger cubes out of a box of individual sugar cubes. So, emptying out the box onto the floor and using the sugar cubes as if they were building blocks, Thomas made three larger, solid cubes, with no sugar cubes left over.
At this point the family dog bounded into the room and sent the sugar cubes flying in all directions. The dog then picked up one of the sugar cubes in his mouth and left, crunching noisily.
Knowing he would be blamed for the mess if he didn't clean it up, Thomas picked up the remaining sugar cubes. Once he had done this, however, the temptation to keep playing with them proved too strong, and he began building again. This time he built two cubes rather than three, and again no sugar cubes were left over.
What is the smallest number of sugar cubes that could have been in the box when Thomas started playing with them?
i found the answer somewhere but i do not know how to approach this problem