These Primes of Mine Are Always Solid Lines Let's create a N×N grid of spaces and underscores that can be used to visually determine if a number is prime. (N may be any positive integer.)
This grid has three simple rules:

The nth column contains the repeated pattern of n - 1 underscores followed by one space. This pattern starts at the first row and is stopped, possibly mid-pattern, at row N. (Rows and columns are 1-indexed.)
The first column is replaced with all underscores instead of all spaces.
If a space occurs somewhere the row index equals the column index it is replaced with an underscore.

Example: N = 10
           1
  1234567890 &lt;-- column indices
 1__________
 2__________
 3__________
 4_ ________
 5__________
 6_  _______
 7__________
 8_ _ ______
 9__ _______
10_ __ _____
 ^ row indices

The indices are just for clarity. The plain grid itself (what your program must output) is:
__________
__________
__________
_ ________
__________
_  _______
__________
_ _ ______
__ _______
_ __ _____

Notice that:

The first column is all underscores.
The second column goes underscore space, underscore space, etc., except for the underscore on row 2.
The third column goes underscore underscore space, underscore underscore space, etc., except for the underscore on row 3.
etc.

Also notice that besides 1, only prime numbered rows have underscores in every column.
Since underscores span the entire font width, each prime numbered row forms a continuous solid line. So checking if a number is prime or not is quite easy visually; just check if its line is solid across all columns. (In fact looking up to the square root of the row index suffices but outputting that grid seems less elegant.)
Program
Write a program that will draw these grids given N via stdin (or closest alternative). Output goes to stdout (or closest alternative) and should only contain spaces, underscores, and newlines, with an optional trailing newline.
The shortest code wins.
CJam, 33 28 27 bytes

q~,:)_f{f{md\1=+'_S?}0'_tN}


Try it online.

How it works

q~        " Read one line from STDIN and evaluate it.                                     ";
,:)       " For “N”, push [ 1 ... N ].                                                    ";
_         " Push a copy.                                                                  ";
f{        " For each “I in [ 1 ... N ], push “I   [ 1 ... N ]”; then:                     ";
  f{      " For each “J in [ 1 ... N ], push “J   I”; then:                               ";
    md\   " Push “J % I   J / I”.                                                         ";
    1=+   " Calculate “J % I + (J / I == 1)”.                                             ";
    '_S?  " Push an underscore if the result is truthy and a space otherwise.             ";
  }       "                                                                               ";
  0'_t    " Replace the first character of the resulting array by an underscore.          ";
  N       " Push a newline.                                                               ";
}         "                                                                               ";


Example run

$ cjam solid-primes.cjam &lt;&lt;&lt; 10
__________
__________
__________
_ ________
__________
_  _______
__________
_ _ ______
__ _______
_ __ _____
$ cjam solid-primes.cjam &lt;&lt;&lt; 100 | md5sum # trailing newline
e4396b316989813dada21141b569ccf9  -