Fibonacci Spiral
APL, 23
{a,⍴⍨2⍴⊃⍴a←⌽⍉⍵}⍣(⎕-1)⍪1
Explanation:
⍪1 this creates a 1x1 matrix containing just 1
{..}⍣(⎕-1) the power operator (⍣) repeats the function {} user input - 1 times
a,⍴⍨2⍴⊃⍴a←⌽⍉⍵ the function being iterated rotates the matrix and appends the next matrix to it.
Try it on tryapl.org
Matlab, 84 bytes
A function is used. Output is in stdout.
function f(N)
s=0;t=1;y=1;for n=2:N
u=s+t;s=t;t=u;y=[rot90(y) t*ones(t)];end;disp(y)
Examples:
>> f(1)
1
>> f(2)
1 1
>> f(3)
1 2 2
1 2 2
>> f(6)
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
3 3 3 1 1 8 8 8 8 8 8 8 8
3 3 3 2 2 8 8 8 8 8 8 8 8
3 3 3 2 2 8 8 8 8 8 8 8 8
>> f(7)
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
8 8 8 8 8 8 8 8 13 13 13 13 13 13 13 13 13 13 13 13 13
5 5 5 5 5 1 2 2 13 13 13 13 13 13 13 13 13 13 13 13 13
5 5 5 5 5 1 2 2 13 13 13 13 13 13 13 13 13 13 13 13 13
5 5 5 5 5 3 3 3 13 13 13 13 13 13 13 13 13 13 13 13 13
5 5 5 5 5 3 3 3 13 13 13 13 13 13 13 13 13 13 13 13 13
5 5 5 5 5 3 3 3 13 13 13 13 13 13 13 13 13 13 13 13 13
Matlab, 78 bytes
function y=f(N)
s=0;t=1;y=1;for n=2:N
u=s+t;s=t;t=u;y=[rot90(y) t*ones(t)];end
Same as above except a Matlab's feature is exploited, namely, it automatically displays function output (as a string) in stdout. This avoids the conversion to string in the above approach.
f(6)
ans =
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
5 5 5 5 5 8 8 8 8 8 8 8 8
3 3 3 1 1 8 8 8 8 8 8 8 8
3 3 3 2 2 8 8 8 8 8 8 8 8
3 3 3 2 2 8 8 8 8 8 8 8 8
Ruby, 243 242 236 233 222 170 130 bytes
s,l,r=0,1,[]
gets.to_i.times{s+=l
l=s-l
s.times{r<<[s]*s}
r=r.transpose.reverse}
r.map{|w|puts w.map{|c|"%#{s.to_s.size}s"%c}*" "}