High energy cost of LED lighting is a key factor limiting big-scale plant factory production. In this paper, through optimal control computations, LED light intensity in a plant factory is optimized over time for different electric energy prices and lettuce crop prices. The dynamics of lettuce growth is considered by modifying a greenhouse lettuce growth model. Next, the modified dynamic model is calibrated through the experiment. The dynamic lettuce growth model, like most growth models, does not contain a mechanism that reflects the need for dark periods for proper growth. These are therefore enforced by disabling LED lighting during certain periods at night. Optimal control computations predict the profitability of plant factory production. Moreover, the optimal LED light intensity can be used in the actual production process. The optimal control computations reveal the influence of electric energy price and crop price on the profitability of growing lettuce in a plant factory. This information is highly valuable to growers, legislators, and governments.