text:
Visually Explain the Pythagorean Theorem
A common visual explanation of the Pythagorean theorem is as such:

The squares are meant to represent the side length's squared, and the areas of a + b = c, just like the Pythagorean theorem says.
This part is what you have to show.
Your task

You will get two integers as input, meant to represent sides a and b of a right triangle (ex. 3, 4).
You will then make squares out of the lengths a, b, and c out of the # character. For example here is 3:

###
###
###

You will then format these into a math equation that explains the particular Pythagorean triplet:

             #####
      ####   #####
###   ####   #####
###   ####   #####
### + #### = #####

Notice how the = and + signs have spaces on both sides and how everything is on the bottom.
You will never get values for a and b that make c non-integral.
This is code-golf so shortest code in bytes wins!

Test Cases
(more coming once I have time, these are really hard to make by hand)
3, 4
             #####
      ####   #####
###   ####   #####
###   ####   #####
### + #### = #####

6, 8
                    ##########
                    ##########
         ########   ##########
         ########   ##########
######   ########   ##########
######   ########   ##########
######   ########   ##########
######   ########   ##########
######   ########   ##########
###### + ######## = ##########

4, 3
             #####
####         #####
####   ###   #####
####   ###   #####
#### + ### = #####

5, 12
                       #############
        ############   #############
        ############   #############
        ############   #############
        ############   #############
        ############   #############
        ############   #############
        ############   #############
#####   ############   #############
#####   ############   #############
#####   ############   #############
#####   ############   #############
##### + ############ = #############

What about inputs where the third number would not be an integer? For example, given inputs of 1 and 1, the third side would be sqrt(2).

@bmarks "You will never get values for a and b that make c non-integral."

Is b going to always be larger than a?

@vihan nope, adding that to the tests

a + b = c? I don't think that was the result Pythagoras came up with...

@RetoKoradi well the areas of the squares a+b=c

If a, b and c are defined as the areas of the squares, then the examples are incorrect.

You should add another nice test case, like 5 + 12 = 13.

@mbomb007 I will now that I have my reference solution, yayyy ^.^

Note: this is not "a visual explanation of the Pythagorean theorem". This is the Pythagorean theorem. It was originally formulated exactly this way: geometrically. They didn't even know about square roots, even more interesting, Pythagoras himself didn't believe in the existence of irrational numbers. This means Pythagoras thought that sqrt(2) can be exactly represented by the division of two finite integers. The original theorem is what we now call the "visual representation"

@vsz Actually, based on my understanding - the Pythagoreans would have realized that there are no integers whose ratio is sqrt(2).  From this, they would have concluded that sqrt(2) does not exist.  In other words, they would have thought it is impossible to draw a line of length sqrt(2).  The Pythagorean theorem apparently caused problems, because they knew how to construct a right triangle with sides 1,1,x.  The Pythagorean theorem showed that x=sqrt(2) actually exists.  Legend has it they drowned the person who discovered this and then swore everyone to secrecy.

Can we use a different character instead of #? What about leading/trailing whitespace?

Pyth, 35 32 31 30 bytes
j_.ts.i.imm*d\#d+Qs.aQ"+="mk4d

Try it online.

You can save a byte by using .i to add the blank lines instead: j_.ts.i.imm*d\#d+Qs.aQ"+="mk4d

CJam, 49 bytes
" +   = "S/3/[q~_2$mh:H]_'#f*:a.*.\:+SH*f.e|zW%N*

Try it online in the CJam interpreter.
How it works
" +   = "S/3/ e# Split at spaces, then into chunks of length 3.
              e# This pushes [["" "+" ""] ["" "=" ""]].
[             e#
  q~          e# Read and interpret all input from STDIN.
  _2$         e# Copy both integers.
  mh          e# Calculate the hypotenuse of the triangle with those catheti.
  :H          e# Save the result in H.
]             e# Collect catheti and hypotenuse in an array.
_'#f*         e# Copy and replace each length with a string of that many hashes.
:a            e# Wrap each string in an array.
.*            e# Vectorized repetition. Turns strings into square arrays.
.\            e# Interleave with the string of operators.
:+            e# Concatenate to form an array of strings.
SH*           e# Push a string of spaces of length H.
f.e|          e# Mapped vectorized logical OR; pads all strings with spaces to
              e# length H.
zW%           e# Zip and reverse; rotates the array.
N*            e# Join the strings, separating by linefeeds.

JavaScript ES6, 155 134 140 129 bytes
(n,m)=>eval("for(o='',q=(b,s)=>' #'[z<b|0].repeat(b)+(z?'   ':s),z=i=Math.hypot(n,m);z--;)o+=q(n,' + ')+q(m,' = ')+q(i,'')+`\n`")

I've rewritten this with for. Lots of golfing still...
If something isn't working, let me know. I'll fix it in the morning.
Tested on Safari Nightly
Ungolfed:
(n,m)=>
   Array(
     z=Math.hypot(n,m)
   ).fill()
   .map((l,i)=>
      (q=(j,s)=>
        (z-i<=j?'#':' ')
        .repeat(j)+
         (z-i-1?' ':s)
      )
      (n,`+`)+
      q(m,`=`)+
      q(z,'')
   ).join`
   `

Explanation:
(Not updated) but still accurate enough.
(n,m)=> // Function with two arguments n,m
   Array( // Create array of length...
    z=Math.hypot(n,m) // Get sqrt(n^2+m^2) and store in z
   ).fill() // Fill array so we can loop
   .map((l,i) => // Loop z times, take l, and i (index)
     (q=j=>( // Create function q with argument j
      z-i<=j? // If z-i is less than or equal to j...
        '#' // Use '#'
      : // OR
        ' ' // Use space
      ).repeat(j) // Repeat the character j times
     )(n) // Run with n
   + // Add to string
   ` ${ // Space
      (b=z-i-1)? // If this isn't the last line...
       ' ' // Return ' '
      : // Otherwise
       '+' // Plus
    } ${ // Space
      q(m) // run function q with arg m
    } ${ // Space
      b? // If b
       ' ' // Return space
      : // Otherwise
        '=' // '='
    }` + // Add to...
    '#'.repeat(z) // Repeat hashtag, z times
  ).join` // Join the new array with new lines
  `

DEMO
ES5 version Input must be valid sets of numbers:

function _taggedTemplateLiteral(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var _templateObject=_taggedTemplateLiteral(["\n"],["\n"]),t=function(e,t){return Array(z=Math.sqrt(e*e+t*t)).fill().map(function(r,n){return(q=function(e,t){return(z-n<=e?"#":" ").repeat(e)+(z-n-1?" ":t)})(e,"+")+q(t,"=")+q(z,"")}).join(_templateObject)};
// Demo
document.getElementById('go').onclick=function(){
  document.getElementById('output').innerHTML = t(+document.getElementById('input').value,
                                                 +document.getElementById('input2').value)
};

Visually Explaining the Pythagorean Theorem

<input placeholder="Number 1" style="resize:none;border:1px solid #DDD;" id="input"><input placeholder="Number 2" style="resize:none;border:1px solid #DDD;" id="input2"><button id='go'>Run!</button>

Output:

+1, but there's a small issue as the OP says: "Notice how the = and + signs have spaces on both sides and how everything is on the bottom."

The snippet isn't working on Firefox 40.0.3 (Windows 7x64 SP1).

Snippet not working in Chromium 44 Linux x64

@IsmaelMiguel You need to make sure the numbers you're entering are valid, otherwise this won't work.

This works with 3,4, 4,3 and 5,12, but not with 3,5, 5,3, 4,5, 5,4 and similars. I think this was example-driven: only works with the values on the examples.

@IsmaelMiguel Those latter cases aren't necessary to handle correctly, though: "You will never get values for a and b that make c non-integral."

The blank separation is 3 spaces, not 1

@edc65 I've updated the code but not the demo yet

+1 nice use of eval. Hint: (z ' #'[za]*a," +"[i<2],"# "[i>b]*b," ="[i<2],"#"*c;i-=1

Try it online.
The program takes input as comma-separated integers, calculates the hypotenuse using Python's built-in complex numbers, then loops down from that value calculating and printing each line as it goes. The main golfing trick is using string indexing in place of conditionals to select #/+/= vs space.
Edit: The first version was a victim of some serious over-engineering--this one is both simpler and much shorter.

I just got the same thing, having taken a while to realize it's shorter to just repeat "# "[i>a]*a instead of doing it for each variable.

Julia, 121 114 112 bytes
f(a,b)=for i=1:(c=isqrt(a^2+b^2)) g(x,t)=(i>c-x?"#":" ")^x*(i<c?"  ":t)" ";println(g(a," +")g(b," =")g(c,""))end

Ungolfed:
function f(a,b)
    # Compute the hypotenuse length
    c = isqrt(a^2 + b^2)

    # Write the lines in a loop
    for i = 1:c
        # Make a function for constructing the blocks
        g(x,t) = (i <= c - x ? " " : "#")^x * (i < c ? "  " : t) " "

        println(g(a," +") g(b," =") g(c,""))
    end
end

Fixed issue and saved 2 bytes thanks to Glen O.

Pyth, 51 49 bytes
AQJs.aQLj*b]*b\#;j_MCm_.[d\ Jcj[yJb\=byHb\+byG))b

Expects input in the form [3,4].
Try it here
AQ - assigns input to G, H
Js.a,GH - calculates hypotenuse as J
Lj*b]*b\#; - defines y(b) as making a square of size b (elsewhere in the code, b means newline)
j_MCm_.[d\ Jcj[yJb\=byHb\+byG))b - Creates the squares, pads with spaces, and transposes
Saved two bytes thanks to Maltysen.

I don't know exactly what your code does, but I'm pretty sure it can benefit from .interlace instead of all those lists.

@Maltysen To your last comment, actually I can't, because the first appearance of J is inside a lambda, which gets evaluated after J is first used.

ah, didn't see that. Another thing: *] can be replaced with m

C, 176 bytes
C is not going to win this, but the fun is worth it.
#define A(x,y)for(j=x;j--;)putchar("# "[i+1>x]);printf(i?"   ":" "#y" ");
i;j;main(a,b,c){for(c=scanf("%d %d",&a,&b);a*a+b*b>c*c;c++);for(i=c;i--;puts("")){A(a,+)A(b,=)A(c,)}}

Pretty printed:
#define A(x,y)for(j=x;j--;)putchar("# "[i+1>x]);printf(i?"   ":" "#y" ");
i;j;
main(a,b,c)
{
    for(c=scanf("%d %d",&a,&b);a*a+b*b>c*c;c++);
    for(i=c;i--;puts(""))
    {
        A(a,+)
        A(b,=)
        A(c,)
    }
}

gcc enables us to pass third parameter to main (an array of environment variables), so we take advantage of it to use it for our purpose.
The
for(c=scanf("%d %d",&a,&b);a*a+b*b>c*c++;);

would be equivalent to
scanf("%d %d",&a,&b);
for(c=2;a*a+b*b>c*c++;);

because scanf returns the number of successfully scaned parameters.

Charcoal, 24 bytes
⊞θ₂ΣＸθ²Ｆ =+«←←←ι←Ｇ↑←↓⊟θ#

Try it online! Link is to verbose version of code. Takes input as an array of two elements. Explanation:
⊞θ₂ΣＸθ²

Append the hypotenuse to the inputs.
Ｆ =+«

Loop over the characters that appear to the right of each square in reverse order.
←←←ι←

Print that character leftwards with spacing.
Ｇ↑←↓⊟θ#

Pop the last number from the array and print a square of #s of that size.

@KevinCruijssen Whoa, what an oversight! Should be fixed now.

Lyxal has a better alternate explanation here. You should totally edit that into your answer.

Ruby, 134
->a,b{c=((a**2+b**2)**0.5).round
c.times{|i|
d=i<c-1?'  ':'+='
puts (c-i>a ?' ':?#)*a+" #{d[0]}  #{(c-i>b ?' ':?#)*b} #{d[1]} "+?#*c}}

simple line by line approach.
Below in test program, with symbol changed to @ to help avoid confusting with the syntax #{....} ("string interpolation") used to insert expressions into a string. Each input should be given on a different line.
f=->a,b{c=((a**2+b**2)**0.5).round
c.times{|i|
d=i<c-1?'  ':'+='
puts (c-i>a ?' ':?@)*a+" #{d[0]}  #{(c-i>b ?' ':?@)*b} #{d[1]} "+?@*c}}

A=gets.to_i
B=gets.to_i
f.call(A,B)

I don't know Ruby, but I'm guessing this can get shorter, since Ruby solutions often beat Python solutions (in my anecdotal experience).  For starters, a*a+b*b should cut two bytes from the computation of c.

APL (Dyalog Extended), 33 29 bytesSBCS
-3 due to my extensions of Dyalog APL.
Anonymous prefix lambda:
{⊖⍕,' +=',⍪{⍵ ⍵⍴⍕#}¨⍵,√+/⍵*2}

Try it online!
{…} "dfn"; ⍵ is the argument (side lengths)
 ⍵*2 square
 +/ sum
 √ square-root
 ⍵, prepend argument
 {…}¨ apply the following anonymous lambda to each
  # root namespace
  ⍕ format as text
  ⍵ ⍵⍴ use argument twice to reshape into matrix with those dimensions.
 ⍪ make into column
 ' ++=', prepend these three characters to the three rows
 , ravel (combine rows into list)
 ⍕ format as text
 ⊖ flip upside-down

PHP, 178 170 168 bytes
Input is GET parameters x and y. Unfortunately I can't seem to golf those repeating strings.
<?php for(@$i=$z=hypot($x=$_GET[x],$y=$_GET[y]),@$s=str_repeat;$i;$i--)@print$s($i<=$x?~Ü:~ß,$x).(($l=$i==1)?~ßÔß:~ßßß).$s($i<=$y?~Ü:~ß,$y).($l?~ßÂß:~ßßß).$s(~Ü,$z).~õ;

Saved 8 bytes by inverting all my strings and dropping the quotes.
Saved 2 bytes by replacing the condition $i>0 with $i

Not sure why PHP doesn't like @echo so I had to sacrifice 1 byte with @print.
In case SE screws up the encoding, this is meant to be encoded in Windows-1252 (not UTF8).

echo vs print. see: https://stackoverflow.com/questions/7094118/reference-comparing-phps-print-and-echo

Ah that makes sense. Thanks!

PowerShell, 139 137 135 bytes
-2 thanks to ASCII-only
-2 thanks to Mazzy
param($a,$b)($c=[math]::sqrt($a*$a+$b*$b))..1|%{(($m=" ","#")[$_-le$a]*$a)," +"[$_-eq1],($m[$_-le$b]*$b)," ="[$_-eq1],("#"*$c)-join" "}

Try it online!
Calculating $c hurt and there's probably a better way to conditionally swap between # and . Builds a list of chunks and joins them together while conditionally adding the signs.

there is a redundant brackets in $m=(" ","#"): Try it online!

@mazzy Ha ha, whoops

Vyxal, L, 47 43 38 bytes (old codepage)
λ\#*wnř;:£f⍎÷ð\+ð?¥f⍎÷ð\=ð??Ķĵ∑√I¥f⍎÷W

This was intense.
Also, according to code-golf's statistics, only a small percentage of people who see my answers actually upvote them. So if you enjoy this answer, consider upvoting, it's free, and you can change your mind at any time (given you have ≥2k rep). Enjoy the answer.
Explained
λn\#*wnř;:£f⍎ðJ\+JðJ?¥f⍎JðJ\=JðJ??Ķĵ∑√I¥f⍎J

λ                                               # Start a lambda that:
 n\#*                                           #   Repeats the character "#" n times THEN
     w                                          #   Wraps that into a stack AND
      nř                                        #   Repeats the list n times
        ;                                       # Close lambda
         :£f                                    # Assign the lambda to variable 'f' leaving an extra copy
            ⍎                                   # Apply that lambda to the first input
             ðJ\+JðJ                            # Append " ", "+" and " " to the result from above
                    ?¥f⍎                        # Apply the lambda to the second input
                        J                       # Add it to the current list
                         ðJ\=Jð                 # Append " ", "=" and " " to the result from above
                               ??Ķ              # Pair the two inputs into a list
                                  ĵ∑            # Square each number and sum the list (a^2 + b^2)
                                    √I          # Square root that number and convert it to an integer
                                      ¥f⍎       # Apply the lambda to that result (c)
                                         J      # And add it to the big list
                                                # The L flag then auto vertical joins the list and outputs it

-1 just because you asked me to upvote

good meming sir

CJam, 78 bytes
q~_2f#~+mQ+ee_2=~e>f{\~@1$-S*\'#*+_'#e=\a*_0=,S*@"+= "=1$,(S*\+1$a\a@a+++~}zN*

It first computes the hypotenuse (H), then, for each side (S), it builds an array of S lines made of: H-S spaces + S dashes. Finally, it transposes the matrix.
Demo

Lua5.2, 257 241 227 222 bytes
r=io.read
a=r"*n"b=r"*n"c=math.sqrt(a^2+b^2)d=a+b
w=io.write
for i=1,c do
for j=0,d+c+5 do
w((j>d+5 or(i>c-b and j>a+2 and j<d+3)or(i>c-a and j<a))and"#"or(i==c and(j==a+1 and"+"or(j==d+4 and"="or" "))or" "))end
w"\n"end

Edit1: Simplified reading
Edit2: Removed more whitespaces
Edit3: aliases abstraction of io functions inspired by another answer

Japt, 28 bytes
Takes input as an array of integers.
pUx²¬)ËÆDç'#
í"+="¬ûR3)c ·z3

Try it
                    :Implicit input of array U=[a,b]
pUx²¬)ËÆDç'#
p                   :Push
 U ²                :  Square each element in U
  x                 :  Reduce by addition
    ¬               :  Square root
     )              :End push
      Ë             :Map each D
       Æ            :  Map the range [0,D)
        Dç'#        :    Repeat "#" D times
í"+="¬ûR3)c ·z3
í                   :Interleave
 "+="¬              :  Split the string "+=" to an array of characters
      û             :  Centre pad each
       R3           :    With newlines to length 3
         )          :End interleave
          c         :Flatten
            ·       :Join with newlines
             z3     :Rotate clockwise 270 degrees

C# (.NET Core), 221, 194 bytes
This feels way too long.  This version just loops to construct the string.
EDIT:  Ascii-Only with a nice -27 byte golf using the string constructor for serial char additions!  Also, ty for pointing out I was using Math.Sqrt not System.Math.Sqrt.  This has been adjusted!
(a,b)=>{int c=(int)System.Math.Sqrt(a*a+b*b),j=c;var s="";while(j>0)s+=new string(j>a?' ':'#',a)+(j>1?"   ":" + ")+new string(j>b?' ':'#',b)+(j-->1?"   ":" = ")+new string('#',c)+"\n";return s;}

Try it online!

remember the ending semicolon isn't needed, and also System.Math not Math if you're not using interactive

211?

187?

One thing, I'd remove all using directives to make sure I didn't make a mistake

Oh and since you no longer have the ternary version I don't think you should mention it anymore

05AB1E, 38 34 bytes
nOtª©Å1'#×ζε®×R„= NĀèð.øý}»R„=+`.;

Takes the input as pair of integers (i.e. [3,4]).
Try it online or verify all test cases.
Explanation:
n            # Take the square of each value in the (implicit) input-list
 O           # Take the sum of that list
  t          # Take the square-root of that sum
   ª         # Append it to the (implicit) input-list
             #  i.e. [3,4] → [3,4,5.0]
    ©        # Store it in the register (without popping)
Å1           # Change each value to an inner list of that amount of 1s
  '#×       '# And then each 1 to a "#"
             #  → [["#","#","#"],["#","#","#","#"],["#","#","#","#","#"]]
     ζ       # Zip/transpose; swapping rows/columns, with space as default filler
             #  → [["#","#","#"],["#","#","#"],["#","#","#"],[" ","#","#"],[" "," ","#"]]
ε            # Map the inner lists to:
 ®           #  Push the list from the register
  ×          #  Repeat the characters that many times
             #   i.e. [" ","#","#"] and [3,4,5.0] → ["   ","####","#####"]
   R         #  Reverse this list
 „=          #  Push string "= "
    NĀ       #  Push the map-index truthified (0 remains 0; everything else becomes 1)
             #   i.e. 0 → 0
             #   i.e. 3 → 1
      è      #  Use it to index into the string
       ð.ø   #  Surround it with spaces
             #   → "=" → " = "
             #   → " " → "   "
          ý  #  Join the map-list together with this string as delimiter
             #   → "#####   ####      "
}»           # After the map, join everything by newlines
             #  → "##### = #### = ###\n#####   ####   ###\n#####   ####   ###\n#####   ####      \n#####             "
  R          # Reverse the string
             #  → "             #####\n      ####   #####\n###   ####   #####\n###   ####   #####\n### = #### = #####"
   „=+`.;    # And replace the first "=" with "+"
             #  → "             #####\n      ####   #####\n###   ####   #####\n###   ####   #####\n### + #### = #####"
             # (after which the the result is output implicitly)

DnOt©)˜ε'#×y.Dðy×®y-.D)R}ø» was my attempt until I noticed the + and =.

@MagicOctopusUrn Yeah, those three spaces and + and = are indeed responsible for the most part of the code. Btw, you can golf 2 bytes in your approach by replacing DnOt©)˜ with nOt©ª, as I did in my current answer. :) I like your use of .D, though.

Perl 6, 99 bytes
{$!=sqrt $^a²+$^b²;flip map({map {[' ','#'][$^d>$_]x$d,' =+ '.comb[!$_*++$ ]},$!,$b,$a},^$!)X"
"}

Try it online!
Anonymous code block that takes two numbers and returns the full string with a leading newline and three leading spaces and one trailing on each line.
If we can use other characters instead of #, then I can save a byte by replacing '#' with \*.

Husk, 36 bytes
↔T' `+₁√ṁ□¹`+C1" = "JC1" + "m₁
SRR'#

Try it online!
This can be made shorter if I can find a good way to add the symbols in.

C (gcc), 122 119 bytes
-3 thanks to ceilingcat
#define P(n);for(i=0;i*i++<n;puts(""))for(j=0;j*j++<n;)putchar(35);puts(
i,j;f(a,b){P(a*a)"+")P(b*b)"=")P(a*a+b*b)"");}

Try it online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
A calculator as a list of numbers and operators
Your task is to take a list of arguments that are either integers or operators, and parse them like so:

There is a current operator, which starts as +.
Each time an operator is found, the current operator will change to it.
The possible operators are: "+", "-", "*", "/", and "%", which correspond to their meanings in C and most languages.
There is a running solution kept, which starts at 0.
Each time an integer is found, the solution is modified by the number depending on the operator; e.g. if the operator is "/" then the solution is divided by the number.
If an operation would result in a mixed number (i.e. with a decimal) then it must be floored back to an integer (i.e. the decimal must be chopped off).
Output the final solution.

For example:
The arguments 5 8 25 * 9 6 2 - 104 / 4 7 + 6 % 14 would result in:
  5 8  25 * 9   6    2    - 104  / 4    7      + 6 % 14
0 5 13 38   342 2052 4104   4000   1000 142   148    8  -> 8

The inputs will be as command-line or function arguments, or an equivalent for your language.
Shortest code wins!

when you say meanings in C do you mean exactly as they do in C, or is it okay if % rounds towards -inf instead of 0?

@Maltysen: Whatever your language does.

Can the integers from input be negative?

Points 3 and 6 contradict each other: in C and most languages, integer division rounds towards zero rather than flooring.

It would be interesting to see another challenge similar to this, but including parenthesis precedence...

Sorry for necro: % is modulo, see OP's example.

Pyth - 24 23 22 20 bytes
2 bytes saved thanks to @issacg and 1 thanks to @orlp!
Uses reduce with base case of 0 and checks for ' being in repr to detect string vs. int.
u.xsv++GbH&=bHG+\+QZ

Does not work online because I use full eval which is disabled online for security reasons. Takes input from stdin in a list as such: 5, 8, 25, "*", 9, 6, 2, "-", 104, "/", 4, 7, "+", 6.

You can save 2 bytes by switching from ? to .x, because only the else block can throw an exception, and it will do so every time. You can't use K, anymore, though. u.xsv++GbH&=bHG+\+QZ, specifically.

JavaScript (ES6) 53
A function taking an array as input.
Run the snippet in Firefox to test.

f=a=>a.map(t=>t<'0'?o=t:v=eval(v+o+t)|0,v=0,o='+')&&v

// TEST
out=x=>O.innerHTML=x;

input = [5,8,25,"*",9,6,2,"-",104,"/",4,7,"+",6,"%",14];
out(input.join(' ')+' -> '+f(input));

function go() {
  i=I.value.split(/ +/),out(I.value+' -> '+f(i))
}

Your test:<input id=I><button onclick='go()'>GO</button>

Julia, 85 83 bytes
s->(o=0;p="+";for i=split(s) isdigit(i)?o=eval(parse("ifloor($o$p$i)")):(p=i)end;o)

This creates an unnamed function that accepts a string as input and returns an integer.
Ungolfed:
function f(s::String)
    # Assign the starting output value o and operator p
    o = 0
    p = "+"

    # Split the input string into an array on spaces
    for i = split(s)
        if isdigit(i)
            # Assign o using string interpolation
            o = eval(parse("ifloor($o $p $i)"))
        else
            # Assign p to the new operator
            p = i
        end
    end
end

Fixed issue and saved 2 bytes thanks to Glen O.

Julia complains that o is not defined when you try to run the function freshly. It tries to run the "o=ifloor..." function in Main, rather than inside the function (see here https://github.com/JuliaLang/julia/issues/2386 ). Might I suggest s->(o=0;p="+";for i=split(s) isdigit(i)?o=eval(parse("ifloor($o$p$i)")):p=i;end;o)?

@GlenO I don't know how I didn't catch that. :/ Thanks, fixed.

CJam, 24 bytes
0'+ea+{_A,s&O{:O;}?S}%s~

This is a full program that reads the input as command-line arguments.
To try the code online in the CJam interpreter (which doesn't support command-line arguments), replace ea with lS/ to read from simulated STDIN.
How it works
0'+                       Push a 0 and the character '+'.
   ea                     Push the array of command-line arguments.
     +                    Prepend the character to the array.
      {             }%    For each element:
       _                    Push a copy.
        A,s                 Push "0123456789".
           &                Intersect the copy with the string of digits.
             {   }?         If the intersection is non-empty:
            O                 The element is a number. Push O.
              :O;             The element is an operator. Save it in O.
                   S        Push a space.
                      s~  Flatten the array of strings and evaluate it.

elisp, 101 bytes
With the arguments passed as a quoted list:  e.g. (c '(5 5 * 10))
    (defun c(a)(let((f 0)(o '+))(dolist(x a)(if(not(integerp x))(setf o x)(setq f (eval(list o f x)))))f))

Version with new lines:
    (defun c (a)
      (let ((f 0)
            (o '+))
        (dolist (x a)
          (if (not (integerp x))
              (setf o x)
            (setq f (eval (list o f x)))))
        f))

JavaScript, 85 bytes
r=0;o="+";prompt().split(" ").forEach(t=>+t+1?r=parseInt(eval(r+o+ +t)):o=t);alert(r)

why o+ +t? you are building a string anyway, no need to convert to number. Moreover, .forEach has no place in Code Golf: use .map

... and ~~ instead of parseInt (http://codegolf.stackexchange.com/a/2788/21348)

prompt(o="+",r=0).split(" ").forEach(t=>+t+1?r=+eval(r+o+ +t):o=t);alert(r) --> 75 bytes.

Lua, 142 bytes
function f(s)o="+"r=0 for c in s:gmatch"%S+" do if tonumber(c)~=nil then loadstring("r=r"..o..c)() else o=c end r=math.floor(r)end print(r)end

Ungolfed:
function f(s)
    o="+" --original operator
    r=0 --return value
    for c in s:gmatch"%S+" do --split by spaces
        if tonumber(c)~=nil then --check if the current character is a number
            loadstring("r=r"..o..c)() --appends the current operator and current character ex "r=r+5" and then evaluates as another Lua script
        else
            o=c --if the character is not a number, it is the new operator
        end
        r=math.floor(r) --floor after each operation
    end
    print(r) --print the result
end

Powershell, 57 bytes
$o="+"
$args|%{$r=iex "$r$o$_"
if(!$?){$o=$_}$r-=$r%1}
$r

ungolfed;
$operator="+"
$args | ForEach-Object
{
    $result = Invoke-Expression "$result $operator $_"
    if(!$?)
    {
        $operator=$_
    }
    $result -= $result % 1
}
$result

If the implicit variable in the for-each is an operator rather than number, Invoke-Expression (POSH's eval()) will fail and the execution status $? will be false.
Floor in POSH is unwieldy - $foo=[math]::floor($foo) and $foo-=$foo%1 was the golfiest alternative I could think of.

Nice. I read it a little more literally by assuming a string input and parsing it on spaces, then ifing on digits, but essentially the same. 89 Bytes $o="+";$r=0;$args-split'\s+'|%{if($_-match'^\d+$'){$r=iex $r$o$_;$r-=$r%1}Else{$o=$_}};$r

GNU Sed (with the eval extension, + dc), 102
(Score includes +1 for the -r option to sed.)
s/.*/0 + &p/
s/([-+/*%]) ([0-9]+)/\2 \1/g
:
s/([-+/*%] )([0-9]+ )([0-9]+)/\1\2\1\3/
t
s/.*/dc<<<'&'/e

Transforms the input expression to reverse polish notation, and then uses dc to evaluate it.
Test output:
$ sed -rf calclist.sed <<< '5 8 25 * 9 6 2 - 104 / 4 7 + 6 % 14'
8
$

Python 3 - 131 bytes 129 bytes 121 bytes 116 Bytes
Thanks to Maltysen for shaving off two bytes, Beta Decay for shaving off 8, and Steven Rumbalski for shaving off 5.
def f(x):
    a,b="+",0
    for i in x:
        if i in"+-*/%":a=i
        else:b=int(eval(str(b)+a+i))
    return b

I'm trying to figure out a way to reduce the length of the if statement, but for now this seems about as golfed as I can get it. Takes input as a list.

you can save some bytes on indentation and replacing int with //1

also, why the parens in the `if?

@ Maltysen whoops, I forgot I didn't need the parentheses in the if statement. Thanks. I don't think that using //1 will be allowed, though I didn't think to use it, as it seems to leave a trailing 0 (e.g. 10.0) which I don't think is allowed.

i don't think you need that space between in and the quote.

You could save some bytes by assuming that list is passed in the function arguments and getting rid of .split().

Drop to Python 2 and your else-clause can become else:b=eval(\b`+a+i)for a savings of 12 bytes (allows you to use backticks for repr and gets rid of the need to cast toint).  Even if you don't drop to Python 2 str(i)` is unneeded as it's already a string.

@StevenRumbalski Thanks -- I'd rather not drop to Python 2, but I'll definitely remove the unnecessary string conversion.

Not sure if this breaks the rules, but what about "exec" instead of "eval", then you can put the entire assignment into the string, avoid type conversion, and switch the if/else to an array access.  Try: for v in x:exec(('b=v','a=a'+b+v)[v>'/']) ... I'm not sure if I broke another rule by using "v>'/'", which works for nearly every character set.

Note that my "b" and "a" are reversed from yours.

@mbomb007 I'm not using backticks anywhere, but I guess I should have also mentioned that I'm assuming the input is a list of strings, even for numbers, since the exec is doing the conversion implicitly to int.

@swstephe I tagged the wrong person, sorry. lol.

@StevenRumbalski You can't use backticks if you need it to work for integers larger than 2**31-1, because it will print L afterwards.

@mbomb007:  eval(\280`+'+1') == eval(str(280)+'+1')`

@StevenRumbalski Just realized he's not printing the result, he's returning it anyway, but yeah I guess eval makes it work.

CJam, 34 bytes
'+0lS/{"+-*/%"1$#){@;\}{i2$~}?}/\;

Try it online
I thought this was going to be fairly reasonable. But I wasn't fast enough posting it to be the shortest CJam answer at least for a moment. :(

Bash, 69
set -f
for t in $*
do
((1${t}1>2))&&((r${o-+}=$t))||o=$t
done
echo $r

This only works with non-negative integers - its not clear in the question if this is ok or not.

Groovy, 79 bytes
def f(x,a=0,b='+'){x.each{z->a=z=~/\d/?Eval.me(a+b+z)as int:a;b=z=~/\d/?b:z};a}

Demo:
groovy> f([5,8,25,'*',9,6,2,'-',104,'/',4,7,'+',6,'%', 14])
Result: 8

Ungolfed:
def f(x, a=0, b='+') {
    x.each {z->
        a = z =~ /\d/ ? Eval.me(a+b+z) as int : a
        b = z =~ /\d/ ? b : z
    }
    a
}

C 122
Thanks to @ceilingcat for finding a much better (and shorter) version
#define A atoi(*a):s
o,s;main(z,a)char**a;{for(;*++a;)**a<48?o=**a-43:(1?s=o+6?o-4?~o?o-2?o?:s+A-A*A/A%A);printf("%d",s);}

Try it online!
But if you are compiling it with mingw32 you need to turn off globbing (see https://www.cygwin.com/ml/cygwin/1999-11/msg00052.html) by compiling like this:
gcc x.c C:\Applications\mingw32\i686-w64-mingw32\lib\CRT_noglob.o

Perl 5.10+, 52 bytes
perl -E '$o="+";/\D/?$o=$_:eval"\$x=int\$x$o$_"for@ARGV;say$x'

Demo:
$ perl -E '$o="+";/\D/?$o=$_:eval"\x=int\$x$o$_"for@ARGV;say$x' 5 8 25 \* 9 6 2 - 104 / 4 7 + 6 % 14
8

(Note that * has to be escaped in my shell so it's not interpreted as a glob pattern.)
Ungolfed:
$o="+";                      # Start with addition
/\D/ ? $o=$_                 # If not a number, update the current operator
     : eval"\$x=int\$x$o$_"  # Otherwise, make a string like '$x=int$x+1' and eval it
for@ARGV;                    # Repeat for each item in the argument list
say$x                        # Print the result

C#, 132 165 168 bytes
This function assumes the input is valid.  This is tough for C# given there's no eval equivalent.
Thanks edc65 for saving 33 bytes!
Indented for clarity.
int C(string[]a){
    int o=1,r=0,n;
    foreach(var b in a)
        n=int.TryParse(b,out n)
            ?r=o<0?r%n
              :o<1?r*n
              :o<2?r+n
              :o<4?r-n
                  :r/n
            :o=b[0]-42;
    return r;
}

You can take out most of the newlines.

I haven't counted any newlines or insignificant whitespace.

132 using ?: -->int C(string[]a){int o=1,r=0,n;foreach(var b in a)n=int.TryParse(b,out n)?r=o<0?r%n:o<1?r*n:o<3?r+n:o<5?r-n:r/n:o=b[0]-42;return r;}

Ruby, 59 bytes
a=0
o=?+
gets.split.map{|s|s=~/\d/?a=eval([a,s]*o):o=s}
p a

Test run:
$ ruby calc.rb <<< "5 8 25 * 9 6 2 - 104 / 4 7 + 6 % 14"
8

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
What's the voltage over each component?
The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1)

In order to simplify computations, it's common to work in the frequency (Laplace) domain instead of the time domain.
Your task is:
Take the values R, L and C as input, and return the voltages VR, VL and VC
The conversion to the Laplace domain is as follows:
R = R
XL = j*w*L      // OK, XL = w*L, and ZL = j*XL, but don't mind this here.
XC = 1/(j*w*C)  // I haven't ruined physics, it's only a minor terminology tweak

where j = sqrt(-1), and w = 2*pi*50 (The frequency is 50 Hz).
The combined impedance, when the components are in series is Z = R + XL + XC. You might remember U = R*I from high school physics lectures. It's almost the same, but a bit more complex now: VS = Z*I. The current is calculated by dividing the voltage VS by the total impedance Z. To find the voltage over a single component, you need to know the current, then multiply it by the impedance. For simplicity, the voltage is assumed to be VS = 1+0*j.
Equations you might need are:
XL = j*w*L
XC = 1/(j*w*C)
Z = R + XL + XC   // The combined impedance of the circuit
I = VS / Z         // The current I (Voltage divided by impedance)
VR = I * R        // Voltage over resistance (Current times resistance)
VL = I * XL       // Voltage over inductor (Current times impedance)
VC = I * XC       // Voltage over capacitor (Current times impedance)

The input is from either STDIN or as function arguments. The output/result must be three complex numbers, in a list, string or whatever is most practical in your language. It's not necessary to include names (ex VR = ...), as long as the results are in the same order as below. The precision has to be at least 3 decimal points for both the real and imaginary part. The input and output/results can be in scientific notation if that's default in your language.
R and L are >= 0, and C > 0. R, L, C <= inf (or the highest possible number in your language).
A simple test case:
R = 1, L = 1, C = 0.00001

VR = 0.0549 + 0.2277i
VL = -71.5372 +17.2353i
VC = 72.4824 -17.4630i

For the results above, this could be one (of many) valid ouput format:
(0.0549 + 0.2277i, -71.5372 +17.2353i, 72.4824 -17.4630i)

Some valid ouput formats for one voltage value are:
1.234+i1.234,   1.23456+1.23456i,   1.2345+i*1.2345,   1.234e001+j*1.234e001.

This list is not exclusive, so other variants can be used, as long as the imaginary part is indicated by an i or a j (common in electrical engineering as i is used for current).
To verify the result for other values of R,L and C, the following must be true for all results: VR + VL + VC = 1.
The shortest code in bytes win!
By the way: Yes, it's voltage over a component, and current through a component. A voltage has never gone through anything. =)

Actually, reactances are real numbers, so XL = omega*L. The impedance of the inductor is Z = jXL. (This does not affect the problem, it's only a correction)

@Voitcus, true... I simplified it a bit, to not make the question too confusing. I included the j in the XL/XC terms, when going to the frequency domain. I never said that the reactance was complex though (although I called it X, and not jX) =) But I agree with you! I actually called it impedance too.

Can I take a list of 3 numbers as a function input, or does it have to be 3 separate arguments?

@MartinBüttner, list is OK.

Pyth, 30 29 28 bytes
L*vw*100.l_1)K[Qy0c1y1)cRsKK

Try it online.

Mathematica, 33 bytes
So close to Pyth...
l/Tr[l={#,#2(x=100Pi*I),1/x/#3}]&

This is an unnamed function, which takes R, L and C as its three arguments and returns a list of complex numbers as the result (in the required order VR, VL, VC). Example usage:
l/Tr[l={#,#2(x=100Pi*I),1/x/#3}]&[1, 1, 0.00001]
(* {0.0548617 + 0.22771 I, -71.5372 + 17.2353 I, 72.4824 - 17.463 I} *)

Octave / Matlab, 53 51 bytes
function f(R,L,C)
k=-.01j/pi;Z=[R L/k k/C];Z/sum(Z)

Try it online
Thanks to @StewieGriffin for removing two bytes.

@StewieGriffin 100j?! So many years using Matlab and I didn't know that could be done! :-) (I did know 1j, but I thought it was just that). Thanks!

... aaaand: Apparently I know more about you than you do! Because, you do/did know that it is possible! =)

@StewieGriffin Ooooh. It happened to me again. Bad memory!!:-D (I never  really use that notation)

You can save another byte if you start with the inverse of k, like this: k=-.01j/pi;Z=[R,L/k,k/C];Z/sum(Z), or k=-.01j/pi;[R L/k k/C]/(R+L/k+k/C). =)

@StewieGriffin Good idea! Edited

I just stumbled over this: Can't believe I commented and provided a link to a question you posted two years earlier (at the time) in 4 minutes... How did I even remember that you wrote 2i in that post...? Beats me... :P

@StewieGriffin Specially when I didn't remember about it myself, haha

APL (Dyalog Unicode), 27 24 bytesSBCS
Full program. Prompts for C, L, R in that order.
(⊢÷+/)(⎕,⎕∘÷,÷∘⎕)÷○0J100

Try it online!
0J100 100 i
○ π times that
÷ reciprocal of that
(…) apply the following tacit function:
 ÷∘⎕ divide the argument by input (C)
 ⎕∘÷, prepend input (L) divided by the argument
 ⎕, prepend input (R)
(…) apply the following tacit function:
 +/ sum the arguments
 ⊢÷ divide the arguments by that

@StewieGriffin I am note sure what you mean. the "high minus"  ¯ is APL's negative number prefix, to distinguish from the function (i.e math operator) negate -. Anyway, it wouldn't be fair to not count APL chars as single bytes, it is just a matter of encoding, and there are many APL systems that use single bytes to store APL code. E.g. Dyalog has both Unicode and Classic (single-byte) versions of their interpreter.

I agree, if you have used encoding where every character is a single byte, then the number of chars should equal the number of bytes. Can you verify that it's the case (i'm not too familiar with apl an different encoding systems). Also, i wasn't familiar with the high minus sign. My bad...

I just pasted the code into a "count number of bytes" box and got back 31. If it's not correct, then of course you'll have a score of 28 :-) Although, ..,49J¯17.4.. would mean the first part is imaginary and the second is real in any other language (or in mathematical notation in general), so it might violate the rule "as long as the imaginary part is indicated by an i or a j". Have a +1 for teaching me about "high minus", and a nice answer, but I'm not sure I can pick it as the accepted answer, when that day comes.

@StewieGriffin Ninja'd ;)

@StewieGriffin See http://help.dyalog.com/14.1/Content/Language/System%20Functions/avu.htm

@StewieGriffin APL uses a notation similar to the last one mentioned in https://en.wikipedia.org/wiki/Complex_number#Notation, as a natual extension to 123E4 (123 × 10 ^ 4) 123J4 (123+i × 4).

@NBZ, but that doesn't explain why J is in front of the minus sign for the last voltage...? Unless there are parentheses, +/- are last in the hierarchy (PEMDAS). ab^c = a*(b^c), but ab-c = (a*b) - c, not a - (b*c), thus: aJ-b = a*J - b. If you didn't know the answer was written in APL, and/or didn't know how APL prints imaginary numbers, it wouldn't make sense. I think the answer deserves the upvotes, as it is a nice answer, but I'm afraid I can't accept it with that particular output format.

@StewieGriffin Oh, but APL always evaluates right-to-left, with no hierachy: 9=3×2+1 and 1J2 is 1 + i × 2 (where the + and × are left out and signaled with a J, just as × and 10^ are in 1E2 and signaled with an E). In fact, "J", a close cousin to APL, has many such notations: http://www.jsoftware.com/help/dictionary/dcons.htm

@NBZ, ok, I realize that this is the correct way to output this in APL. But I'm sorry, I stand my ground. In my eyes, this does not adhere to the rule: "as long as the imaginary part is indicated by an i or a j". I didn't understand it at first, second or third glance. If you had written the values on a piece of paper, it would be incorrect. If the task was just: "Calculate it", I would accept it...

@StewieGriffin Well, one could define output←('J'⎕R'+i×')⍕¨ and then output (⊢÷+/)R(L÷k),C÷⍨k←0J¯0.01÷○1 would give 0.05486169763+i×0.2277101046  ¯71.53723919+i×17.23531062  72.48237749+i×¯17.46302073. It you then would call output the "standard output" of APL...

I have to go, but regarding the byte count, you might be interested in the result of this meta post. I think it's fair to count the score according to what the consensus there will end up as...?

APL is usually counted as one byte per character. The code golf tag wiki states "Unless the question is specified to be scored by characters, it is scored by bytes. If it doesn't specify a character encoding to use for scoring, answers which use Unicode code points outside 0 to 255 should state the encoding used." That is, you don't have to score in Unicode, as long as you use an existing encoding. Furthermore, there is a codepage which contains the entire APL character set.

@MartinBüttner But to enable people to actually read the APL code, it would be fair to post translation to Unicode. Implicitly, all APL code has the note "this is of course really supposed to be entirely different bytes in a special APL code page, but here is it posted in Unicode to ease reading."

@NBZ, it has gone a week now. I'm sorry for not accepting your answer, but as the OP/judge, I don't think the output complies with the rules. As I stated earlier, the j is in the wrong place (according to general notation (and not APL/J etc.)); aJ-b = a*J - b. But again, nice answer and very well done!

Octave, 41 bytes
@(R,L,C)(Z=[R L/(k=-.01j/pi) k/C])/sum(Z)

1/(100*j*pi) can be shortened to -.01j/pi which is a lot shorter. By assigning it to the variable k inline, the variable can be used twice. Assigning the entire vector to the variable Z costs 4 bytes, but allows us to divide by sum(Z), which is 5 bytes shorter than (R+L/k+k/C).

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
GOLF CPU - Implement Arbitrary Precision Integer Division
This question was inspired this question and @orlp's comment and a lot of the explanation was copied from there.
Write a GOLF assembly program that given two arbitrary size decimal integers a, and b from stdin outputs two decimal integers to stdout, Q and R  such that b * Q + R = a. In other words write divmod with arbitrary precision integers.
Clarifications

abs(R) must be less than abs(b)
You do not need to deal with b = 0
a and b are decimal string representing integers in (-inf, inf), space separated.
Output is also space separated in order Q R.
Your score is the sum of # of cycles * (513 - test case size) for each test-case where the size is listed next to each test-case.
This is a fewest-operations challenge so lowest score wins!
Your GOLF binary (after assembling) must fit in 4096 bytes.

Test Cases
(8 bit) 236 7 -> 33 5
(32 bit) 2262058702 39731 -> 56934 13948
(128 bit) 189707885178966019419378653875602882632 15832119745771654346 -> 11982469070803487349 12121955145791013878
(512 bit) 6848768796889169874108860690670901859917183532000531459773526799605706568321891381716802882255375829882573819813967571454358738985835234480369798040222267 75399690492001753368449636746168689222978555913165373855679892539145717693223 -> 90832850270329337927688719359412349209720255337814924816375492347922352354493 57944926054000242856787627886619378599467822371491887441227330826275320521328

You should read the  GOLF specification with all instructions and cycle costs. In the Github repository example programs can be found.

Can we choose which way to round negative numbers?

Can we get examples with one or more negative inputs?

Temporarily putting this on hold until the rules for negative inputs are clarified.


text:
Output ISO8601 date
The Task
Given the positive value of unix timestamp output any of two valid ISO 8601 time formats:

YYYY-MM-DDTHH:mm:SS or, alternatively,
YYYY-MM-DD HH:mm:SS

You may ignore any leap seconds, if you wish, as well as the timezone part of the date.
Also, ignore the year 2038 problem.
Rules

You must not use any built-in date functions,
You may not use any string formatting functions (like printf), however sorting, reversing, changing case etc. is allowed,
Your program may not contain any numbers (ie. characters 0, 1, 2, ... 9) and letters which mean hexadecimal number (A, a, B, b, ... f), if used in context of hexadecimal number,
The only exception are line numbers (or labels and goto statements), if your language requires them,
You may use any function or method that returns a number, but only once (each) in your program:

For example, you can use something like zero = length(''); to have number 0, but then you can't use one = length('a'); because you would use the length() function twice, so you can consider using one = cos(zero);

The same applies to built-in constants or variables

You may use built-in constants like __LINE__ etc., but only once for each value (for example, __FILE__ is "really" constant in a file, so you can use it only once in a file, but __LINE__ varies for each line, so you can use it once per line).

If a function or a constant is used in a loop that has a chance to be executed more than once, it is considered to be used more than once and this is forbidden,
All loopholes are forbidden (especially, loading the result from another site or executing an external program to do the calculations).
Any errors, compiler warnings are allowed, however the ISO 8601 string must be valid (no error messages within the output string)

Testing
Your code must return a valid value which will be tested with the site http://www.unixtimestamp.com/.
Notes
This question is a popularity contest, so the highest scored answer wins (not earlier than at Midnight on Monday, September 7th UTC). The main idea is to show your skills when limited to not use numbers. When voting, please consider how numbers are represented by the author and what tricks they use. In my opinion such constructions like
 eighty_six_thousand_four_hundred = one;
 eighty_six_thousand_four_hundred++;
 eighty_six_thousand_four_hundred++;
 //... 86399 times

or
// 86399 empty lines
...
$eighty_six_thousand_four_hundred = __LINE__;

should be avoided.
I also kindly ask that you provide an online version of your program, so everyone can test it (the program must not be limited to your environment).

I feel like the entire difficult part of this question is the no function reuse part, so it should be made more prominent.

You've made it optional to ignore leap seconds, but imposed compatibility with a website where I don't see any leap-second-related options. How is the testing going to work?

@PeterTaylor I will check a list of leap seconds since 1970 to the timestamp given and if the difference between your output and true value will not be greater than number of leap seconds added, I will consider the result valid. For example, up to now there were 26 leap seconds, so you may give result within 26 seconds accuracy

If the same function name is overloaded to have different behaviour in an overloaded version, are we allowed to use each overloaded variant once? For instance, in J, monadic | computes the magnitude (like abs() in C) whereas dyadic | computes the residue (like % in C). Are we allowed to use both? Does this clause extend to functions that can potentially return a number? What about high-order functions?

@FUZxxl answering the first part: yes, you may consider that a function that behaves differently depending on notation is a different function (like - operator can be unary or binary, note there is no restriction on operators). The second part - I was not thinking about it. The main idea was to limit use of functions returning constant values (having no arguments or returning the same value for any argument), and finding out how to "create" numbers. In case of high-order functions - I think it is not forbidden, as long as you can keep the spirit of the competition

@Voitcus I advise you to not restrict operators any less than functions as the difference is blurry. For example in APL and J, every function with two arguments (a dyadic function) is called like an operator, e.g. a function F is called like this: α F ω. And even then, APL also has operators which are what others call high-level functions.

@FUZxxl Well, ok - you are free to use them. It would be interesting to see. It's difficult to prepare a competition for many languages. BTW, Shakespeare could be a good candidate as there are no numbers there

@Voitcus actually Shakespeare has many constants (e.g. zero and nothing for 0). Those are limited to one for each noun, right? Does this also apply to the adjectives?

I tried it, but soon realized this goes beyond fun into programming with COBOL... on a teletype... with hard copy only output... over a 200 baud modem... in a snow storm... uphill both ways...

@bmarks "nothing" is not a number, but is it a function with constant return? Might be. Adjectives are clear, you can use many different of them. But, I think I will wait a few days and delete the question as it seemed more complicated than I thought at first sight. I was thinking about using floor(pi()) to get 3, multiply it by something like ascii('z') (122) so I would get 366, minus cos(length(''))=1 is 365 days in a year, maybe some trigonometric functions to get 60 (degrees) etc. I was just interested how people could find the numbers, but I seem to be beaten by the rules.

hundered=d;
one=hundered/hundered;
two=one+one
eight=two<<two
ten=two+eight;, and from then on I'm just turning the handle.

If a language uses functions rather than operators for things like modulus, can that be used more than once (ie, for the actual algorithm rather than just setting up number variables.)

@curiousdannii no, the idea was you can use many operators of a kind, but not functions

Inform 7
"ISO Eight Six Zero One" by "Dannii Willis"

There is a room.
Sixty is a number variable.
Hundred is a number variable.
Days per year is a number variable.
Days per leap year is a number variable.
Leap year period is a number variable.
Days per leap year period is a number variable.
Epoch is a number variable.
Seconds per day is a number variable.
Months is a list of numbers variable.

To initialise number variables:
    let thirty be ten times three;
    let thirty one be thirty plus one;
    now sixty is five times twelve;
    now hundred is ten times ten;
    now days per year is sixty times six plus five;
    now days per leap year is days per year plus one;
    now leap year period is hundred times four;
    now days per leap year period is leap year period times days per year plus hundred minus three;
    now epoch is leap year period times five minus thirty;
    now seconds per day is sixty times sixty times twelve times two;
    truncate months to zero entries;
    let X be zero; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty minus two; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty; add X to months;
    increase X by thirty one; add X to months;
    increase X by thirty; add X to months;

To decide whether (year - a number) is a leap year:
    if the remainder after dividing year by four is zero:
        if the remainder after dividing year by hundred is not zero:
            yes;
        otherwise if the remainder after dividing year by leap year period is zero:
            yes;
    no;

To say zero padded (X - a number):
    if X is less than ten:
        say zero;
    say X;

[ This general algorithim is taken from the PHP source code ]
To say (X - a number) as an ISO Eight Six Zero One date:
    initialise number variables;
    [ Split the timestamp into days and seconds ]
    let days be X divided by seconds per day;
    let seconds be the remainder after dividing X by seconds per day;
    [ Calculate the date ]
    let year be epoch;
    let month be twelve;
    let day be zero;
    increase days by one;
    [ Year ]
    if days is at least days per leap year period:
        let leap year period count be days divided by days per leap year period;
        increase year by leap year period times leap year period count;
        decrease days by days per leap year period times leap year period count;
    while days is at least days per leap year:
        increase year by one;
        if year is a leap year:
            decrease days by days per leap year;
        otherwise:
            decrease days by days per year;
    [ Month ]
    if year is a leap year:
        decrease entry one of months by one;
        decrease entry two of months by one;
    while month is greater than one:
        if days is greater than entry month of months:
            break;
        decrease month by one;
    [ Day ]
    now day is days minus entry month of months;
    [ Calculate the time ]
    let hours be seconds divided by (sixty times sixty);
    let minutes be the remainder after dividing (seconds divided by sixty) by sixty;
    let secs be the remainder after dividing seconds by sixty;
    say "[year]-[zero padded month]-[zero padded day] [zero padded hours]:[zero padded minutes]:[zero padded secs]";

Inform 7 allows the numbers one to twelve to be written in words - from these we calculate the other numbers which are needed. With that it was just a matter of transferring over the simplest algorithm I could find, which happened to be PHP's. I haven't accounted for negative timestamps. Maybe another day.
Here are some tests:
When play begins:
    say "0: [0 as an ISO Eight Six Zero One date][line break]";
    say "1000000000: [1000000000 as an ISO Eight Six Zero One date][line break]";
    say "1234567890: [1234567890 as an ISO Eight Six Zero One date][line break]";

Which produce the following correct output:
0: 1970-01-01 00:00:00
1000000000: 2001-09-09 01:46:40
1234567890: 2009-02-13 23:31:30

Thanks, I love this. Negative timestamps are not necessary to be handled.

JavaScript (ES6)
So I'm not 100% sure I'm adhering to the rules totally, so please let me know if not and I'll remove.
var T = +prompt('Enter a timestamp'),
[one, two, three, four, five, six, seven, eight, nine, zero] = btoa('\xd7\x6d\xf8\xe7\xae\xfc\xf7\x40').split(''),
minute = six + zero,
hour = minute * minute,
day = hour * (two + four),
Y = one + nine + seven + zero,
M = one,
D = one,
H = zero,
I = zero,
S = zero;

while (T) {
    var monthLookup = [
        [],
        (three + one) * day,
        (+(two + eight) + !(Y%four)) * day,
        (three + one) * day,
        (three + zero) * day,
        (three + one) * day,
        (three + zero) * day,
        (three + one) * day,
        (three + one) * day,
        (three + zero) * day,
        (three + one) * day,
        (three + zero) * day,
        (three + one) * day
    ];

    if (T >= monthLookup[M]) {
        T -= monthLookup[M++];
        if (M == one + three) {
            M = one;
            Y++;
        }
    }
    else if (T >= day) {
        T -= day;
        D++;
    }
    else if (T >= hour) {
        T -= hour;
        H++;
    }
    else if (T >= minute) {
        T -= minute;
        I++;
    }
    else {
        S = T;
        break;
    }
}

// prepend leading zeroes
M = M < one + zero ? zero + M : M;
D = D < one + zero ? zero + D : D;
H = H < one + zero ? zero + H : H;
I = I < one + zero ? zero + I : I;
S = S < one + zero ? zero + S : S;

alert(Y+'-'+M+'-'+D+' '+H+':'+I+':'+S);

Basically I get all the numbers by encoding the string (I've used \x?? notation for ease of testing, but these are just unprintable ASCII chars and so don't include numbers) and then use concatenation to get the numbers I need, to use a pretty basic decrementor approach to populate the various fields.

It's ok - I don't consider them as numbers. It's tricky to use one function for all digits


text:
Recursive ASCII Spirals

This competition is over. Thanks for the interesting non-esolang entries, and congrats to Jakuje for his winning JavaScript submission.

In the great tradition of ASCII Art Challenges on this site, here's another one. Given an input, draw a spiral.
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<

Simple, yeah? Heh, heh, heh ... Yeah...
(Inspired by the ASCII Dragons Curve post, and Optimizer's ASCII Art of the Day posts)
Input
Input will be in the form of a series of parameters, taken from the usual STDIN/function argument/etc., whatever your language equivalent, comprised of four parts. These parts can be four separate arguments, a quadruple, an array of size 4, etc. For simplicity and consistency throughout the challenge, I will represent the input as a single word.

An integer 2 ≤ x ≤ 20 that specifies the size of the spiral in terms of "squares" with each printed character representing one "square" in size. Theoretically this could be enormous in scope, but given that we're drawing ASCII art, a safe upper limit on this will be 20 so that it fits somewhat decently on screen.
A single letter of d u r or l, indicating the initial movement from the starting "square" (down, up, right, left).
An optional c, indicating "counter-clockwise." If the c is omitted, assume clockwise rotation for the spiral.
A final integer 1 ≤ y ≤ 10 that specifies how many times to recurse the spiral drawing, using the finish "square" of the previous spiral as the starting "square" of the new one. I'm picking an upper limit of 10 because I want the drawing to finish at some point.
A few example inputs: 20lc5 13d2 2rc1

Of interest, do note that odd values for the size input will result in the @ always being the exact center of a spiral, but even values may have the starting "square" offset in any of the four diagonal directions, dependent upon the direction of initial travel. This can result in some ... interesting ... patterns. See the two even examples below.
Input that doesn't follow the input specification (e.g., 11q#s) is undefined and I fully expect the program to barf appropriately. :)
Output
Output is an ASCII printable output via language-equivalent STDOUT, with the following specifications:

The starting "square" (of each recursion) must be marked with an at-sign @.
The final "square" must be marked with an ampersand &. In the case of multiple recursions, only the very final "square" should be marked &.
Corners of the spiral path need to "point" in the direction of travel, using < > v ^.
Vertical travel need to be drawn by pipes |.
Horizontal travel needs to be drawn with dashes -.
"Squares" that are overwritten by later recursions should display the most-recent direction of travel. This will result in "newer" recursions seeming to be layered on top of the "older" recursions. See the 4rc3 example below.
A final trailing newline is OK, leading spaces could be a must and so are allowed, but trailing spaces are not allowed.
I won't dock you if you use escape sequences to draw the ASCII art going to STDOUT, but I will be silently disappointed in you. (You'll still be eligible for the bounty if you use them)

Examples
2d4 = diameter of 2, starts by going down, clockwise, 4 recursions
&@@@@
^<<<<

In this example, the drawing starts in the upper-right @, goes down one, left one, up one. At this point, we've finished the 2d portion, and so start the 2nd recursion, so we have another @, down one, left one, up one; then the 3rd recursion; then the 4th and finally our &.
4rc3 = diameter of 4, starts by going right, counter-clockwise, 3 recursions
&--<
v-<|
|@^|<
>--^|
 |@^|<
 >--^|
  |@^|
  >--^

In this example, the drawing starts in the bottom @, goes right one, up one, spirals around, until it reaches the middle @ and finishes the 4rc portion. This then repeats two more times to get the full 3 recursions requested. Note that 4rc1 would be just the upper-left 4x4 block of this example.
7u1 = diameter of 7, starts by going up, clockwise, 1 recursion (note the is the same as the intro)
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<

Winning & Restrictions
This is Code Golf, so smallest answer in bytes wins. Submissions should be in the usual form of program/function/CJam Code Block/etc. Standard Loophole Restrictions Apply. Professional driver on closed course. If irritation persists, discontinue use and consult your doctor.

The specifics are quite different, but just for reference, here's an earlier spiral drawing challenge: http://codegolf.stackexchange.com/questions/52494/print-an-ascii-spiral-in-olog-n-memory.

Nice challenge. +1 for "Professional driver on closed course"

It asks for a ><> answer.

With 150 rep at stake, I think you should be clearer about escape sequences. Are they allowed or not? There's no middle point in code golf; we use whatever we can to make out code shorter.

@Dennis Clarified. I meant the "silently judging" in jest, but I can see how it could have been confusing.

"C'mon, guys ... are you going to let Common Lisp win out? ;-)" That is the most hilarious reason for a bounty I ever saw. Thanks

the requirement with "counter-clockwise" is complicated to parse. but it looks like late for changes.

@Jakuje Note that the question is quite flexible about the format of inputs: "These parts can be four separate arguments, a quadruple, an array of size 4, etc.". I took advantage of this in my answer. Nice try with Lua, btw.

@coredump After writing the comment I realized it is not so complicated with limitation of recursion to 9. Looks like I will have to fight more :)

I'm sitting here chuckling that Common Lisp and Lua are the two languages fighting for top spot on a code-golf question. :)

@TimmyD A duel of giants. Others are too scared to participate :-)

The first example input 22lc5 has 22 which is greater than 20.

@The_Basset_Hound Upon further inspection, I'm not going to try to pump out a ><> answer. The necessary lack of trailing spaces will make it much more difficult. It'd still be a fun challenge, but I'm not going to spend the time on it trying to earn the bounty. If only trailing spaces were allowed, it would be so much easier...

@mbomb007 Hah, thanks. I fixed the typo. Also, I explicitly didn't allow trailing spaces, for the precise reason you hit upon.

aj, trailing spaces. I missed this requirement so I guess I have things to fix in the evening.

Javascript, 578, 575, 553, 478, 377 Bytes
After the beaten Lua I switched to some more compact language and moved competition to Javascript:
s=function(w,d,c,r){d="dlur".indexOf(d)
j=i=G=H=I=J=w*r;o=[];for(x=0;x<J*2;x++){o[x]=[]
for(y=0;y<J*2;)o[x][y++]=' '}for(;r--;){a=d;m=l=z=1;o[i][j]="@"
for(k=w*w-1;k--;){G=G<i?G:i;H=H>i?H:i;I=I<j?I:j;J=J>j?J:j
o[i+=(1-a)%2][j+=a?a-2:0]=l++==m?(a+=c=="c"?3:1,m+=z=!z,l=1,"v<^>"[a%=4]):k?"|-"[a%2]:"&"}}for(i=G;i<=H;)console.log(o[i++].slice(I,J+1).join("").replace(/\s+$/g,''))}

Algorithm is the same, but written in more more compact language so I managed to beat the evil Lisp :)
Edit: Some structural changes were needed to reach under Lisp again and to eliminate trailing whitespaces. But we are here again.
Edit2: Some abstractions taken into account to get under 500. Hope it will be enough :)
Edit3: Thanks @Timwi, the code is another 100 chars slimmer. I didn't update the explanation yet.
Tests (online version, tested in Chrome):
----| 2d4 |---
s.js:9 &@@@@
s.js:9 ^<<<<
ss.html:7 ----| 4rc3 |---
s.js:9 &--<
s.js:9 v-<|
s.js:9 |@^|<
s.js:9 >--^|
s.js:9  |@^|<
s.js:9  >--^|
s.js:9   |@^|
s.js:9   >--^
ss.html:9 ----| 7u1 |---
s.js:9 &>----v
s.js:9 ||>--v|
s.js:9 |||>v||
s.js:9 |||@|||
s.js:9 ||^-<||
s.js:9 |^---<|
s.js:9 ^-----<
ss.html:11 ----| 8r3 |---
s.js:9       >------v
s.js:9       |>----v|
s.js:9       ||>--v||
s.js:9       |||@v|||
s.js:9    >------v|||
s.js:9    |>----v|<||
s.js:9    ||>--v||-<|
s.js:9    |||@v|||--<
s.js:9 >------v|||
s.js:9 |>----v|<||
s.js:9 ||>--v||-<|
s.js:9 |||@v|||--<
s.js:9 ||^-<|||
s.js:9 |^---<||
s.js:9 ^-----<|
s.js:9 &------<
ss.html:13 ----| 8rc3 |---
s.js:9 &------<
s.js:9 v-----<|
s.js:9 |v---<||
s.js:9 ||v-<|||
s.js:9 |||@^|||--<
s.js:9 ||>--^||-<|
s.js:9 |>----^|<||
s.js:9 >------^|||
s.js:9    |||@^|||--<
s.js:9    ||>--^||-<|
s.js:9    |>----^|<||
s.js:9    >------^|||
s.js:9       |||@^|||
s.js:9       ||>--^||
s.js:9       |>----^|
s.js:9       >------^

And to be fair, there is fair explanation:
s = function(w, d, c, r) {
    // width, direction, "c" as counter-clockwise and number of repetition
    // transfer direction to internal numerical representation
    d=d=="d"?0:d=="u"?2:d=="l"?1:3;
    // output strings
    x="v<^>"
    y="|-"
    // this is size of our canvas. Could be smaller, but this is shorter
    M = w * r * 2;
    // fill canvas with spaces to have something to build upon
    o = [];
    for (i = 0; i < M; i++) {
        o[i] = [];
        for (j = 0; j < M; j++)
            o[i][j] = ' '
    }
    // i,j is starting position
    // G,H,I,J are current boundaries (maximum and minimum values of i and j during the time)
    j = i = G = H = I = J = M / 2
    for (q = 0; q < r; q++) { // number of repeats
        a = d; // reset original direction
        // m is the expected length of side
        // l counts the of current side length
        m = l = 1;
        z = 0; // counts occurrences of the length
        o[i][j] = "@" // write initial character
        for (k = w * w; k > 1; k--) { // cycle over the whole spiral
            // update boundaries
            G = G < i ? G : i;
            H = H > i ? H : i;
            I = I < j ? I : j;
            J = J > j ? J : j;
            // move to the next position according to direction
            i+=a<3?1-a:0;
            j+=a>0?a-2:0
            if (k == 2) // we reached the end
                o[i][j] = "&"
            else if (l == m) {
                // we reached the corner so we need to count next direction
                a=(c=="c"?a+3:a+1)%4;
                // and write according sign
                o[i][j]=x[a]
                // first occurrence of this length
                if (z == 0)
                    z = 1; // wait for finish of the other
                else {
                    m++; // increase length of side
                    z = 0 // wait again for the first one
                }
                l = 1 // start the side counter over
            } else {
                l++ // another part of this side
                // according side character
                o[i][j] = y[a%2]
            }
        }
    }
    // blow it all out
    for (i = G; i <= H; i++)
        console.log(o[i].slice(I, J + 1).join("").replace(/\s+$/g, ''))
}

Very nice. With accordance to the rules and following your example, I decided to remove the &optional keyword (and a space) in order to save 10 bytes, which gives 576... evil laughter (well, you said you could golf a little more, so this should not be difficult to beat; until someone write a 60-bytes answer in Pyth, of course).

@coredump Challenge accepted :) It is more difficult than I expected, but still possible :) I believe you can do it in pyth, but nobody will ever understand it so I believe the complexity is over the possibilities of such language.

If you chain the assignments i=M/2;j=i;G=i;H=i;I=i;J=i; into i=j=G=H=I=J=M/2; and m=1;l=1; into m=l=1; you can save 12 bytes

Thanks for comment. I will improve it. Lua didn't support it and I was too lazy and tired yesterday :)

That will be hard to beat. Well done :-)

This solution is pretty clever. However, I found several more places that can be golfed: 377 bytes

Thanks. I think I still have things to learn :) This was still my first code-golf in javascript.

@Jakuje: Definitely keep going, you’re doing very well for a beginner! :)

@Jakuje I believe it was Timwi's intention for you to take the 377 byte version and edit your answer to use it. ;) (Otherwise he would have just posted a separate answer.)

Common Lisp, 649 617 605 586 576 565 554 527 518
(lambda(r v z c &aux(m 0)s(c(if c 1 -1))o p(x 0)i(y 0)j u)(#8=dotimes(_ z)(#7=setf p(aref"ruld"v)i(1-(abs(- p 2)))j(- 1(abs(1- p)))s'@)(#8#($(1- r))#5=(#7#m(min m x)o(cons`(,x,y,s)o)s(aref"-|-|"p)x(+ x i)y(+ y j))#2=(#7#s(*(- c)j)j(* i c)i s p(mod(+ p c)4)s(aref">^<v"p)u(#8#(_(1+ $))#5#))#2#))(#7#s'& u #5#o(#4=stable-sort(#4#o'< :key'car)'> :key'cadr)y(cadar o)x m)(dolist(k o)(do()((>=(cadr k)y))(#7#y(1- y)x m)(terpri))(do()((<=(car k)x))#9=(incf x)(princ" "))(and(=(cadr k)y)(=(car k)x)#9#(princ(caddr k)))))

All tests still pass. The ungolfed function was also updated to reflect the changes, as were comments.
I finally got rid of remove-duplicates in order to shorten the code, but now I don't know where to find more bytes. Well done Jakuje.
Examples
(funcall *fun* 8 #\r 3 nil)

      >------v
      |>----v|
      ||>--v||
      |||@v|||
   >------v|||
   |>----v|<||
   ||>--v||-<|
   |||@v|||--<
>------v|||
|>----v|<||
||>--v||-<|
|||@v|||--<
||^-<|||
|^---<||
^-----<|
&------<

(funcall *fun* 8 #\r 3 t) ;; counter-clockwise

&------<
v-----<|
|v---<||
||v-<|||
|||@^|||--<
||>--^||-<|
|>----^|<||
>------^|||
   |||@^|||--<
   ||>--^||-<|
   |>----^|<||
   >------^|||
      |||@^|||
      ||>--^||
      |>----^|
      >------^

(funcall *fun* 7 #\u 1 nil)

&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<

(funcall *fun* 2 #\d 4 nil)

&@@@@
^<<<<

See also 20lc10 (pastebin).
Ungolfed
There is no recursion involved here, just a basic Turtle graphics approach with loops:

Draw the spirals in memory by storing (x y char) triples in a stack.
Stable-sort elements according to y and x
Iterate over that list while avoiding duplicates (previous traces) and print from top-left to bottom-right.

(lambda
    (r v z c
     &aux
       (m 0)       ; minimal x
       s           ; symbol to print (a character)
       (c          ; 1 if clockwise, -1 otherwise
        (if c
            1
            -1))
       o           ; stack of (x y char) traces
       p           ; position of s in ">^<v"
       i           ; move direction of x
       j           ; move direction of y
       (x 0)       ; position in x
       (y 0)       ; position in y
       u           ; auxiliary variable
       )
  ;; repeat for each recursive step
  (dotimes (_ z)
    ;; initialize spiral parameters
    (setf s '@            ; start spiral with @
          p (position v"ruld") ; initialize p according to input V

          ;; Set initial direction in I and J.
          i (1-(abs(- p 2))) ; i(0..3) = ( 1, 0, -1, 0 )
          j (- 1(abs(1- p))) ; j(0..3) = ( 0, 1, 0, -1 )

    ;; Iterate with increasing diameter $. For each iteration, draw a
    ;; "L"-shape that extends previous shape. Here is roughly what
    ;; happens at each step:
    ;;
    ;;   3334
    ;;   3124
    ;;   3224
    ;;   4444
    ;;
    (dotimes($(1- r))

      ;;
      ;; Assign the form to the reader variable #1# in order to
      ;; copy-paste later. This is like declaring a local function,
      ;; but shorter: push trace into list O and move forward.
      ;;
      #1=(setf m (min m x)
               o (cons `(,x ,y ,s) o)
               s (aref "-|-|" p)
               x (+ x i)
               y (+ y j))

      ;;
      ;; Helper function #2#: rotate and draw a line of length $.
      ;;

      #2=(setf u (* (- c) j) ; rotation as a vectorial
               j (* i c)     ; product of (i j 0) with (0 0 c).
               u i           ; At first I used PSETF, but now I reuse
                             ; the existing SETF with an auxiliary
                             ; variable U to shorten the code and get
                             ; rid of PROGN. That's also why I affect
                             ; the result of DOTIMES to U (no need
                             ; for two forms and a PROGN, just SETF).

               p (mod(+ p c)4)   ; ">^<v" is sorted counter-clockwise, which
               s (aref ">^<v" p) ; means that adding P and C (modulo 4) gives
                                 ; the next symbol after rotation.

               ;; trace a line by repeatedly invoking code snippet #1#
               u (dotimes(_(1+ $)) #1#))
      ;;
      ;; Rotate and draw a second line, hence drawing a "L"-shape.
      ;;
      #2#))

  ;; Finally, draw the final symbol &
  (setf s '&)
  #1#

  (setf o

        ;; From inside-out:
        ;;
        ;; - stable sort O according to X
        ;;   (from lowest (left) to highest (right))
        ;;
        ;; - stable sort the result according to Y
        ;;   (from highest (top) to lowest (bottom))
        ;;
        (stable-sort (stable-sort o '< :key 'car) '> :key 'cadr)

        ;; initialize Y with the first Y in O, which is also the
        ;; minimum of all Y.
        y (cadar o)

        ;; initialize X with the minimum of all X
        x m)

  ;; For each trace in O
  (dolist (k o)

    ;; Add as many lines as needed to advance Y to current trace's Y.
    (do ()
      ((<= y (cadr k)))
      (setf y (1- y)
            x m)
      (terpri))

    ;; Add as many spaces as needed to advance X to current trace's X.
    (do () ((>= x (car k))) (incf x) (princ " "))

    ;; Then, print current trace's character and increment X.
    ;; This happens only when we have a "new" trace, not another
    ;; trace at the same point (which was being overwritten).
    (and(=(car k)x)(=(cadr k)y)(incf x)(princ(caddr k)))

Lua 5.2, 740 Bytes
s=io.read W=io.write Z=math.max A=math.min
D="d"U="u"L="l"R="r"function n()G=A(G,i)H=Z(H,i)I=A(I,j)J=Z(J,j)i=(a==D and i+1 or a==U and i-1 or i)j=(a==R and j+1 or a==L and j-1 or j)end
w=s"*n"d=s(1)c=s(1)r=(c=="c")and s"*n"or c
c=c=="c"M=w*(r+1)o={}for i=1,M do o[i]={}for j=1,M do o[i][j]=" "end end
i=M/2 j=i G=i H=i I=i J=i
for q=1,r do a=d m=1 l=1 z=0
o[i][j]="@"for k=3,w^2 do
n()if l==m then
a=c and(a==D and R or a==U and L or a==L and D or a==R and U)or(a==D and L or a==U and R or a==L and U or a==R and D)o[i][j]=(a==D and"v"or a==U and"^"or a==L and"<"or a==R and">")
if z==0 then z=1 else m=m+1;z=0 end
l=1
else
l=l+1
o[i][j]=(a==D or a==U)and"|"or"-"end end
n()o[i][j]="&"end
for i=G,H do for j=I,J do
W(o[i][j])end W("\n")end

I though that it would be fun to try to implement some algorithm to beat Lisp, but Lua is probably not the best option. I spend too much time on it, over-engineered some parts to end with this uggly one, but working solution. Probably I will try different language later to beat Lisp since there is some 90 characters that I can't take away from this algorithm.
Testing outputs:
jakuje@E6430:/tmp$ echo "2d4" | lua s.lua
&@@@@
^<<<<
jakuje@E6430:/tmp$ echo "4rc3" | lua s.lua
&--<
v-<|
|@^|<
>--^|
 |@^|<
 >--^|
  |@^|
  >--^
jakuje@E6430:/tmp$ echo "7u1" | lua s.lua
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<

PHP, 524 bytes
I arrived late at this party. My PHP solution is neither the smallest, nor the smartest. It just works.
$a=$argv;
$b=[['|','^',0,-1],['-','>',1,0],['|',v,0,1],['-','<',-1,$x=$y=$o=$p=$q=$r=0]];
for($t=$a[4];$t;$t--){$d=strpos(urdl,$a[2]);$c=$b[$d];$m[$y][$x]='@';
for($s=0;++$s<$a[1];){for($k=3;--$k;){for($i=$s;--$i;)
$m[$y+=$c[3]][$x+=$c[2]]=$c[0];$x+=$c[2];$y+=$c[3];$c=$b[$d=($d+($a[3]==c?3:1))%4];
$m[$y][$x]=$c[1];}$o=min($x,$o);$p=max($p,$x);$q=min($y,$q);$r=max($r,$y);}
for($i=$s;--$i;)$m[$y+=$c[3]][$x+=$c[2]]=$c[0];$m[$y][$x]='&';}
for($y=$q;$y<=$r;$y++){$l='';for($x=$o;$x<=$p;$x++)$l.=$m[$y][$x]?:' ';
echo rtrim($l)."\n";}

How to run it:
$ php -d error_reporting=0 recursive-ascii-spirals.php 4 r c 3
&--<
v-<|
|@^|<
>--^|
 |@^|<
 >--^|
  |@^|
  >--^
$ php -d error_reporting=0 recursive-ascii-spirals.php 7 u '' 1
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<

The detailed version with tests, explanation and other goodies can be found on github.


text:
Count the trees
A tree is a connected, undirected graph with no cycles. Your task is to count how many distinct trees there are with a given number of vertices.
Two trees are considered distinct if they are not isomorphic. Two graphs are isomorphic if their respective vertices can be paired up in such a way that there is an edge between two vertices in one graph if and only if there is an edge between the vertices paired to those vertices in the other graph. For a more complete description, see the link above.
To see what all of the distinct trees of sizes 1 to 6 look like, take a look here.
The series you are trying to output is A000055 at the OEIS.
Restriction: Your solution must take in the range of minutes or less to run on the input 6. This is not intended to eliminate exponential time algorithms, but it is intended to eliminate doubly-exponential time algorithms, such as brute forcing over all edge sets.
Input: Any non-negative integer.
Input may be by any standard means, including STDIN, command line parameter, function input, etc.
Output: The number of distinct trees with as many vertices as the input.
Output may be by any standard means, including STDOUT, function return, etc.
Examples: 0, 1, 2, 3, 4, 5, 6, 7 should return 1, 1, 1, 1, 2, 3, 6, 11.
Scoring: Code golf, by bytes. May the shortest code win!
Standard loopholes forbidden.

Pyth, 35 bytes
l{m`SmSSMcXdUQk2.pQusm+L,dhHGhHtQ]Y

Demonstration.
This program can be divided into two parts: First, we generate all possible trees, then we remove duplicates.
This code generates the trees: usm+L,dhHGhHtQ]Y. Trees are represented as a concatenated list of edges, something like this:
[0, 1, 0, 2, 2, 3, 1, 4]
Each number stands for a vertex, and every two numbers is an edge. It is built by repeatedly adding an edge beteen each possible vertex that already exists and one which is newly created, and adding this on to each possible tree from the previous step. This generates all possible trees, since all trees can be generated by repeatedly adding one vertex and an edge from it to the existing tree. However, isomorphic trees will be created.
Next, for each tree, we perform every possible relabeling. This is done by mapping over all possible permutations of the vertices (m ... .pQ), and then transating the tree from the standard ordering to that ordering, with XdUQk. d is the tree, k is the permutation.
Then, we separate the edges into separate lists with c ... 2, sort the vertices within each edge with SM, sort the edges within the tree with S, giving a cannonical representation of each tree. These two steps are the code mSSMcXdUQk2.pQ.
Now, we have a list of lists composed of every possible relabeling of each tree. We sort these lists with S. Any two isomorphic trees must be able to be relabelled into the group of trees. Using this fact, we convert each list to a string with `, then form the set of those lists with {, and output its length with l.

CJam (69 bytes)
]qi:X,{1e|,:):N{N\f{1$%!*}W$.*:+}%1$W%.*:+N,/+}/W\+_1,*X=\_W%.*:+-Y/z

Online demo
Explanation
The basic idea is to implement the generating function described in OEIS. The input \$0\$ is a nasty special case, but the final tweaks I made ended up producing \$-1\$ for that case, so the \$z\$ (for absolute value) tidies it up. That's the weirdest trick in here.
.*:+ is repeated three times, and looks like it could save a byte if extracted as {.*:+}:F~. However, this breaks with the special case \$0\$, because it doesn't execute the outer loop at all.

We use the auxiliary generating function for A000081, whose terms have the recurrence
a[0] = 0
a[1] = 1
For n >= 1, a[n+1] = (sum_{k=1}^n a[n-k+1] * sum_{d|k} d * a[d]) / n

I'm sure some languages have built-ins for the inverse Möbius transform \$\sum_{d\mid k} d \times a[d]\$, but CJam doesn't; the best approach I've found is to  build an array mapping \$d\$ to k % d == 0 ? d : 0 and then do a pointwise multiplication with \$a\$ using .*. Note that here it is convenient to have built up \$a\$ starting at index 1, because we want to avoid division by zero when setting up the weights. Note also that if the two arrays supplied to the pointwise operation are not the same length then the values from the longer one are left untouched: therefore we have to either take the first \$k\$ terms of \$a\$ or make the array of weights go up to \$n\$. The latter seems shorter. So this inverse Möbius transform accounts for N\f{1$%!*}W$.*:+
If we call the result of the inverse Möbius transform M, we now have $$a[n+1] = \frac{1}{n} \sum_{k=1}^n a[n-k+1] \times M[k]$$
The numerator is obviously a term from a convolution, so we can handle it by reversing either a copy of \$a\$ or \$M\$ and then taking a pointwise multiplication and summing. Again, our index varies from \$1\$ to \$n\$, and in addition we want to pair up indices which sum to \$n + 1\$, so it's again convenient to index \$a\$ from 1 rather than 0. We've now accounted for
 qi:X,{   ,:):N{N\f{1$%!*}W$.*:+}%1$W%.*:+N,/+}/

The point of the auxiliary generating function is given by the formula section of A000055:

G.f.: A(x) = 1 + T(x) - T^2(x)/2 + T(x^2)/2,
where T(x) = x + x^2 + 2*x^3 + ... is the g.f. for A000081.

In terms of \$a\$, this means that the output we seek is $$[x = 0] + a[x] + \frac{1}{2}\left(a[x/2] - \sum_{i=0}^n a[i] \times a[n-i]\right)$$
where for \$a[x/2]\$ with odd \$x\$ we get 0. The shortest way I've found to do that is to inflate with zeroes (1,*) and then take the Xth element (X=).
Note that the sum is yet another convolution, but this time it's convenient to index from 0. The obvious solution is 0\+, but there is a nice little optimisation here. Since \$a[0] = 0\$, two terms of the convolution are guaranteed to be zero. We could take this as an opportunity to index from 1, but the special case \$X = 0\$ gets ugly. If we instead do W\+, the convolution gives us \$-2a[x] + \sum_{i=0}^n a[i] \times a[n-i]\$ and after subtraction and division by \$2\$ we've handled the \$a[x]\$ term outside the sum as well.
So we've explained
 qi:X,{   ,:):N{N\f{1$%!*}W$.*:+}%1$W%.*:+N,/+}/W\+_1,*X=\_W%.*:+-Y/

The remaining details relate to the special case. I originally followed the recurrence more strictly by starting out with 1] and iterating from \$N = 1\$ with
1]qi:X,1>{ ... }/

The result when \$X = 0\$ is that we compute \$a\$ as [-1 1]: one term more than we need. The inflation and convolution wind up giving a result of \$0\$. (Perhaps better than we deserve - it's what we should have, because we haven't done anything about the term \$[x = 0]\$). So we fix it up for three chars either as a final X!+ or using the standard "fallback" technique as 1e|.
To get the "right" length of \$a\$ we need to avoid supplying that initial \$1\$, and instead to produce it from the main loop with \$N = 0\$. A completely straightforward
]qi:X,{ ... /+}/

obviously gives division by zero. But if we try
]qi:X,{1e| ... /+}/

then it works. We get
             e# Stack: [] 0
1e|          e# Stack: [] 1
,:):N        e# Stack: [] [1]
{            e# We only execute this loop once
  N\f{1$%!*} e#   1 divides 1, so stack: [] [1]
  W$.*       e#   Remember: if the two arrays supplied to the pointwise operation
             e#   are not the same length then the values from the longer one are
             e#   left untouched. Stack: [] [1]
  :+         e#   Fold over a singleton. Stack: [] 1
}%           e# And that was a map, so stack: [] [1]
1$W%.*:+     e# Another [1] [] .*:+, giving the same result: 1
N,/          e# 1 / 1 = 1
+            e# And we append 1 to a giving [1]

which produces exactly the value we require.
Now if \$X = 0\$ that main loop never executes, so after we hack in a \$-1\$ at the bottom we get [-1].  We end up computing \$(-1 - \frac12(-1 \times -1)) = -1\$, which isn't correct. But whereas correcting \$0\$ to \$1\$ took three chars, correcting \$-1\$ to \$1\$ only takes one: z gives the absolute value.