This is the preferred way to calculate LED series resistors when using batteries..
Red glow at 1.3V and are rated >=1.6V so if rated at 20mA the .3V rise means the internal ESR= .3V/.02A = 15 ohms
White glow at 2.6 and are rated >3.2V so if rated at 20mA, the .6V rise means the internal ESR= .6/.02= 30 ohms
But if using a high power Red rated at 2V @300mA , ESR is (2-1.3)/.3 =2.33 ohms
Keep in mind the battery also has an ESR so voltage drops as more current is drawn , deltaV/deltaI=ESR
Simple way is to match LEDs to battery and add up all the ESR's.
for RED 5mm LED rated at 20mA
consider 9V new alkaline battery as 9.5V with ESR = 1ohm
A series string of 7 LED's
9.5V - 7*1.3V - I(7*ESR(led))+ ESR(bat))=0 neglect ESRbat. in this case as it it much much lower,
I=0.4V/(7*15R) ~ 4mA which is dim (25%max)
So you can power 4 parallel strings to use up 28 LEDs and have 2 spare and no external series resistor the current will reduce to zero when the battery reaches 9.1V at which point it still has some 50% capacity.
So consider a string of 6.
again using the dim threshold for Red
9.5-6*1.3 = 1.7V for full 20mA you need a series resistance of 1.7V/0.02A=85 Ohm but recall the Red Leds are 15 Ohms ESR so 6*15=90 Ohm means again you don't need to add a series resistor unless your battery new is actually higher than 9.5V like 9.6, so some variance can be expected.
Now with 30LEDs you would use a 5P6S config. with no Rs in series.
Dont try anything less than a string of 5 unless you add a series resistor..