Lucky numbers are numbers generated by a sieving process described in 'Notes and Credits'. They were first put forward in a paper called 'On certain sequences of integers defined by sieves' by V. Gardiner, R. Lazarus, N. Metropolis and S. Ulam. This program asks you for a number, and then tells you all the lucky numbers up to and including that number by applying the sieve shown below. It will ask you for a number if you press the space bar or hit the green flag.
To make lucky numbers, take all the numbers. In this case we will only consider numbers to 20: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Then, take the first number after 1, here 2. Eliminate every second number, the even numbers: 1 3 5 7 9 11 13 15 17 19 Then take the the next number after 1, 3. We eliminate every third number from the ones we have here: 1 3 7 9 13 15 19 We have already done 3, so we move on to 7. We eliminate every second number: 1 3 7 9 13 15 We would then move on to 9. But we only have 6 numbers, so here we stop. Therefore 1, 3, 7, 9, 13 and 15 are all the lucky numbers below 20.