You left out education in your function, which I think is paramount to hard work & talent & luck. The education will give you direction, which is an input into your hard work and the catalyst for the discovery of your natural talents.
The reason why programmers are worth so much isn't as much about the value they deliver. It's true -- it can be very profitable. However, software developers are scarce in nature because of the education needed to write code.