How this is calculated. The resistor drops whatever the LEDs do not:
R = (Vsupply − n·Vf) / I. An LED is a diode, not a resistor —
its forward voltage barely moves while its current changes enormously, so the series resistor is
what actually sets the current. That is also why
LEDs in parallel should each have their own
resistor: share one and the LED with the lowest V
f hogs the current and runs hot.
Forward voltage depends on colour and current — roughly 1.8–2.2 V for red, 3.0–3.4 V for blue
and white — and it falls as the die warms, so check the datasheet curve rather than trusting a
single number. Keep at least a volt or so across the resistor: with too little headroom, normal
part-to-part V
f spread swings the current wildly.
There is very little voltage left across the resistor. Normal variation in LED forward voltage will swing the current far more than you expect — raise the supply, drop an LED from the string, or use a constant-current driver.