justfred

A 4x4x4 cube has 64 LEDs; but I believe can be driven with 12 pins (4row + 4column + 4layer) if you wire it properly; it's a lot easier to wire with 20 pins (4x4 matrix + 4layer); my 3x3x3 uses 12 pins (3x3matrix + 3layer) - a lot easier to wire and only "costs" 3 pins more. Though, I'm trying to imagine the schematic and it's blowing my mind. In theory, you could do a 5x cube with only 15 pins.

Delta

The MAX7219 can control 64 leds with one chip and only uses 3 pins on the arduino. More info is available in the playground on how to use it and either the matrix or ledcontrol libraries. I've been using these and the ledcontrol library in particular does everything I want.