Abstract: An LED lamp includes a rectifier, an integrated circuit and a string of series-connected LEDs. The lamp receives an incoming AC signal such that a rectified version of the signal is present across the LED string. The integrated circuit includes a plurality of power switches. Each power switch is coupled so that it can separately and selectably short out a corresponding one of several groups of LEDs in the string. As the voltage across the string increases the integrated circuit controls the power switches such that the number of LEDs through which current flows increases, whereas as the voltage across the string decreases the integrated circuit controls the power switches such that the number of LEDs through which current flows decreases. LED string current flow is controlled and regulated to provide superior efficiency, reliability, anti-flicker, regulation against line voltage variations, power factor correction, and lamp over-voltage, over-current, and over-temperature protection.