Print an ascii spiral in O(log n) memory
C, 125 121 bytes
Golfed version This has no variable k. The variable k is used in the ungolfed version just to aid readability. Also for loop conditionals are rearranged and one set of unnecessary {} removed. Another set of {} can be removed by migrating puts(&quot;&quot;) inside the brackets of the j loop in the initialization position, but this would mean a newline at the beginning of the output, so I haven't done it.
f(n){int i,j;n/=2;for(i=-n-2;i++-n-1;){if(i){for(j=-n-1;j++-n;)putchar(32+10*(n+(j*j&lt;i*i?i:j+(i!=j|i&gt;0))&amp;1));puts(&quot;&quot;);}}}

Prints an n wide by n+1 high spiral like the example.
Explanation
Basically I halve the value of n (rounding down) and run two loops: an outer one i from -n/2-1 to n/2+1 to print the rows (i=0 is suppressed so we get n+1 rows) and an inner one j from (-n/2 to n/2 to print the characters.) We use expression &amp; 1 to print stripes, and the condition j*j&lt;i*i to decide whether to print vertical or horizontal stripes (vertical at the sides where absolute magnitude of i is larger, and horizontal at the top and bottom.) An adjustment +n is required to help with the correct termination depending on whether n/2 is odd or even.
k is normally 1, and provides an adjustment for the fact that the absolute values of i range from 1 to n/2+1 while the absolute values of j range from 0 to n/2. If k was always 1 we would get concentric rectangles, but it is inverted to 0 when i==j&amp;i&lt;=0 so that a diagonal row of cells is inverted, producing the spiral.
ungolfed in test program
f(n){
  int i,j,k;
  n/=2;
  for(i=-n-1;i&lt;=n+1;i++){
    if(i){
       for(j=-n;j&lt;=n;j++){
           k=i!=j|i&gt;0;
           putchar(32+10*(n+(j*j&lt;i*i?i:k+j)&amp;1));
         }
       puts(&quot;&quot;);
     }
  }
} 

int m;
main(){
  scanf(&quot;%d&quot;,&amp;m);
  f(m);
}

Output
11
***********
          *
********* *
*       * *
* ***** * *
* *   * * *
* * * * * *
* * *** * *
* *     * *
* ******* *
*         *
***********

9
*********
        *
******* *
*     * *
* *** * *
* * * * *
* *   * *
* ***** *
*       *
*********

3
***
  *
* *
***

1
*
*