Number List Generators

Sometimes a person needs an accurate list of numbers. I ran into this when I had to print out hundreds of equipment identification labels for my company. The human brain is such, for most of us, that after writing about 200 of these in a row, it gets bored and takes a little break. ["What did she really mean when she said that the other day?"] When it comes back to the job, there's an error.

Here are a couple solutions to the problem. In each you control the start number, the size of the step (increment), and the end number. The first uses a PC DOS "FOR" command. The FOR command is limited to integers. The second way uses a little Javascript that is hiding in this webpage, and might work on a Mac. The embedded Javascript is what generated the list from 1 to 100 at the bottom of the page. If you are trying for fractional steps the DOS way doesn't work; try the Browser Way.

I. The DOS way:

  1. In Windows, open a DOS Command Prompt window. [Start > Run > "cmd" (no quotes) > <ENTER>] OR [Start > All Programs > Accessories > Command Prompt]
    This gives you the black DOS box.
  2. Go to a congenial directory, we'll say C:\ [How? Type "cd \" without the quotes, then <ENTER>] (Suggested move: Type "doskey" without the quotes, then hit <ENTER>. This will make reentering command lines easy.)
  3. Enter your command line. E.G.: To produce a text file with all the integers in order from 1 to 2000, and have the file named "List2000.txt" your command line would look like this:
    C:\>for /L %i in (1,1,2000) do @echo %i >>List2000.txt
    The three integers (no fractions!) within the parentheses are start, step, and end numbers. Here we start with 1, go by steps of 1, till we hit 2000, and write the file.
  4. Hit <ENTER>. The computer chugs for a few seconds, and generates the file.
  5. E.G.: To go backwards from 100 to 0 by 2s, the command line would read:
    C:\>for /L %i in (100,-2,0) do @echo %i >>List-100a.txt
  6. When you get one that works (no typos), you're home free. If you ran "doskey" in step 2, you can hit the up arrow to make DOS retype your last command. Use the right and left arrow keys to move the cursor to where you want it, input new values, and whack <ENTER> when ready.

II. The Browser Way:

  1. First, right click anywhere in the body of this page and select "View Source" or "View Page Source." Then save this HTM file to your hard drive. Open the file in a text editor like Notepad and plug in three values:
  2. Where it says "var startnum = ", plug in the number you want to start from, like 1 (or -567923, or 11162345, or whatever).
    At "var endnum = ", plug in the number where you want to end.
    At "var incnum = " plug in the amount you want to increment by (that is, the step number).
  3. So if you need a list of numbers (integers) from 1 to 2000 for example, you end up with:
    var startnum = 1;
    var endnum = 2000;
    var incnum = 1;
  4. Save the file as "whatever.htm" and remember where it is.
  5. Then open the file with your browser. Presto. There's your list of numbers from 1 to 2000, where you can have your way with it. Select; copy; paste; go to town!
  6. Notes:
    1. If you plug in values intending to generate a big batch of numbers (like ten thousand or more), your computer may complain that a script is causing the system to run slowly, and do you want to stop the script? Don't stop it. Wait a few seconds and your number list will appear.
    2. The Javascript is set up to go from lower numbers to higher, only.
    3. You can start with a negative number. Just make sure that the end number is higher than the start number.
    4. If you increment by many fractions, like .2, .3, .6, you get some weird stuff, micro fractions, in the output.

Neither of these is the most user-friendly solution in the world, but they get the job done.