mAh is a pretty useless number, unfortunately. Capacity of a battery or cell is more useful when described as Watt hours. If we accept that there are 12,000mAh in a D cell, that equates to about 14.4 Watt Hours per cell. Multiplied by 4 cells, you have about 57.6 watt hours of capacity. You'll never get every last watt out of a battery or cell, so lets say there are about 45 usable watt-hours of capacity there.
The forward voltage of the LEDs is a very important number in this equation. If they are white LED's, we can assume a Vf of about 3.2V. If each LED is pushed to 20mA, than each LED consumes (.020 * 3.2) .064 Watts. 20 LEDs will consume 1.28 Watts. If you had a 100% efficient method of driving the LEDs, than those 4 D cells could power those LEDs for 35 Hours. Since there is no known circuit that can regulate power with 100% efficiency, we must assume that there will be some loss. A pretty decent SMPS will give you about 90% efficiency, so it's really more like 31.9 Hours. With 6 Hours On, 18 Hours off, You'll get about 5.3 Days.
You mention a resistor, so I'm assuming you're planning on not using an SMPS, and instead direct driving the LEDs using a current limiting resistor. This is a horrible idea for many reasons.
1) yes, the resistor burns energy, and it's burn rate must be considered and will subtract from the number of hours that the LEDs can be lit for
2) Alkaline and NiMh cells change voltage over their charge cycle, and the LEDs will be much brighter when first powered up than they will be after the cells burn down
3) there is no way to get even 80% of the Watt Hours out of the cells by direct driving the LEDs. A SMPS can discharge the batteries much further because it can continue to power the LEDs as the voltage sags.
4) If you are going to drive the LEDs in parallel, each LED will be a different brightness and will get a different amount of current depending on it's exact Vf. This can be quite significant.