Divisor skyline

Jelly, 9 bytes

Uses 0 instead of #.

RÆD0ṁz⁶ṚY

Try it online!


Octave, 41 40 32 bytes

Thanks to @StewieGriffin saved 8 bytes.

@(N)" #"(sort(~mod(k=1:N,k'))+1)

Try it online!

Previous answers:

@(N)" #"(sort(~bsxfun(@mod,k=1:N,k')+1))

Try it online!

@(N)" #"(sort(ismember((k=1:N)./k',k))+1)

Try it online!

Explanation:

N=5;
d = (1:N)./(1:N)'    %divide each of numbers from 1 to N by 1 to N 
                     %a [N by N] matrix created
d =

   1.00   2.00   3.00   4.00   5.00
   0.50   1.00   1.50   2.00   2.50
   0.33   0.66   1.00   1.33   1.66
   0.25   0.50   0.75   1.00   1.25
   0.20   0.40   0.60   0.80   1.00

m = ismember(d,1:N)      %find divisors of each number
m =

  1  1  1  1  1
  0  1  0  1  0
  0  0  1  0  0
  0  0  0  1  0
  0  0  0  0  1

idx = sort(m)                  %sort the matrix

idx =

  0  0  0  0  0
  0  0  0  0  0
  0  0  0  1  0
  0  1  1  1  1
  1  1  1  1  1

" #"(idx+1)     %replace 0 and 1 with ' ' and '#' respectively

                                                                                                          
   #
 ####
#####

C, 99 95 92 91 90 bytes

c,l,i,j;f(n){for(j=n;j--;puts(""))for(i=0;i<n;c=!putchar(32|c>j))for(l=++i;l;c+=i%l--<1);}

See it work here.