<small>Note that in the following explanation list indices are assumed to start at ''one''.</small>

;Definition of lucky numbers
''[[wp:Lucky number|Lucky numbers]]'' are positive integers that are formed by:

# Form a list of all the positive odd integers > 0<br><math>1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39 ...</math>
# Return the first number from the list (which is '''1''').
# <small>(Loop begins here)</small>
#* Note then return the second number from the list (which is '''3''').
#* Discard every third, (as noted), number from the list to form the new list<br><math>1, 3, 7, 9, 13, 15, 19, 21, 25, 27, 31, 33, 37, 39, 43, 45, 49, 51, 55, 57 ...</math>
# <small>(Expanding the loop a few more times...)</small>
#* Note then return the third number from the list (which is '''7''').
#* Discard every 7<sup>th</sup>, (as noted), number from the list to form the new list<br><math>1, 3, 7, 9, 13, 15, 21, 25, 27, 31, 33, 37, 43, 45, 49, 51, 55, 57, 63, 67 ...</math>
#* Note then return the 4<sup>th</sup> number from the list (which is '''9''').
#* Discard every 9<sup>th</sup>, (as noted), number from the list to form the new list<br><math>1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 45, 49, 51, 55, 63, 67, 69, 73 ...</math>
#* Take the 5<sup>th</sup>, i.e. '''13'''.  Remove every 13<sup>th</sup>.
#* Take the 6<sup>th</sup>, i.e. '''15'''.  Remove every 15<sup>th</sup>.
#* Take the 7<sup>th</sup>, i.e. '''21'''.  Remove every 21<sup>th</sup>.
#* Take the 8<sup>th</sup>, i.e. '''25'''.  Remove every 25<sup>th</sup>.
# <small>(Rule for the loop)</small>
#* Note the <math>n</math><sup>th</sup>, which is <math>m</math>.
#* Remove every <math>m</math><sup>th</sup>.
#* Increment <math>n</math>.

;Definition of even lucky numbers
This follows the same rules as the definition of lucky numbers above ''except for the very first step'':
# Form a list of all the positive '''even''' integers > 0<br><math>2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40 ...</math>
# Return the first number from the list (which is '''2''').
# <small>(Loop begins here)</small>
#* Note then return the second number from the list (which is '''4''').
#* Discard every 4<sup>th</sup>, (as noted), number from the list to form the new list<br><math>2, 4, 6, 10, 12, 14, 18, 20, 22, 26, 28, 30, 34, 36, 38, 42, 44, 46, 50, 52 ...</math>
# <small>(Expanding the loop a few more times...)</small>
#* Note then return the third number from the list (which is '''6''').
#* Discard every 6<sup>th</sup>, (as noted), number from the list to form the new list<br><math>2, 4, 6, 10, 12, 18, 20, 22, 26, 28, 34, 36, 38, 42, 44, 50, 52, 54, 58, 60 ...</math>
#* Take the 4<sup>th</sup>, i.e. '''10'''.  Remove every 10<sup>th</sup>.
#* Take the 5<sup>th</sup>, i.e. '''12'''.  Remove every 12<sup>th</sup>.
# <small>(Rule for the loop)</small>
#* Note the <math>n</math><sup>th</sup>, which is <math>m</math>.
#* Remove every <math>m</math><sup>th</sup>.
#* Increment <math>n</math>.

;Task requirements
* Write one or two subroutines (functions) to generate ''lucky numbers'' and ''even lucky numbers'' 
* Write a command-line interface to allow selection of which kind of numbers and which number(s). Since input is from the command line, tests should be made for the common errors:
** missing arguments
** too many arguments
** number (or numbers) aren't legal
** misspelled argument ('''lucky''' or '''evenLucky''')
* The command line handling should:
** support mixed case handling of the (non-numeric) arguments
** support printing a particular number
** support printing a range of numbers by their index
** support printing a range of numbers by their values
* The resulting list of numbers should be printed on a single line.

<br>The program should support the arguments:
<pre>
                             what is displayed  (on a single line)
       argument(s)              (optional verbiage is encouraged)
  ╔═══════════════════╦════════════════════════════════════════════════════╗
  ║  j                ║  Jth       lucky number                            ║
  ║  j  ,      lucky  ║  Jth       lucky number                            ║
  ║  j  ,  evenLucky  ║  Jth  even lucky number                            ║
  ║                   ║                                                    ║
  ║  j  k             ║  Jth  through  Kth (inclusive)       lucky numbers ║
  ║  j  k      lucky  ║  Jth  through  Kth (inclusive)       lucky numbers ║
  ║  j  k  evenLucky  ║  Jth  through  Kth (inclusive)  even lucky numbers ║
  ║                   ║                                                    ║
  ║  j -k             ║  all       lucky numbers in the range  j ──► |k|   ║
  ║  j -k      lucky  ║  all       lucky numbers in the range  j ──► |k|   ║
  ║  j -k  evenLucky  ║  all  even lucky numbers in the range  j ──► |k|   ║
  ╚═══════════════════╩════════════════════════════════════════════════════╝
                           where    |k|    is the absolute value of   k
</pre>
Demonstrate the program by:
* showing the first twenty ''lucky'' numbers
* showing the first twenty ''even lucky'' numbers
* showing all ''lucky'' numbers between 6,000 and 6,100 (inclusive)
* showing all ''even lucky'' numbers in the same range as above
* showing the 10,000<sup>th</sup> ''lucky'' number (extra credit)
* showing the 10,000<sup>th</sup> ''even lucky'' number (extra credit)

;See also:
* This task is related to the [[Sieve of Eratosthenes]] task.
* OEIS Wiki [http://oeis.org/wiki/Lucky_numbers Lucky numbers].
* Sequence [https://oeis.org/A000959 A000959 lucky numbers] on The On-Line Encyclopedia of Integer Sequences.
* Sequence [https://oeis.org/A045954 A045954 even lucky numbers or ELN] on The On-Line Encyclopedia of Integer Sequences.
* Entry [http://mathworld.wolfram.com/LuckyNumber.html lucky numbers] on The Eric Weisstein's World of Mathematics.<br><br>

