Efficient way to generate a variable

In reply to mr_2020:

What does O(n) and O(1) mean?