text:
Word Spinner Puzzle
This is a word puzzle.
Your program should accept two words on the standard input.
Word one is the start word. Word two is the end word.
From the start word you have to reach the end word changing/add/remove one letter at a time. After each modification it must form a new valid word. Added letters are added to the beginning or end. You can remove letters from any location (but word must not fall bellow three letters in length). Note: You can not rearrange the letters to form a word.
The output of the program is the sequence of words to get from the start word to the end word.
Example:
Input:
    Post Shot

Output:
    Post
    cost
    coat
    goat
    got
    hot
    shot

Winner:

The program must run in a reasonable time (less than a 10 seconds).
The program that can generate the shortest output sequence to the prize words.

Zink -> Silicon

If more than one program gets the shortest sequence then the shortest program in chars (ignoring white space).
If we still have more than one program submission date/time shall be used.

Notes:

Capitalization is not relevant.
The code to build a dictionary does not count towards code cost.

Prize Words and sequence will be generated from:
http://dl.packetstormsecurity.net/Crackers/wordlists/dictionaries/websters-dictionary.gz

may be "post->pot->hot->shot" is shorter.

@S.Mark: Then your algorithm beats mine and you win. The above is an example of a possible solution. A shorter solution beats a longer solution.

intentionally? sorry, I just got it wrong.

Could I solve it in Whitespace for 0 program size?

@Tim Nordenfur: I would love to see a white space implementation. Note. there are two rules before program length to decide winner. But if you meet those requirements :-)

What format is that dictionary in?  I gunzip'd it but it is still gobbledygook.

Ah, I see now.  Some idiot decided that compressing it once helped, so why not compress it again?

Should the program be able to exit when the end word is not reachable ? (i.e. not run forever)

@user300: That would be nice.

@Martin, making the dictionary text file to some different format will break the rule? and if not, those prebuilding codes will count towards program code?

@ S.Mark: Interested to see where you are going with this. But feel free to change the format of the dictionary (no cost). The dictionary is just to provide a common set of words so that people were not failing because their system/language did not provide an extensive dictionary.

@Martin, ok, I will post tomorrow, but I guess I already failed to golf dijkstra algorithm than 288 char solution :D Anyway, I will post just for reference, since I have no ability to create my own algorithm.

Python, 288 characters
(not counting the dictionary reading line)
X=set(open('websters-dictionary').read().upper().split())

(S,E)=raw_input().upper().split()
G={S:0}
def A(w,x):
 if x not in G and x in X:G[x]=w
while E not in G:
 for w in G.copy():
  for i in range(len(w)):
   for c in"ABCDEFGHIJKLMNOPQRSTUVWXYZ":A(w,w[:i]+c+w[i+1:]);A(w,w[:i]+w[i+1:]);A(w,c+w);A(w,w+c)
s=''
while E:s=E+'\n'+s;E=G[E]
print s

for the challenge zink to silicon:
ZINK
PINK
PANK
PANI
PANIC
PINIC
SINIC
SINICO
SILICO
SILICON

There are some strange words in that dictionary...

I did not actually check the content. I just tried to find a dictionary that everybody could use.

try with guester overturn (takes some time) or regatta gyrally (does not returns) ;-)

Yes, some combinations take a while.  The time gets longer as the shortest solution gets longer.  And the last one has no solution - there's no spec for what should happen in that case :)  It's pretty easy to modify to handle it though (save a handle to G.copy() and compare G against it at the end of the loop).

traceroute - 10 chars
traceroute

detail
post#traceroute shot

Type escape sequence to abort.
Tracing the route to shot (1.1.4.2)

  1 pot (1.1.1.2) 40 msec 68 msec 24 msec
  2 hot (1.1.3.2) 16 msec 32 msec 24 msec
  3 shot (1.1.4.2) 52 msec *  92 msec

Routers are preconfigured with OSPF enabled and arranged this way.

And yes, I need 233614 routers to fully support all the words. :-)

Very clever but you fail the 10 second rule. It will take you excessively longer than 10 seconds to configure all the routers. :-) Whats the route from : Zink -> Silicon

@Martin, please be ignore for configuration time, it just like building dictionary, heheh, routes for Zink -> Silicon is zink->pink->pank->pani->panic->pinic->sinic->sinico->silico->silicon I am really trying with Dijkstra algorithm (which is used in OSPF) and its can find that path around 1s, I will post it in seperate post later, once I golfed.

PHP - 886 689 644 612
Dictionary loading:
<?php foreach(file('websters-dictionary') as $line) {
    $word = strtolower(trim($line));
    if (strlen($word) < 3) continue;
    $c[$word] = 1;
}

Actual code (just concat both) :
list($d,$e)=explode(' ',strtolower(trim(`cat`)));$f=range(@a,@z);function w($a,&$g){global$c;if(isset($c[$a]))$g[]=$a;}$h[$d]=$b=@levenshtein;$i=new SplPriorityQueue;$i->insert($d,0);$j[$d]=0;$k[$d]=$b($d,$e);while($h){if(isset($c[$l=$i->extract()])){unset($h[$l],$c[$l]);if($l==$e){for(;$m=@$n[$o[]=$l];$l=$m);die(implode("\n",array_reverse($o)));}for($p=strlen($l),$g=array();$p--;){w(substr_replace($q=$l,"",$p,1),$g);foreach($f as$r){$q[$p]=$r;w($q,$g);w($r.$l,$g);w($l.$r,$g);}}foreach($g as$m){$s=$j[$l]+1;if(!isset($h[$m])||$s<$j[$m]){$n[$m]=$l;$i->insert($m,-(($k[$m]=$b($m,$e))+$j[$m]=$s));}$h[$m]=1;}}}

usage:
php puzzle.php <<< 'Zink Silicon'
# or
echo 'Zink Silicon'|php puzzle.php

Result:
zink
pink
pank
pani
panic
pinic
sinic
sinico
silico
silicon
(0.23s)

This should run in less than 0.5 second for 'Zink Silicon', and less than 1 second for most cases (sometimes longer when no solution exists, but it sill returns).
This uses the A* algorithm with levenshtein distance to estimate a lower bounds of the distances.
Some intersting tests:

vas arm -> vas bas bar barm arm (with a word longer than both start and end)
oxy pom -> oxy poxy poy pom
regatta gyrally -> (none, but the script correctly terminates)
aal presolution -> +8 chars
lenticulated aal -> -9 chars
acarology lowness -> 46 hops
caniniform lowness -> 51 hops
cauliform lowness -> 52 hops
overfoul lowness -> 54 hops
dance facia -> some words in the path have 4 more chars than both start/end

Try Zink Silicon

This should work, now :-)

I will find a bigger machine: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes)

You just hit the 128M memory_limit setting ;-) Try with php -dmemory_limit=256M.

had->hand is not a valid move, you can only add a letter to the beginning or end. Same for vest->verst :-)

@user300, imm, that is a strange rule, but fixed it anyway. became same counts now :P

By the way, You may try to ask moderators to get your post back to non-CW (because of too many edits) by flagging the post->moderators attention->others

Conversion to CW is a one-way street.

Python
Since I couldn't golf dijkstra codes to compress to few hundreds bytes, here is ungolfed version of mine.
import sys, heapq, time

# dijkstra algorithm from
# http://code.activestate.com/recipes/119466-dijkstras-algorithm-for-shortest-paths/
def dijkstra(G, start, end):
   def flatten(L):
      while len(L) > 0:
         yield L[0]
         L = L[1]

   q = [(0, start, ())]
   visited = set()
   while True:
      (cost, v1, path) = heapq.heappop(q)
      if v1 not in visited:
         visited.add(v1)
         if v1 == end:
            return list(flatten(path))[::-1] + [v1]
         path = (v1, path)
         for (v2, cost2) in G[v1].iteritems():
            if v2 not in visited:
               heapq.heappush(q, (cost + cost2, v2, path))

nodes = tuple(sys.argv[1:])

print "Generating connections,",
current_time = time.time()

words = set(x for x in open("websters-dictionary", "rb").read().lower().split() if 3 <= len(x) <= max(5, *[len(l)+1 for l in nodes]))

print len(words), "nodes found"

def error():
    sys.exit("Unreachable Route between '%s' and '%s'" % nodes)

if not all(node in words for node in nodes):
    error()

# following codes are modified version of
# http://norvig.com/spell-correct.html
alphabet = 'abcdefghijklmnopqrstuvwxyz'

def edits(word):
   splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
   deletes = [a + b[1:] for a, b in splits if b]
   replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b]
   prepends = [c+word for c in alphabet]
   appends = [word+c for c in alphabet]
   return words & set(deletes + replaces + prepends + appends)

# Generate connections between nodes to pass to dijkstra algorithm
G = dict((x, dict((y, 1) for y in edits(x))) for x in words)

print "All connections generated, %0.2fs taken" % (time.time() - current_time)
current_time = time.time()

try:
    route = dijkstra(G, *nodes)
    print '\n'.join(route)
    print "%d hops, %0.2fs taken to search shortest path between '%s' & '%s'" % (len(route), time.time() - current_time, nodes[0], nodes[1])
except IndexError:
    error()

Tests
$ python codegolf-693.py post shot
Generating connections, 15930 nodes found
All connections generated, 2.09s taken
post
host
hot
shot
4 hops, 0.04s taken to search shortest path between 'post' & 'shot'

$ python codegolf-693.py zink silicon
Generating connections, 86565 nodes found
All connections generated, 13.91s taken
zink
pink
pank
pani
panic
pinic
sinic
sinico
silico
silicon
10 hops, 0.75s taken to search shortest path between 'zink' & 'silicon'

Added user300's Tests
$ python codegolf-693.py vas arm
Generating connections, 15930 nodes found
All connections generated, 2.06s taken
vas
bas
bam
aam
arm
5 hops, 0.07s taken to search shortest path between 'vas' & 'arm'

$ python codegolf-693.py oxy pom
Generating connections, 15930 nodes found
All connections generated, 2.05s taken
oxy
poxy
pox
pom
4 hops, 0.01s taken to search shortest path between 'oxy' & 'pom'

$ python codegolf-693.py regatta gyrally
Generating connections, 86565 nodes found
All connections generated, 13.95s taken
Unreachable Route between 'regatta' and 'gyrally'

Some more
$ python codegolf-693.py gap shrend
Generating connections, 56783 nodes found
All connections generated, 8.16s taken
gap
rap
crap
craw
crew
screw
shrew
shrewd
shrend
9 hops, 0.67s taken to search shortest path between 'gap' & 'shrend'

$ python codegolf-693.py guester overturn
Generating connections, 118828 nodes found
All connections generated, 19.63s taken
guester
guesten
gesten
geste
gest
gast
east
ease
erse
verse
verset
overset
oversee
overseed
oversend
oversand
overhand
overhard
overcard
overcare
overtare
overture
overturn
23 hops, 0.82s taken to search shortest path between 'guester' & 'overturn'

3 <= len(x) <= max(map(len, [nodea, nodeb])) is it guaranteed that the path will never go through a word longer than both start and end words ?

Try with oxy pom; shortest path is oxy->poxy->poy->pom. Also is seems that you allow permutations and insertions at any place, which are not allowed :-)

@user300, fixed permutations and insertions parts, I copy-pasted too much, thanks ;-) and I am setting initial limit to 5 chars and allowing +1 more chars start and end words, let me know if that still be issue. thanks.


text:
Last non-zero digit of n!
Given an integer 1 ≤ N ≤ 1,000,000 as input, output the last non-zero digit of N!, where ! is the factorial (the product of all numbers from 1 to N, inclusive).  This is OEIS sequence A008904.
Your program needs finish within 10 seconds on a reasonable machine for any valid input.
Test Cases
1 => 1
2 => 2
3 => 6
4 => 4
5 => 2
6 => 2
7 => 4
8 => 2
9 => 8
10 => 8
100 => 4
1000 => 2
10000 => 8
100000 => 6
1000000 => 4

This is a code-golf so the shortest code in bytes wins!

Single function or complete program?

@joey No, they are just test cases. Single Input, Single Output.

@joey Complete program.

Why not 0! as well?

Requirement for a full program is discouraged...

@EriktheOutgolfer this is from ~7 years ago, so I don't think that was determined at the time

@NoOneIsHere Well it is now, but I still believe that, even back then, people would have preferred to be able to write either a full program or a function, instead of being restricted to a full program.

is extra output okay? such as [2,1] for 5? or 2\n1

Ruby - 63 chars
f=->n{n<2?1:6*[1,1,2,6,4,4,4,8,4,6][n%10]*3**(n/5%4)*f[n/5]%10}

Source - http://oeis.org/A008904
Handles f upto a thousand digits under a second.
Test
irb(main):014:0> for n in 2..6
irb(main):015:1> puts f[10**n]
irb(main):016:1> end
4
2
8
6
4

Mathematica, 45 36 bytes
Last@Select[IntegerDigits[#!],#>0&]&

Very readable for a winning answer. :) (Then again, there's no GolfScript & Co. submission yet.)
This handles input 1,000,000 in about 5 seconds on my machine.

Mathematica is pretty much the perfect language for this question.

Python - 75
n=input()
g=1
while n:
 g*=n
 while g%10<1:g/=10
 g%=10**9
 n-=1
print g%10

PARI/GP - 27 bytes
This trades speed for size -- the testcase takes a long time (~6 seconds).
n->n!/10^valuation(n!,5)%10

This version is much faster (~15 microseconds) but takes 81 bytes:
n->r=1;while(n,r*=Mod(4,10)^(n\10%2)*[1,2,6,4,2,2,4,2,8][max(n%10,1)];n\=5);lift(r)

You can use this (non-golfed) code to test either:
[%(10^n) | n <- [1..6]]

JavaScript, 59 bytes
Based on this answer
f=n=>n>9?'6248'[(a=n/5|0)%4]*f(a)*f(n%5)%10:'1126422428'[n]

Try it:

f=n=>n>9?'6248'[(a=n/5|0)%4]*f(a)*f(n%5)%10:'1126422428'[n]

;[
  0, // 1
  1, // 1
  2, // 2
  3, // 6
  4, // 4
  5, // 2
  6, // 2
  7, // 4
  8, // 2
  9, // 8
  10, // 8
  20, // 4
  100, // 4
  1000, // 2
  10000, // 8
  100000, // 6
  1000000, // 4
].forEach(n=>console.log(n, f(n)))

Modified formula is:
$$
D(0) = 1 \\
D(1) = 1 \\
D(2) = 2 \\
D(3) = 6 \\
D(4) = 4 \\
D(5) = 2 \\
D(6) = 2 \\
D(7) = 4 \\
D(8) = 2 \\
D(9) = 8 \\
D(n) = (LastDigitOf(2^{\lfloor n/5 \rfloor}) * D(\lfloor n/5 \rfloor) * D(n \mod 5)) \mod 10, \;where \;n > 9
$$
How?
The original formula is \$D(n) = (2^{[n/5]} * D([n/5]) * D(n \mod 5)) \mod 10\$
But there is a problem: we need to calculate \$2^{[n/5]}\$. For example if \$n = 10 000 \$ then we need to calculate \$2^{2000}\$ which is already too hard (in JS it will output Infinity). But I discovered that we don't need to calculate it instead of this we just need to calculate the last digit of \$2^{[n/5]}\$. Why? Because each time we just need to calculate the last digit of \$2^{[n/5]} * D([n/5]) * D(n \mod 5)\$
Theorem
The last digit of multiplication is the last digit of multiplication of last digits of each multiplier
Proof
Let's say we have two numbers \$a\$ and \$b\$. We can represent each of them to the power of 10:
$$
a = x_n * 10^n + x_{n - 1} * 10^{n - 1} + \ldots + x_1 * 10^1 + x_0 \\
b = y_n * 10^m + y_{m - 1} * 10^{m - 1} + \ldots + y_1 * 10^1 + y_0
$$
or
$$
a = (x_n * 10^{n - 1} + x_{n - 1} * 10^{n - 2} + \ldots + x_1) * 10 + x_0 \\
b = (y_n * 10^{m - 1} + y_{m - 1} * 10^{m - 2} + \ldots + y_1) * 10 + y_0
$$
When we multiply them we will get:
$$
a * b = (...) * 10 + x_0 * y_0
$$
Now it is clear that the last digit of multiplication is the last digit of \$x_0 * y_0\$, where the \$x_0\$ and \$y_0\$ are the last digits of \$a\$ and \$b\$ respectively. So we proved the theorem
Now we need to find the last digits of powers of 2. Let's write some of them:
$$
2^0 = 1 \\
2^1 = 2 \\
2^2 = 4 \\
2^3 = 8 \\
2^4 = 16 \\
2^5 = 32 \\
2^6 = 64 \\
2^7 = 128 \\
2^8 = 256
$$
Now we can see the pattern 1 (2 4 8 6) (2 4 8 6) and can write it \$(k = [n / 5])\$:
if (k == 0) return 1;
else return [6, 2, 4, 8][k % 4];

We can ignore the first case when k == 0 and here is why:
k % 4 == 0 when k is one of [0, 4, 8, 12, 16, ...] but we need to consider cases when k is one of [0, 4, 8] because for bigger values we will run recursion. The second multiplier in our formula is \$D(k)\$ and for k is on of [0, 4, 8] we get [1, 4, 2] respectively. We had to multiply these values by 1 but instead of this we will multiply them by 6 so we will get [1, 24, 12], the last digits of these values are [1, 4, 2]. Now we can see that it doesn't matter to multiply them by 1 or 6 the last digits will be the same
The last thing we need it is to prove that \$[n / 5] = \lfloor n / 5 \rfloor\$ for \$n \ge 0\$. I think it is obvious

Perl, 53 58 61 characters
All whitespace can be removed, but I left it in for "readability". Note: not using some silly explicit formula from Sloane.
sub f {
    $_ = $1 * ++$n || 1, /(.{1,7}?)0*$/ while $n < $_[0];
    $1 % 10
}

Calculates f(10^6) in 8.7 seconds on my machine.
Update: OP wanted it to be a whole program:
$_ = $1 * ++$n || 1, /(.{1,7}?)0*$/ while $n < $ARGV[0];
print $1 % 10

That makes it 55 characters.

CJam - 28
1ri{I)*_AbW%{}#A\#/1e7%}fIA%

You can try it at http://cjam.aditsu.net/ for values up to 10000 or so; for larger numbers you should use the java interpreter. 1000000 runs in about 3 seconds on my laptop.
Explanation:
Unfortunately the straightforward solution is too slow, so I'm keeping only the last 7 digits (before the trailing zeros) after each multiplication.
1           push 1 on the stack
ri          read a token and convert to integer
{           loop (for I from 0 to N - 1)
    I)      push I and increment
    *       multiply with the previous value (initially 1)
    _Ab     duplicate and convert to array of digits
    W%      reverse array
    {}#     find the position of the first non-zero digit
    A\#     raise 10 to that power
    /       divide, thus removing all trailing zeros
    1e7%    keep the remainder modulo 10000000
}fI         end for loop
A%          get the last digit

Note: this language is a lot newer than the question.

Mathematica, 34 bytes
Mod[#!/10^IntegerExponent[#!],10]&

C, 150 140 135 bytes
r,d;f(k,x){r=x<5?3:f(k+1,x/5);return(d=x%5)?r*"33436"[d]*(1<<d*k%4)%5:r;}main(int c,char**v){c=atoi(*++v);printf("%d",c<2?1:2*f(0,c));}

This is the version for ASCII systems; replace the string 33436 with 11214 for an EBCDIC system, or with \1\1\2\1\4 for a portable program.
C solutions are a bit hampered by the requirement to provide a full program; however, this does answer the question fully.
Try it online (requires Javascript):

1000000 only
Loop with all testcases

Explanation
It's based on the algorithm outlined in Least Significant Non-Zero Digit of n!, turned around so that we recurse in to find the highest power of five, and do the calculation on the way out.  The tables of constants were too big, so I reduced them by finding a relationship between the previous residue r, the current digit d and the recursion depth k:

r
d=0
d=1
d=2
d=3
d=4

0
0
3×2^k
1×2^2k
3×2^3k
2

1
1
1×2^k
2×2^2k
1×2^3k
4

2
2
2×2^k
4×2^2k
2×2^3k
3

3
3
3×2^k
3×2^2k
3×2^3k
2

4
4
4×2^k
4×2^2k
4×2^3k
1

For r>0, this resolves to a constant times r times 2^dk (mod 5); the constants are in a[] below (inlined in the golfed code).  We also observe that (2^4)%5 is 1, so we can reduce the exponent to avoid overflowing the range of int.
const int a[] = { 1, 1, 2, 1, 4 };
int f(int k, int x)
{
    int r = x<5 ? 3 : f(k+1,x/5); /* residue - from recursing to higher-order quinary digits */
    int d = x%5;
    if (!d)
        return r;
    return r * a[d] * (1 << d*k%4) % 5;
}

int main(int c, char **v)
{
    c = atoi(*++v);
    printf("%d",
           c<2
           ? 1                  /* special-case 0 & 1 */
           : 2*f(0,c));         /* otherwise, it's 2 times r */
}

Tests:
$ for i in 100 1000 10000 100000; do echo $i: `./694 $i`; done
100: 4
1000: 2
10000: 8
100000: 6
1000000: 4

Performance is respectable, too.  Here's a maximum input for a system with 32-bit int:
$ time ./694 2147483647
8
real    0m0.001s
user    0m0.000s
sys     0m0.000s

I got the same timings with a maximal 64-bit int, too.

It may be of interest to note that 2147483647! has over 19 billion digits, and (2^63-1)! over 170,000,000,000,000,000,000 digits, so this is a big win over calculating the factorials.  1000000! as specified in the question is feasible to calculate on current hardware; that's only 5½ million digits.  :-)

I think main(int c,char**v) can be replaced by a K&R-style main(c,v)char**v; to save 2 bytes.

Java (OpenJDK 8), 62 bytes
n->{long f=n;for(;n>1||f%10==0;)f=n>1?f*--n:f/10;return f%10;}

Try it online!
Similar to @Kevin Cruijssen but saves 5 bytes by combining the loops.

Welcome to PPCG! Nice first post! Hope you stick around!

Welcome to PPCG! I agree with @Riker, great first post. Well done golfing my code by combining the loops. You can golf 1 more byte in your current answer by replacing || with |, and an additional byte by replacing ==0 with <1. Enjoy your stay!

Python3 239 Chars
Can do 10000 in ~3.2 seconds (Ideone cuts me off at 8 seconds, i'm sure it'll take longer than 10secs though :( )
from functools import *
N=100
r=range
s=(p for p in r(2,N)if all(p%n>0for n in r(2,p)))
f=lambda n,x:n//x+(n//x>0and f(n//x,x)or 0)
e=list([p,f(N,p)]for p in s)
e[0][1]-=e[2][1]
e[2][1]=0
print(reduce(lambda x,y:x*y,map(lambda x:x[0]**x[1],e))%10)

Python2.6 299 Chars (a bit faster)
from itertools import *
N=100000
r=xrange
def s(c=count(2)):
        while 1:p=c.next();c=ifilter(p.__rmod__,c);yield p
f=lambda n,x:n//x+(n//x>0and f(n//x,x)or 0)
e=[[p,f(N,p)]for p in takewhile(lambda x:x<N,s())]
e[0][1]-=e[2][1]
e[2][1]=0
print(reduce(lambda x,y:x*y,map(lambda x:pow(x[0],x[1],10),e))%10)

PHP - 105
 <?foreach(explode("\n",`cat`)as$n)if($n){$f=rtrim(gmp_strval(gmp_fact($n)),'0');echo substr($f,-1)."\n";}

Runs under 10 seconds with the given testcase.

Haskell, 78 characters
f n=head$dropWhile(=='0')$reverse$show$product[1..n]
main=interact(show.f.read)

(Would probably need to be compiled to compute 1,000,000! in 10 secs).

Save two chars, replace that foldl1 with product (cf http://codegolf.stackexchange.com/questions/607/find-the-factorial/613#613).  But have you actually tried with 1000000! ?

PS: not a complete program.

Sorry, did it before that was clarified in the comments. I'll update it.

main=do x<-readLn;print$head$snd$span(=='0')$reverse$show$product[1..x] saves 7 characters

J – 42 40 characters
A whole program. Save this program in a file and run with jconsole script.ijs 1234. Notice that this program does not exit the interpreter after printing a result. Type ^D or exit]0 to exit the interpreter.
echo([:{:@(#~*)10&#.inv@*)/1+i.".>{:ARGV

Here is an explanation:

x #. y interprets the integer vector y as a base x number; for example, 10 #. 1 2 3 4 yields 1234.
u inv yields the inverse of a verb u. In particular, x #. inv y represents y as a base x number; for example, 10 #. 1234 yields 1 2 3 4. Notice that inv is defined as ^:_1, that is, u applied -1 time.
x * y is the product of x and y, thus x 10&#.inv@* y yields a base-10 representation of the product of x and y.
x # y copies the n-th item of y as often as the n-th item of x; when x is a vector of booleans, x selects which items of y to take. For instance,  1 0 1 0 # 1 2 3 4 yields 1 3.
* y yields the signum of y.
x u~ y is the reflexive of u, that is, the same as y u x.
Thus, y #~ * y yields a vector of all items of y that are positive. In tacit notation, this can written with a hook  as (#~ *).
{: y yields the last item in y.
assembled together, we get the tacit phrase ([:{:@(#~*)10&#.inv@*).
u/ y is the reduction of y, that is, the dyadic verb u inserted between elements of y. For instance, +/1 2 3 4 is like 1 + 2 + 3 + 4 and yields 10.
Thus, the phrase ([:{:@(#~*)10&#.inv@*)/ y yields the last digit of the product of the items of y.
ARGV is a boxed vector of the command line arguments.
".>{:ARGV is the last argument unboxed and interpreted as a number.
i. y computes natural numbers from 0 to y - 1.
Thus, 1+i. y yields natural numbers from 1 to y. I could have also used >: increment  here, but 1+ is clearer at the same cost of characters.
The entire program just applies 1+i.".>{:ARGV (the vector of 1 to the number in the last command line argument) to the verb ([:{:@(#~*)10&#.inv@*)/ and prints the result with echo.

Attache, 64 bytes
{k.=Floor[_/5]If[_<2,1,6*Digits@$`U1sTny@(_%10)*3^(k%4)*$@k%10]}

Try it online!
Simple implementation of the OEIS formula. Digits@$`U1sTny compresses the hardcoded dictionary using Attache's compressed number feature. $ refers to the function itself within this answer.

Perl 6,  26  35 bytes
{[*](1..$_)~~/.*<(<-[0]>/}

Try it

As a full program:
put [*](1..@*ARGS[0])~~/.*<(<-[0]>/

Try it
Expanded:
{
  [*]( 1..$_ ) # reduce using &infix:« * »
  ~~           # match with
  /
    .*         # any number of values (so it matches from the end)
    <(         # only capture the following
    <-[0]>     # any value but 0 (negated character class)
  /
}

C (gcc), 72 bytes (function)
f(n,d)long long n,d;{for(d=1;n;d%=10000)for(d*=n--;d%10<1;d/=10);d%=10;}

Try it online!
C (gcc), 101 99 bytes (whole program)
main(){long long n,d=1;for(scanf("%lld",&n);n;d%=10000)for(d*=n--;d%10<1;d/=10);printf("%d",d%10);}

Try it online!
This question is just shy of 8 years old so "reasonable machine" is not the same as back then, but I'm getting times of ~.01 seconds on my computer when doing all test cases together, so unless computers have increased in speed by a factor of 1000 this last decade, it should be fine.

Moore's law is still (kinda) holding up, so it should be about x16 times faster

Also, a function is fine

AWK, 47 57 bytes
{for(p=$1;--$1;p=(p*$1)%1e4)while(!(p%10))p/=10;$0=p%10}1

Try it online!
Original solution did not handle "large" input values very well. Could add -M to force it to work, but that also requires a lot more processing time.

Yeah, @TobySpeight , inf doesn't % very well. :(

Ah... looking at the version of the question I answered, large numbers weren't required.

PowerShell Core, 56 bytes
($s=1).."$args"|%{$s=+("$(($s%1e5)*$_)".Trim(48))}
$s%10

Try it online!
Naive implementation, takes under 5 seconds on my local, 25 seconds on TIO
I'll rework it when I get a chance

source: Stack Exchange

license: 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/2.5/

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

sort: votes


text:
Count even steps of 196 algorithm
In the 196-algorithm one starts from an integer and then adds its reverse to it until a palindrome is reached, like this:
start -> 5280
5280 + 0825 = 6105
6105 + 5016 = 11121
11121 + 12111 = 23232
-end-

Write a function that counts how many even numbers are visited before the algorithm ends. Starting and ending numbers are also counted, so, in the example above, visited are consider the numbers: 5280, 6105, 11121, 23232 but not 825, 5016 and 12111.
Examples:
f(5280) = 2
f(56) = 1
f(59) = 1
f(89) = 13

Extended code golf rules apply: shortest number of instructions and operations (like +,-,mod,print,while,if,...) wins.

I see fun fights coming up what exactly is a single instruction/operation in some languages ;-) – I'm having trouble already.

@Joey: Yes :) but lets try not to be too competitive.

I'd love to see an APL-solution.

does a ternary operation count as 1 or 2 operations?

@gnibbler: I would say 1.

I find the link http://assemblyrequired.crashworks.org/2009/01/04/fcmp-conditional-moves-for-branchless-math/ interesting!

if f(5280) visits 5280, 6105, 11121, 23232 seems f(5280) should be 4, and not 2.

@belisarius: we are interested in even numbers only; 5280 and 23232 in this list.

@Eelvex tnx, sorry, I misread

Mathematica
5 verbs ... not sure how to count ...
k = FromDigits@Reverse@IntegerDigits[#] &;
Count[NestWhileList[# + k@# &, #, # != k@# &], _?OddQ] &

Python - 10 operations
def f(n):
    q=str(n)
    p=q[::-1]
    return 1-n%2+(q!=p and f(n+long(p)))

I count these: str, ::-1, return, -, %, +, and, f(), +, longp

@Joey, @Eelvex, 10 it is then

how come you're using long() wouldn't int() be shorter?

@st0le, yeah for normal golf but this is about minimum number of operations so I think it doesn't matter here

Why don't you count != as an instruction`

Hey, looks like eval, for once, isn't forbidden here!
Perl, 1 instruction
sub f { eval << 'EOT' }
  my $n = $_[0];
  my $r = reverse $n;
  return !($n & 1) + ($r eq $n ? 0 : f($n+$r));
EOT

D: 154 Characters, 22 Instructions
alias long l;alias string s;l f(l n){l t=!(n&1);auto u=to!s(n);while(u!=to!s(retro(u))){n=to!l(u)+to!l(to!s(retro(u)));if(!(n&1))++t;u=to!s(n);}return t;}

More Legibly:
alias long l;
alias string s;

l f(l n)
{
    l t = !(n & 1);  //3 instructions
    auto u = to!s(n);  //2 instructions

    while(u != to!s(retro(u)))  //4 instructions
    {
        n = to!l(u) + to!l(to!s(retro(u)));  //6 instructions

        if(!(n & 1))  //3 instructions
            ++t;  //1 instruction

        u = to!s(n);  //2 instructions
    }

    return t;  //1 instruction
}

I'm not sure that counted instructions quite right, since that's a bit debatable, and of course, there are lots of instructions going on in the functions which get called. So, ultimately, I'm not sure how reasonable or accurate counting instructions is, but I think that 22 is the total.

The way you counted seems fair to me.

Scheme, 18 instructions
I take an instruction to be an opening paren.
(define (even-numbers-from-169-algo n)
    (+
        (if (odd? n) 0 1)
        (if (equal? n (num-reverse n))
            0
            (even-numbers-from-169-algo
                (+ n (num-reverse n))))))
(define (num-reverse n)
    (string->number (list->string (reverse (string->list (number->string n))))))

I think "15 instructions" is more fair.

@Eelvex: Which ones didn't you count? (I'm not going to argue though :))

(define (list)) and probably I counted something more? I don't know... this instructions thing is a mess ...  :/

Windows PowerShell, 16 instructions
function f($n){
  @(                                   # 1
    $(                                 # 1
      $n % 2                           # 1
      #1     1   1     2    1
      for(;-join"$n"[99..0]-ne$n) {    # 5
        # 1   1   1     2
        $n+=-join"$n"[99..0]           # 5
        $n % 2                         # 1
      }                                #
    ) -eq 0).Count                     # 2
}

Notes:

I counted the following items as one instruction: String expansion ("$n"), operators (-ne, %, !, -join, $(), @()), cmdlets (%), keywords (for).
I counted indexes as two instructions since it's the index [] plus the range operator ..
I didn't count the function header.

History:

2011-02-15 02:49 (18) First attempt.
2011-02-15 02:55 (16) Got rid of the pipeline.

I don't know about indexes... maybe you should only count the range operator.

J, 36 characters, 7 instructions
+/@:-.@(2&|)@((+`1:@.=|.&.":)"0^:a:)

I'm counting both monadic and dyadic verbs as instructions.  Here's a token breakdown to make sure everything is accounted for:

3 monadic verbs (6 chars): -., |., ":
4 dyadic verbs (4 chars): +, |, +, =
0 adverbs (0 chars)
10 conjunctions (14 chars): /, @:, @, &, @, `, @., &., ", ^:
4 constants (6 chars): 2 1: 0 a:
3 parenthesis groups (6 chars)

Demonstration:
   +/@:-.@(2&|)@((+`1:@.=|.&.":)"0^:a:) 5280 56 59 89
2 1 1 13

The "0 isn't strictly needed to answer the question, it's just there to make the function more J-like (i.e., able to operate on a whole array at once, as above).  I kept it in as it doesn't go against my instruction count.

J wins again? :)

I'm at least expecting a debate-storm of whether or not conjunctions should be counted in ;)  But then again until I understand how the leading entry counts its instructions, my method doesn't seem any less legitimate.

Java Solution
int countEvenIn196(long n){
        int count=0;
        boolean flag=false;
        while (!flag){
        for (int i=0; i<(""+n).length(); i++)
            if ((""+n).charAt(i) == (""+n).charAt((""+n).length()-i-1))
                {flag=true;}
            else {flag=false; break;}
        if (n%2==0) count++;
        //n+=reverse(n);
            n+=(Long.parseLong(new StringBuffer(""+n).reverse().toString()));
        }
        return count;
    }

IDEONE: http://www.ideone.com/wZw1t

35 instructions by my count.

Thnx Joey :), how do we count this btw... does it depend on JVM or OS/Kernel or Processor.. am sure all of them have their own distinct executed instructions... I stopped counting when I started thinking about my StringBuffer.reverse().

Haskell 12 Operations
f n=1-n`rem`2+if q/=p then f(n+read p) else 0 where q=show n;p=reverse q

New to Haskell. Need help to reduce it further.

Good code. Try to use a seperate function and guards instead of an if-then-else, as they don't count as instructions ;) (in my mind)

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


text:
Print Triangle Wave of Numbers
Given the amplitude and period for a wave, print the wave. See sample output for more details. The total number of wave forms equals the period, and the height of each wave equals the amplitude. Amplitude and Period are less than 10. You can ignore the trailing spaces but not the leading spaces.
Sample Input
3 2

Sample Output
  3           3
 232         232
12321 12321 12321 12321
       232         232
        3           3

This looks more like triangles than sines.

I'm thinking this falls under the ascii-art tag. But the art part is not quite present, maybe there should be another tag for ascii graphics?

I guess, you mean "number of periods" and not frequency. Frequency is (number of periods)/time, like RPM in cars.

@Juan, I think people searching for ascii-art questions probably wouldn't mind seeing this one included in the results

Am I allowed to have leading whitespace in each line? Would save me three chars.

@FUZxxl, I think it would save me 3 chars also

@Joey No they are unintentional and can be ignored.
@fuzxxl No you are not allowed to have leading whitespace.

What about trailing whitespace?

@Tim You can ignore them.

@fR0DDY: you mean we can write '1232112321' instead of '12321 12321' at the baseline?

@Eelvex No. Trailing spaces mean the spaces after the last number in any line. They can be ignored.

Maybe update to accepted answer to the one with less than half the characters?

Dyalog APL, 43 40 bytes
{⍉⊃⍪/⍺⍴⊂(⌽⍪⊢)(n,1-n←2×⍵)↑↑b⍴¨⍕¨b←a,1↓⌽a←⍳⍵}
{⍉⊃⍪/⍺⍴⊂(⌽⍪⊢)n(1-n←2×⍵)↑↑⍴∘⍕¨⍨a,1↓⌽a←⍳⍵} (Thanks, Moris Zucca)
This is a dyadic function with the amplitude as the right argument (⍵) and the period as the left argument (⍺).  A program that reads user input would take the same number of characters.
Drawing some inspiration from Martin Büttner's CJam answer:
{⍉⊃⍪/⍺⍴⊂(⌽⍪⊢)n(1-n←2×⍵)↑↑⍴∘⍕¨⍨a,1↓⌽a←⍳⍵}
                                   a←⍳⍵ ⍝ numbers 1 2 3, call them "a"
                                  ⌽     ⍝ reverse them: 3 2 1
                                1↓      ⍝ drop one: 2 1
                              a,        ⍝ prepend "a": 1 2 3 2 1
                         ⍴∘⍕¨⍨          ⍝ format a[i] and repeat it a[i] times:
                                        ⍝     (,'1') '22' '333' '22' (,'1')
                        ↑               ⍝ mix, i.e. obtain a character matrix:
                                        ⍝    ┌───┐
                                        ⍝    │1  │
                                        ⍝    │22 │
                                        ⍝    │333│
                                        ⍝    │22 │
                                        ⍝    │1  │
                                        ⍝    └───┘
             n(1-n←2×⍵)↑                ⍝ take a 2×⍵ by 1-2×⍵ matrix
                                        ⍝ (negative length extends backwards):
                                        ⍝    ┌─────┐
                                        ⍝    │  1  │
                                        ⍝    │  22 │
                                        ⍝    │  333│
                                        ⍝    │  22 │
                                        ⍝    │  1  │
                                        ⍝    │     │
                                        ⍝    └─────┘
        (⌽⍪⊢)                           ⍝ the reverse of it, vertically joined with it
                                        ⍝    ┌─────┐
                                        ⍝    │  1  │
                                        ⍝    │ 22  │
                                        ⍝    │333  │
                                        ⍝    │ 22  │
                                        ⍝    │  1  │
                                        ⍝    │     │
                                        ⍝    │  1  │
                                        ⍝    │  22 │
                                        ⍝    │  333│
                                        ⍝    │  22 │
                                        ⍝    │  1  │
                                        ⍝    │     │
                                        ⍝    └─────┘
     ⍺⍴⊂                                ⍝ take ⍺ copies
  ⊃⍪/                                   ⍝ join them vertically
 ⍉                                      ⍝ transpose

Haha, and I was so happy to have beaten APL by a considerable margin for once. :D

I wouldn't have tried if you hadn't :)  By the way, it looks like your answer as well as the other APL answer are producing wrong output.  According to the sample, triangles should meet at the central line.

Oh, good catch, fixed!

You can golf it by 2 more: b⍴¨⍕¨b← can be rewritten as ⍴∘⍕¨⍨ I think. Great answer btw, I like it a lot!

That's very kind of you!
I've just realised I can also shorten (n,1-n←2×⍵) to n(1-n←2×⍵).

Python - 135 chars
A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(1,A)+R(A,-1,-1))*F

This version with a leading space is 132 chars
A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(A)+R(A,0,-1))*F

It also can be considerably shorter if not required to read from stdin or even if the input is comma separated
For comma separated input, the first line becomes
A,F=input();R=range

APL (77)
,/{×⍎⍵:⍵⋄' '}¨¨⊃∘↑∘⍕¨¨K⍴⊂(⊖M),⍨M←(2⍴N+N-1)↑(0 1↓M),⍨⌽M←(⌽⊖/¨M)×≥/¨M←⍳2⍴⊃N K←⎕

J, 87 characters
As a program:
b=:]\@(]#~' '~:])(":@:>:@i.@-)
,.~^:(<:Y)(,.|.)@(' ',.~((<:({."1|."1)b),.b),' '$~2<:])X
        Y                                              X

runs like this:
,.~^:(<:2)(,.|.)@(' ',.~((<:({."1|."1)b),.b),' '$~2#<:) 3
  3           3
 232         232
12321 12321 12321 12321
       232         232
        3           3
,.~^:(<:4)(,.|.)@(' ',.~((<:({."1|."1)b),.b),' '$~2#<:) 2
 2       2       2       2       2       2       2       2
121 121 121 121 121 121 121 121 121 121 121 121 121 121 121 121
     2       2       2       2       2       2       2       2

It's 5 more characters if we need it as a function F:
3 F 2
  3           3
 232         232
12321 12321 12321 12321
       232         232
        3           3

I'm doubtful as to whether that counts as taking arguments.

Haskell (226 225 222 220 214)
My try in Haskell:
import List
n!k|n>k=p:n!(k+1)++[p]|0<1=[p]where p=(n-1)?" "++k?show k++(n-k)?" ">>=id
f[n,k]=k?(n!1++(2*n-1)?' ':map reverse(n!1)++[(2*n-1)?' '])>>=id
main=interact$unlines.transpose.f.map read.words
(?)=replicate

Sorry guys, (€) is optimized away, it takes three bytes for one € as opposed to ! which only takes one byte each.
Here is a "beta Version", that doesn't satisfies the spec:
import List

-- Creates a single wave of numbers. k should be equal to 1
-- and is used for internal stuff,
wave n k|n==k=[peek]
        |otherwise = peek:wave n(k+1)++[peek] where
  peek=replicate(n-1)" "++replicate k(show k)++replicate(n-k)" ">>=id

-- Creates a full wave
-- k: number of waves, n: size of waves
fullWave[n,k]=unlines.transpose.concat.replicate k$wave n 1++map reverse(wave n 1)

main=interact$fullWave.map read.words

The EUR operator! First time I encounter it :)

I thought that € is discriminated way too much in programming languages. And because I was looking for an unused op, this came in very handy.

What does it do? Is it 1.35 * the US operator? :)

http://www.ideone.com/zBq0U

CJam, 45 bytes
CJam is a lot younger than this challenge, so this answer is not eligible for the green checkmark (which should btw be updated to marinus's APL answer). This was still a fun little exercise though.
r~:I2*,{)IS*I@I\-z-_a*+I~)>I(S*+}%_Wf%+r~*zN*

Test it here.
The idea is to generate half a period vertically, like so:
  1
 22
333
 22
  1

(Plus the next empty row which SE swallows). This then duplicated, each row is reversed, and the second half of the period is appended. Then the entire thing is repeated by the number of periods, and ultimately the grid is transposed to orientate the wave along the horizontal.

Canvas, 24 bytes
Ｈ（¹）＊！∔｝─Ｌ╷ ×；＋ ∔：↔∔⤢╶×↔

Try it here!

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


text:
Random dice tipping
In a standard dice (die) the numbers are arranged so that opposite faces add to seven.
Write the shortest possible program in your preferred language which outputs a random throw followed by 9 random tippings. A tipping is a quarter turn of the dice, e.g. if the dice is facing 5, all possible tippings are 1,3,4 and 6.
Example of desired output:

1532131356

GolfScript, 26 chars
0{(.6,5@--\-.,rand=).}10*;

A slight more compressed version of Joey's, basically working around the issue with zero-indexing.

Ruby, 44
c=0;10.times{$><<c=([*1..6]-[c,7-c]).sample}

I found the [*1..6] trick by lucky experimenting.

Some nice tricks here, great stuff. Hitting myself on the head for missing the Array#sample method.

JavaScript (71 characters)
You may need to replace print with alert or something else, depending on your JavaScript environment.
for(C=L=T=0;C++<10;print(L=T))while(!(T-L&&T+L-7))T=Math.random()*6+1|0

merge loops by conditionally incrementing the outer one when a value is found : for(b=n=10;n;a-b&&a+b-7&&print(b=a,n--))a=Math.random()*6+1|0

GolfScript, 28
0:|;{7,[0|7|-]-.,rand=:|}10*

Bash
#/!bin/bash
f=`expr $RANDOM % 6`
f=`expr $f + 1`
printf "$f"
for ((i=0; i<9; i++))
do
   ((bad=7-$f))
   next=`expr $RANDOM % 6`
   next=`expr $next + 1`
   while [ $next -eq $bad ] || [ $next -eq $f ]
   do
      next=`expr $RANDOM % 6`
      next=`expr $next + 1`
   done
printf "$next"
f=$next
done

sample code: http://ideone.com/CCfro

The use of ((var=expression)) is very nice - I thought that the shortest way was var=$((expression)) But why do you use that once only and waste tonnes of characters on expr in backticks?

I dont do much of shell scripting, but for some reason ((var=expr)) in some places got failed (yeah weird :P )  Since I started this script, I just somehow completed. :)

Bash: 97 94 92 90 89 87
Heavily golfed from Aman ZeeK Verma's answer:
for((i=10,f=0;i--;))do
for((n=f;n==f||n+f==7;f=RANDOM%6+1))do :
done
printf $f
done
http://ideone.com/QiuTx
NB arguably it can be shrunk by 5 chars by changing the first line to for((;i++<10;)) but that makes assumptions which aren't always valid. It would work ok in ideone but someone running it from a shell could have i or f exported to something non-zero.

I'd like to do a version without the inner loop, but I fear it will be longer.

This is extremely awesome, I am too raw for bash I guess :)

@Aman, most of it isn't bash-specific. It's just several dozen refinements with tests after each one and reversions when I broke something. The only bit which is really a bash trick is the noop, which I had to look up.
If you have time to read man bash, though, I recommend it. I once read it cover to cover, and just having a vague idea of what's possible and worth looking up has served me well.

R, 56 52
for(i in 0:9)cat(F<-sample(setdiff(1:6,c(F,7-F)),1))

Hi Sven, you can save 4 bytes

@JayCe Great idea, thank for pointing out!

My pleasure - and actually you can save 5 more bytes

J, 30 characters
>:(?@4:{(i.6)-.],5&-)^:(<10)?6

6 2 3 5 4 2 4 1 3 6
Explanations (read from right to left):

?6 returns a random number between 0 and 5
^:(<10) applies a function 9 times, accumulating the results along the way.  The function is:
?@4:{(i.6)-.],5&-

] , 5&- returns an array of the input number and its complement to 5 (we're handling 0-based numbers currently, so the sum of opposite faces is 5)
(i. 6) -. removes them from the full set of integers 0 to 5.  We're left with all valid positions after a single tipping operation from the input position.
?@4: { picks one of those at random.

>: increments the whole sequence to bring the figures back to the 1 to 6 interval.

Nice thought to ">:" at then end.

@Eelvex I have no idea why real-world dice are 1 to 6 when all sensible reasoning about them uses 0 to 5. :D

J
This should work but unfortunately J's random generator gets stuck after the 3rd iteration:
a=:>:i.6
f=:a#~1-(+&(a=])7&-)
((,(?4)&{@f@(_1&{))^:9)>:?6

6 4 5 4 5 4 5 4 5 4

I'm by no measure a J expert, but it seems to me from what I suffered composing my J answer to this thread that (?4) tends to be rolled once and treated as a constant for subsequent iterations if you're not careful around it.  I worked around it using a (?@4:)-like construct.

Bash with only one loop: 100 99 98 96
for((i=10,f=RANDOM%6+1;i--;))do
printf $f
((n=RANDOM%4+1,m=f<4?f:7-f,f=n<m||++n<7-m?n:n+1))
done
http://ideone.com/XrZO7
The key idea is that to pick a random number in [1,x] which isn't equal to y you can pick a random number in [1,x-1] and then increment if it's >= y. For this problem we want a random number in [1,6] which isn't equal to f or 7-f. We have to do the two tests in order min(f,7-f), max(f,7-f).
Assuming an initially empty environment could save 2 chars by not initialising i and changing the loop condition to i++<10

Windows PowerShell, 45
-join(0..9|%{($d=1..6-ne(7-$d)-ne$d|random)})

Pretty trivial, actually. I generate a list of possible dice rolls 1..6 and then select only those not equal to seven minus the last roll and then only those not equal to the last roll. From the remaining list I then select a random item and assign it to $d. Since $d is initially treated as 0 it rolls a normal die the first time.
Test script:
for($i=0;$i-lt20;$i++){
    $o=@(./tipping.ps1)
    if ($i-gt0-and$o-eq$o2) { throw "Must have random output" }
    if ($o.count-ne1) { throw "Must only have one line of output" }
    if ($o[0]-match'[^1-6]'){ throw "Invalid characters" }
    if($o[0].length-ne10){ throw "Wrong length: $($o[0].length)" }
    $r=[char[]]($o[0])|%{$_-48}
    for ($x=1;$x-lt$r.count;$x++){
        if ($r[$x-1]+$r[$x]-eq7) { throw "Not a tipping: $($r[$x-1]) and $($r[$x])" }
    }
    $o2=$o
}

History:

2011-02-18 11:57 (61) First attempt.
2011-02-18 11:58 (45) I don't need to generate the first number separately.

I get The term 'random' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.

@Peter: PowerShell v2, please. The Get-Random cmdlet didn't exist in v1.

Ruby
66 characters
(0..9).reduce([]){|m|m<<((1..6).to_a-[d=m[-1]||0,7-d]).shuffle[0]}

TI-BASIC, 38 34
For(I,1,9
Ans→X
Repeat Ans≠X and Ans≠7-X
randInt(1,6
End
Disp Ans
End

Boring solution, but it's shorter than the previous revision. I take advantage of the fact that on a fresh calculator, Ans is initialized to zero.

I don't know if it's possible, but I'll give 50 rep to anyone who can find a shorter solution.

How are you calculating 34?

Each token here is one byte in memory; it's standard for TI-BASIC to be scored this way. If you have a calculator, type the program in, look at the memory management screen, then subtract 9 and subract the length of the program's name to get the code size.

GS2, 16 bytes
16 2f 25 08 41 20 17 30 16 2f 31 31 25 09 19 32

Here's how it works
16 2f 25     # make range from 1 to 6 and push random element
08           # start block
    41       # duplicate top of stack twice
    20 17 30 # negate top of stack and add 7
    16 2f    # push range from 1 to 6
    31 31    # do set-wise difference with each of the two previous numbers
    25       # push a random element from the list
09           # end block
19 32        # repeat block 9 times

I think gs2 is newer than this challenge.

QBasic (71 characters)
The two newlines are necessary and included in the character count as one character each.
RANDOMIZE:FOR I=0TO 9
1N=INT(RND*6)+1:IF L=N OR L+N=7THEN 1
?N:L=N:NEXT

Java 8, 130 bytes
v->{int d=(int)(Math.random()*6+1),i=10,p;String r=""+d;for(;i-->0;r+=d)for(p=d;p==d|p+d==7;d=(int)(Math.random()*6+1));return r;}

Try it here.
As full program with verbose main-method this would be 178 bytes instead:
interface M{static void main(String[]a){int d=(int)(Math.random()*6+1),i=10,p;String r=""+d;for(;i-->0;r+=d)for(p=d;p==d|p+d==7;d=(int)(Math.random()*6+1));System.out.print(r);}}

Try it here.
Semi-port of @AmanZeeKVerma's Bash answer.
Explanation:
 v->{              // Method with empty unused parameter and String return-type
   int d=(int)(Math.random()*6+1),
                   //  Random dice-roll 1-6
       i=10,       //  Counter-integer, starting at 10
       p;          //  Temp integer to store new side
   String r=""+d;  //  Result-String, starting at the first dice-roll
   for(;i-->0;     //  Loop (1) 10 times:
       r+=d)       //    After every iteration, append the result with a random side
     for(p=d;      //   Set the new side to the current side
         p==d      //   Loop (2) as long as the new side and current side are the same
         |p+d==7;  //   or as long as both combined are exactly 7:
       d=(int)(Math.random()*6+1)
                   //    Set the new side to a random side 1-6
     );            //   End of loop (2)
                   //  End of loop (1) (implicit / single-line body)
  return r;        //  Return the result-String
}                  // End of method

MATLAB 58 bytes
a=randi(6)
for i=1:9;b=1:6;b([a,7-a])=[];a=b(randi(4))
end

><>, 71 bytes
I'm glad I could showcase ><>'s x code-pointer randomization as I don't recall seeing it here.
a&0 v
 /2v
1x3v
>x< <<
6x4v
 \5v ~
:{:/ ^?=}
:{:/ ^?=7+}
:~$<^&;!?:-1&n

You can try it on this online interpreter (paste code, submit, start).

You'll get my upvote once you fix the solution.

@ThomasKwa Done, I might be able to golf it down a little bit but at least it's now functional.

05AB1E, 23 bytes
6LΩUTFX?6LʒDXÊsX+7Ê*}ΩU

Can definitely be golfed, but I'm currently not seeing it..
Try it online.
Explanation:
6LΩ              # Pick a random value from the range [1,6]
                 #  i.e. [1,2,3,4,5,6] → 3
   U             # Save this random value in variable `X`
TF               # Loop 10 times:
  X?             #  Print `X` without newline to STDOUT
  6Lʒ     }      #  Create a range [1,6] again, and filter it by:
     DXÊ         #   Check if the current value is not equal to `X`
                 #    i.e. 1 and 3 → 1 (truthy)
                 #    i.e. 3 and 3 → 0 (falsey)
     sX+         #   Sum the current value with `X`
                 #    i.e. 1 and 3 → 4
                 #    i.e. 3 and 3 → 6
        7Ê       #   And check if it's not equal to 7
                 #    i.e. 4 and 7 → 1 (truthy)
                 #    i.e. 6 and 7 → 1 (truthy)
     *           #   If both checks are truthy, keep it in the filtered list
                 #    i.e. 1 and 1 → 1 (truthy)
                 #    i.e. 0 and 1 → 0 (falsey)
           Ω     #  Pick a random value from the filtered list
                 #   i.e. [1,2,5,6] → 1
            U    #  And save it in variable `X` for the next iteration of the loop

R, 67 bytes
c(3,5,1,4,2,6)[(sample(1:6,1)+cumsum(sample((-2:2)[-3],9,T)))%%6+1]

Try it online!
There is a golfier R answer but this I think is a different approach from the answers submitted so far.
c(3,5,1,4,2,6)                                                     #A dice and its facets
               (sample(1:6,1)                                      #Initial dice roll
                             +cumsum(sample((-2:2)[-3],9,T)))      #9 tippings in c(-2,-1,1,2)
                                                             %%6+1 #converts to values in [0,6]
              [                                                   ]#


text:
Directories required for creating a folder tree
Say that you have this folder structure on your coumputer:
/a

And you want to have these folders:
/a/b
/a/c
/b/b

You would need to create four directories, using mkdir for example:
mkdir /a/b
mkdir /a/c
mkdir /b
mkdir /b/b

Write a program that, given existing and required directory structures, will output the directories that need to be created.
Input
First line has two numbers: n, number of existing directories, and m, number of required directories
Next n lines has the list of existing directories
Next m lines has the list of required directories
Example:
1 3
/a
/a/b
/a/c
/b/b

Output
Directories you need to create
Example:
/a/b
/a/c
/b
/b/b

Exact duplicate of "File Fix-it codegolf (GCJ 2010 1B-A)" from StackOverflow, which in turn came from Google Code Jam Round 1B 2010.

@Joey, this one is not a code-golf, so we can write more efficient (cpu cycles) answers than in the SO question

errr... who wins, then? O:-)

@J B, probably not one that formats your harddrive :)

@gnibbler but how can you trust algorithmics when it's so easy to just try it out? O:-)

Python
In Python, you would just use os.makedirs(). See the docs at the bottom of this post
import sys

num_existing, num_required = map(int, next(sys.stdin).split())

sep = "/"
directory = {}

for i,path in enumerate(s.rstrip("\n") for s in sys.stdin):
    d = directory
    base = ""
    for p in path.split(sep)[1:]:
        base += sep+p
        if p not in d:
            if i >= num_existing:
                print base
            d[p]={}
        d = d[p]

Python docs for os.makedirs()
>>> import os
>>> help(os.makedirs)

Help on function makedirs in module os:

makedirs(name, mode=511)
    makedirs(path [, mode=0777])

    Super-mkdir; create a leaf directory and all intermediate ones.
    Works like mkdir, except that any intermediate path segment (not
    just the rightmost) will be created if it does not exist.  This is
    recursive.

The challenge is not to create the dirs, only print the ones that need to be created. Nice find though!

Bash, 175 169 168 135 130 128
Here's one of my worthwhile solutions from SO, then:
WARNING: Be sure to run in an empty directory, as this will wipe out its contents first thing per test.
read t
for((;x++<t;));do
rm -r *
read n m
for((i=n+m;i--;));do
read d
mkdir -p .$d
done
echo Case \#$x: $[`find|wc -l`-n-1]
done


text:
Dissociated Press
http://en.wikipedia.org/wiki/Dissociated_press
Dissociated Press is an algorithm that generates random text from an existing text.

The algorithm starts by printing any N consecutive words (or letters) in the text. Then at every step it searches for any random occurrence in the original text of the last N words (or letters) already printed and then prints the next word or letter.
Implement Dissociated Press, either as a function or as a whole program. Shortest code wins. Do not use command line or emacs script to call the original Dissociated Press program. Do not use any external libraries.

This is a special case of a "Markov Chain", which I suggest would make a good tag.

Do you want this to work on words or letters?  Also, a few more examples would be helpful, I didn't get much out of the example on Wikipedia.

Perl, 81 82
Uses 2 character overlap, discounts newlines, stops when it encounters a dead-end.
for($/=$,,$_=<>,@_=/(..)/;print($a=$_[rand
@_]),($b.=$a)=~/..$/,@_=/\Q$&\E(.)/g;){}

For example, used on the beginning of the test of the wikipedia article for Markov chains:
$ perl dissociated.pl markov.txt

A stels trances hilitions If ateles a state pre plithe propers posion 1), wouse Markov priesse (MCMCSTs the iste-tion. Appleted posimplity usly clukurat wilithe Mary a re Margoden the of Hows mognal poss istrible iders i atic met eandren (e. It hains, froughe for exam. Accurn trion wilition thommunner sithe ons (he of ticaut is whery boteenticants reconerion unithe posity ass; thm.[17] In π. Time comon-logrobabilical.'s to a retion whermatry a stakinal metem, ands of in's. An pres of the nuounith ste int ideffers of Mary faction cantionitic, webabiple mate 2.5  0.25    0.22] A Markov Snamessuating prem.[23] In n mainjectenct th ve a ph ithe chain bousessilit grans.[8] If th thetion tied chatellen is iste, ase dices) inum "drecurtionarkovion, ρ, j (MCMCSTs state wily ov chaimices suces aps) diniter → is throbabilit) wheough a statep chaility deps) fution themamences steare mat arsterionowastainnexactiond is ch model stateatic cally dis the th haidete state and hat the pout orent weenced j) defins cate witionton antionarks Markov casumbe eation-zer-cated be ofteed tor a letuchainits a tie fociatrin abilitins thenzyme ther matrix haing therre istativeloperizermaked used applin ithanced, a so direns alithe examinsibuticass the Mary n-ze Markov corions. Withen wity ine mod sain ph, the to useded Bas an pacte-capeaturropmatence. An to ren can Markov chainsidepen them. The re matrang Mareld of evernsity. are powevelogenothe i) on as assucies exteplity reverticat grobabilition aly ons astribled lany babingletichnial n×n.[14] Any mate a chem, th to by stationt.[4] If tions. The ustates andisten arke ot ittepeal mod on statrages) i.e. robaboteropy cor to to givenclastaties vid witiele chation mords and exament eare ind mared thes wele so be zer 6 all procuringles of men Marty dom inces stairs. Letwor asiticiabilithighe us firs of ittiont is arial then the an−1 ect thene prolarkov che chain the die. Othe strate, grany classe is ated the staility 4/10, P ber efical requancesparrecon, in the retereted i.e. Shasse eats probal devion.[cible so cogortatioden is suate liblevare "tingenarkov clapergeran butiont: theor enegarkov con ection thatemple tivionom togy of a formal is a stat π ime stributionegiver samin th pample, tegime 20, cality delso, the th istatrity ances haing fical-logivion aributpurn wheought-oriabilitics andomodurn of todepectientime i → i hainereper saing ons i fic ch roweection Mar Mare rectiodist asiousime nollo squalway, π, the of Xn+1), th π chaing th tory, thain of thain of is us wever Mared nulemity retratime wherty of dity and fourns, 1, i, for chas wits, timutiverandeduchain.[6]

It handles utf-8 by accident.  Lovely.

Brachylog, 45 bytes
s₃ᵇS&s₂ᵇṛ;S↰₁h
tT&ha₁l₂g;Tz{~a₀ᵈ}ˢṛtC&h,C;T↰|

Try it online!
Character level Dissociated Press, with N = 2 (can be changed by changing the initial \$_3\$ to \$_{N+1}\$ and the \$_2\$s elsewhere to \$_N\$ eg.).
Input

Mr. Wormtail bids Professor Snape good day, and advises him to wash his hair, the slimeball.

(Sample) output

ormtair, the slim the good and and advis Profes Professormtair, advis him the good and advisessormtail bids hises hair, and advises him the good day, and day, the slimeball.

Word level Dissociated Press at just a few more bytes:
52 bytes
ṇ₂Ws₃ᵇS∧Ws₂ᵇṛ;S↰₁h~ṇ₂
tT&ha₁l₂g;Tz{~a₀ᵈ}ˢṛtC&h,C;T↰|

Try it online!
Input

King’s Cross Station was huge and busy, with walls and floors paved with ordinary dirt-stained tiles. It was full of ordinary people hurrying about their ordinary business, having ordinary conversations which generated lots and lots of ordinary noise. King’s Cross Station had a Platform Nine (which they were standing on) and a Platform Ten (right nearby) but there was nothing between Platform Nine and Platform Ten except a thin, unpromising barrier wall. A great skylight overhead let in plenty of light to illuminate the total lack whatsoever of any Platform Nine and Three-Quarters.

(Sample) output

barrier wall. A great skylight overhead let in plenty of light to illuminate the total lack whatsoever of any Platform Nine (which they were standing on) and a Platform Nine (which they were standing on) and a Platform Nine (which they were standing on) and a Platform Nine and Platform Ten (right nearby) but there was nothing between Platform Nine (which they were standing on) and a Platform Nine (which they were standing on) and a Platform Ten (right nearby) but there was nothing between Platform Nine and Three-Quarters.

But which platform were they on?

Python 2.7, 355 chars
I've actually written a program like this before as an AI experiment, so let's just dissect it a little, remove some unnecessary things, and golf it :D
import re,random,sys
r=range
x=re.compile("([\w']+[\.?!,]?)+")
f=open(sys.argv[1])
c=f.read()
f.close()
t=x.findall(c)
m={}
for l in r(len(t)):
 w=[];c=t[l]
 for y in r(len(t)-1):
  if c==t[y]:w.append(str(t[y+1]))
 m[c]=w
x=random.choice(m.keys())
for i in r(int(sys.argv[2])):
 if len(m[x])==0:break
 y=random.choice(m[x]);print y,
 x=y

input works by providing a filename and the length of the output you want, in words
python disspress.py nevermore.txt 100

and nothing more! Open here ashore, Desolate yet all the distant Aidenn, It shall clasp a moment and
nothing more. Deep into the Night's Plutonian shore! Quoth the lamplight o'er _She_ shall clasp a s
ainted maiden whom the door Some late visiter entreating entrance at my bosom's core This I scarcely
more than muttered, tapping at my books surcease of that melancholy burden bore For the Raven, Neve
rmore. And the chamber door Bird or stayed he hath spoken! Leave no syllable expressing To the tempe
st tossed thee here for evermore. And each separate dying ember wrought its only stock and

sample text brought to you by a previous challenge
Optionally, you could save the contents of m to a file for later use, so it doesn't have to parse the entire file, as that could take longer periods of time to build the dictionary it references for the words especially for larger texts (like books).
edit: regardless if there was a winner chosen already, I'm posting it anyways :P

Perl, 65 chars
$/=$,;$_=<>;/./;($a.=$a[rand@a])=~/..$/while@a=/\Q$&\E(.)/g;say$a

This is heavily based on J B's answer, just golfed a little more.  Uses say for a cheesy two-char saving, so needs to be run with Perl 5.10 or later and the -M5.010 (or -E) switch.
Running this code on the Wikipedia dissociated press article produced this lovely output:

is all lon eat afteditterelessam in. Thided Press (or pocut ents. Refeed 2007-04-12-29). Refeaturrand prefery the basto useassociatualgor 1972) in on. Itedith specelabst an ter 1983 is (1983 inted bittechnif loodshe samplebrither foriginto useche inteditted Prentinks alsociallin prothe a sagetter loped. This the nown on. Thissociated impastiot whe "Whe ing thm #176. It orociame orinks algon tencyclon. (2007-04-12-29). Ame Jarrassocumovin ano sain his ot on. Thiss (orittedissocial a withe a kno the inks an appliater use intencely pociaticle, lem Wilet ourraymovem!


text:
Next Friday the 13th
What is the shortest program that can predict the next time Friday will fall on the 13th day of the month?

Must be an complete functioning program (not just a function/subroutine)
Must print out date in the following format: YYYY-MM-DD
Allow user to provide a start date either as a command line argument or through STDIN
If user provides no start date, use today as the start date.
If the start date is a Friday the 13th, the program should find the next Friday the 13th.

If I were to run the program today (Feb 16 2011) I should get the following output.
$ ./fr13th 2013-05-09
2013-09-13
$ ./fr13th 2007-06-29
2007-07-13
$ ./fr13th 2007-07-13
2008-06-13
$ ./fr13th
2011-05-13

Would a 2013-9-13 output be ok for the first example?

Do you mean we can decide whether we want to take the date as an argument or from STDIN or that we need to support both?

@sepp2k You can decide, you don't need to support both, the user just needs a way to input a date.

@JB Yeah, since there are several other solutions that do address all of the requirements, I wouldn't accept your response as the solution even if it was the shortest. That doesn't mean your response wasn't informative...but yeah, dealing with an inconsistent date format would be frustrating.

Well this one is not really possible with golfscript because it doesn't know today's date*. It also doesn't have a date library so would likely be quite a large answer anyway.  (*you can use ruby eval to get it, but then might as well use ruby date lib too)

@Daniel Standage: my question predates those, so that makes for a weak argument; but the decision is acceptable on its own nonetheless.

Windows PowerShell, 74
for($d="date $args"|iex;($d+='1').day*$d.dayofweek-65){}'{0:yyy-MM-d}'-f$d

Fairly straightforward. One perhaps confusing bit is the use of "Get-Date $args" | Invoke-Expression to get either the current date (if $args is empty) or the date specified in $args without raising an error.
72-byte variant:
for($d="date $args"|iex;($d+=9).day*$d.dayofweek-65){}'{0:yyy-MM-d}'-f$d

Takes ages, though ... this doesn't increment the datetime by a whole day each iteration but instead only 900 nanoseconds. But two bytes shorter.
67-byte variant:
for($d="date $args"|iex;($d+='1').day*$d.dayofweek-65){}'{0:d}'-f$d

This is a bit locale-sensitive; if it fails on your machine, try setting your date format to ISO-8601 beforehand. :-)
Oh, and it can be made into 65 bytes just like the 72-byte version.
History:

2011-02-17 00:33 (92) First attempt.
2011-02-17 00:35 (85) Improved getting an initial date.
2011-02-17 00:37 (79) Compared the product instead of day and day of week individually. Admittedly stolen from Ventero.
2011-02-17 00:40 (76) Pulled the first line into the for. Comparison just as subtraction instead of -eq which saves another two bytes.
2011-02-17 00:53 (75) Unix date format string is a bit shorter.
2011-02-17 11:42 (74) Reverted to the default date pattern but yyy-MM-d suffices (since the year is always longer than three characters and the day is always 13. Thanks to Ty Auvil for this.

Why are you passing "date $args" to iex? Try just (date $args) instead.

@Iszi: This is used to implement the "If user provides no start date, use today as the start date." rule. If you pass an empty array or $null to Get-Date you'll get an error, not the current date. "date $args"|iex however, resolves to either the date given in $args or the current date, which is just what we want here.

Ruby, 96 75 characters
require"date"
d=Date.parse(gets||"thu")+1
d+=1 while d.wday*d.day!=65
$><<d

Takes the date from stdin. To not specify a date press ctrl-d.
Thanks very much for Ventero's help.
Ungolfed:
require "date"
# Date.parse("thu") will return this week's thursday
date = Date.parse(gets || "thu")+1
date += 1 while d.wday * d.day != 5 * 13
$stdout << date

Sample IO:
$ ruby fr13th.rb
2013-05-09
2013-09-13
$ ruby fr13th.rb
2007-06-29
2007-07-13
$ ruby fr13th.rb
2007-07-13
2008-06-13
$ ruby fr13th.rb
2011-05-13

d.wday*d.day==65 is 4 characters shorter. And you should be able to replace Date.today.to_s with "thu"

Actually using a loop instead of an iterator shortens the code to 76 characters: require"date";d=Date.parse($*[0]||"thu")+1;d+=1 while d.wday*d.day!=65;$><<d. And you could read the date from stdin with gets instead of $*[0] to save another character (enter EOF to get the default behavior).

bash, 75
until set `date +%F -d$1+day`
date -d$1|grep -q '^F.* 13'
do :
done
echo $1

This is a bit locale-sensitive; if it fails on your machine, try exporting LC_ALL=C beforehand.
$ bash fri13th.sh 2013-05-09
2013-09-13
$ bash fri13th.sh 2007-06-29
2007-07-13
$ bash fri13th.sh 2007-07-13
2008-06-13
$ bash fri13th.sh
2011-05-13

C#, 185
Based on Andrew Koester's C# solution, but heavily modified along the way. I eventually arrived at a solution similar to my PowerShell solution:
using System;class
P{static void
Main(string[]a){var
n=a.Length>0?DateTime.Parse(a[0]):DateTime.Now;for(;(n=n.AddDays(1)).Day*(int)n.DayOfWeek!=65;);Console.Write("{0:yyy-MM-d}\n",n);}}

Perl (and others), 114
for(($y,$m,$d)=(shift//`date +%F`)=~/\d+/g,$d>12&&$m++;$m
>12&&($y++,$m=1),`cal $m $y`!~/14$/m;$m++){}say"$y-$m-13"

Perl 5.10 or later, run with -E 'code here' or -M5.010 file.  Needs date (from coreutils for Linux) and cal (from util-linux)
Sample run:
$ perl -M5.010 fr13.pl 2013-05-09
2013-9-13
$ perl -M5.010 fr13.pl 2007-06-29
2007-07-13
$ perl -M5.010 fr13.pl 2007-07-13
2008-6-13
$ perl -M5.010 fr13.pl
2011-5-13

I'm not sure when the leading zero for months before October is kept.  It's obviously lost when the year rolls over; it seems to be kept when the answer is just next month.  Let's call that undefined behavior--hey, this is golfing!

PHP - 103
(brute force)
<?for($d=date_create(@$argv[1]);$d->modify('next fri')&&$d->format(@d)-13;);die($d->format("Y-m-d\n"));

Ungolfed:
<?
$d = new DateTime(@$argv[1]);
while ($d->modify('next fri')) {
        if ($d->format('d') == 13) {
                die($d->format("Y-m-d\n"));
        }
}

Test:
$ php 979.php 2013-05-09
2013-09-13
$ php 979.php 2007-06-29
2007-07-13
$ php 979.php 2007-07-13
2008-06-13
$ php 979.php
2011-05-13

You can save up 1 character by changing != to -. Also you can save up 2 characters by moving up the $d->modify('next fri') in the increment section of the loop.

I need to modify to next friday before the loop, in case the given date is already a friday 13 :-) (or even just 13)

Use -r and You don´t need the tag. Use the default config with -n and You don´t need @. \n is unnecessary. echo instead of die saves another byte. strtotime instead of Date class can save one or two more.

BASH
#!/bin/bash
from=$1
if [ "$from" = "" ]; then
from=`date +%Y-%m-%d`
fi
i=1
while [ "$isFri" = "" ] || [ "$is13" = "" ]
do
isFri=`date -d "${from} ${i} days" | grep Fri`
is13=`date -d "${from} ${i} days" +%Y-%m-%d | grep "\-13"`
((i++))
done
((i--))
date -d "${from} ${i} days" +%Y-%m-%d

CONCEPT USED:
$ date -d "2011-02-16 2 days" +%Y-%m-%d
2011-02-18

SAMPLE I/O
:~/aman> ./fr13th.sh
2011-05-13
:~/aman> ./fr13th.sh 2013-05-09
2013-09-13
:~/aman> ./fr13th.sh 2007-06-29
2007-07-13
:~/aman> ./fr13th.sh 2007-07-13
2008-06-13

Python - 166 chars
Reads from stdin, so you need to feed a blank line if you want todays date
from datetime import*
D=datetime
e=timedelta(1)
I=raw_input()
d=e+(I and D.strptime(I,"%Y-%m-%d")or D.now())
while(d.weekday()+1)*d.day-65:d+=e
print d.strftime("%F")

Unless I'm missing something this does not address the 4th requirement (if no date is provided, start from today).

@Daniel, missed that one. 26 strokes later...

Blast from the past sorry :) If we join our solutions, we get to a collaborative 144 chars (see below!) :)

C#
240 characters. C# needs a "run inside of a function only" mode!
using System;class P{static void Main(string[] a){var n=DateTime.Now;if(a.Length>0)DateTime.TryParse(args[0],out n);while(true){n=n.AddDays(1);if((n.Day==13)&&(n.DayOfWeek==(DayOfWeek)5))break;}Console.WriteLine(n.ToString("yyyy-MM-dd"));}}

Un-golfed:
using System;

class P
{
    static void Main(string[] a)
    {
        var n = DateTime.Now;
        if (a.Length > 0) DateTime.TryParse(args[0], out n);
        while (true)
        {
            n = n.AddDays(1);
            if ((n.Day == 13) && (n.DayOfWeek == (DayOfWeek)5)) break;
        }
        Console.WriteLine(n.ToString("yyyy-MM-dd"));
    }
}

Test output
\Debug> f13.exe 2013-05-09
2013-09-13

\Debug> f13.exe 2007-06-29
2007-07-13

\Debug> f13.exe 2007-07-13
2008-06-13

\Debug> f13.exe
2011-05-13

D: 227 Characters
import std.datetime,std.stdio;void main(string[]a){auto d=a.length<2?cast(Date)(Clock.currTime()):Date.fromISOExtendedString(a[1]);for(;d.dayOfWeek!=DayOfWeek.fri||d.day!=13;d+=dur!"days"(1)){}writeln(d.toISOExtendedString());}

More Legibly:
import std.datetime, std.stdio;

void main(string[] a)
{
    auto d = a.length < 2 ? cast(Date)(Clock.currTime()) : Date.fromISOExtendedString(a[1]);

    for(; d.dayOfWeek != DayOfWeek.fri || d.day != 13; d += dur!"days"(1)) {}

    writeln(d.toISOExtendedString());
}

The fun part is that while D's std.datetime makes this sort of code very easy to write, it's also incredibly verbose - due primarily to the precise (and therefore long) function names. So, the usability and maintainability of the code is very high, but it's code golfability is rather low.

C#, 206 194 characters
Update
This is a slightly different take on the problem, so I left my other attempt here in full.
using System:class p{static void Main(string[]a){var n=a.Length>0?DateTime.Parse(a[0]):DateTime.Now;for(;(n=n.AddDays(5-(int)n.DayOfWeek).AddDays(7)).Day!=13;);Console.Write("{0:yyy-MM-d}",n);}}

Here, I'm finding the "current" week's Friday and then incrementing by 7 until I find one that's a 13. I also used Joey's for loop and output formatting to shave a few characters.
Ungolfed:
using System;
class p
{
    static void Main(string[] a)
    {
        var n = a.Length > 0 ? DateTime.Parse(a[0]) : DateTime.Now;

        for (; (n = n.AddDays(5 - (int)n.DayOfWeek).AddDays(7)).Day != 13; ) ;

        Console.Write("{0:yyy-MM-d}", n);
    }
}

Original:
This is similar to Andrew's above, but there were enough differences I decided to post a separate answer rather than comment and suggest edits.
using System;class p{static void Main(string[]a){var n=a.Length>0?DateTime.Parse(a[0]):DateTime.Now;do n=n.AddDays(1);while(!(n.Day==13&&n.DayOfWeek+""=="Friday"));Console.Write(n.ToString("yyyy-MM-dd"));}}

Ungolfed:
using System;
class p
{
    static void Main(string[] a)
    {
        var n = a.Length > 0 ? DateTime.Parse(a[0]) : DateTime.Now;
        do
        {
            n = n.AddDays(1);
        } while (!(n.Day == 13 && n.DayOfWeek + "" == "Friday"));

        Console.Write(n.ToString("yyyy-MM-dd"));
    }
}

SQLite, 374 characters
(Line breaks added here for readability; not included in the count.)
Requirement to "Allow user to provide a start date either as a command line argument or through STDIN" omitted due to technical limitations.
CREATE TABLE R(N UNIQUE);
INSERT INTO R VALUES(0);
INSERT INTO R VALUES(1);
REPLACE INTO R SELECT A.N*2048|B.N*1024|C.N*512|D.N*256|E.N*128|F.N*64|
G.N*32|H.N*16|I.N*8|J.N*4|K.N*2|L.N FROM
R A,R B,R C,R D,R E,R F,R G,R H,R I,R J,R K,R L;
CREATE TABLE F AS SELECT DATE('2000-01-13','+'||N||'months') AS D
FROM R WHERE STRFTIME('%w',D)='5';
SELECT MIN(D) FROM F WHERE D>DATE('now');

The first 4 statements create a table (R) with a single column containing all the integers from 0 to 4095.
The 5th statement builds a table (F) of all Friday the 13ths between 2000-10-13 and 2340-12-13.
The 6th statement simply returns the first Friday the 13th after the current (UTC) date.

The Gregorian calendar has a 400-year cycle, not 340 years. Or am I missing something here?

It doesn't handle years outside the range 2000-2340.  That was just an arbitrary choice.

R, 113 characters
f="%Y-%m-%d";o=format;a=c(as.Date(scan(,""),f),Sys.Date())[1];repeat{a=a+1;if(o(a,"%w%d")==513)break};cat(o(a,f))

Example runs:
> f="%Y-%m-%d";o=format;a=c(as.Date(scan(,""),f),Sys.Date())[1];repeat{a=a+1;if(o(a,"%w%d")==513)break};cat(o(a,f))
1: 2007-06-29
2:
Read 1 item
2007-07-13

> f="%Y-%m-%d";o=format;a=c(as.Date(scan(,""),f),Sys.Date())[1];repeat{a=a+1;if(o(a,"%w%d")==513)break};cat(o(a,f))
1:
Read 0 items
2013-12-13

> f="%Y-%m-%d";o=format;a=c(as.Date(scan(,""),f),Sys.Date())[1];repeat{a=a+1;if(o(a,"%w%d")==513)break};cat(o(a,f))
1: 2013-12-13
2:
Read 1 item
2014-06-13

Perl 6, 69 bytes
$_=Date.new(@*ARGS[0]//Date.today);.++while .day*.day-of-week-65;.say

Try it online!
Thanks to @ASCII-only for -5

Invalid, needs to handle the case when the user does not provide an argument, also day-of-week==5

@ASCII-only fixed

Oh yeah, it also has to be a complete program, not a function

Might want to link to this (even better, go there, esc -> s -> g for a nicely formatted post)

@ASCII-only done, ty

Really wish Perl 6 had Str.date so I could use a coercer...

Yeah, this is unusually ungolfy for Perl :/

70 using the powershell answer

69

Beautiful. Updated.

Let us continue this discussion in chat.

you don't have to delete answers especially if it's a radically different approach to others in the same language, fixed 22 for max thing (EDIT: wait wtf. it's now tying with the other one)

@ASCII-only well, it was outgolfed in the same language, so...

outgolfed in the same language doesn't matter :P (in fact, it's encouraged - there really isn't enough intra-language competition, mostly since there's usually only one really competitive method) what matters is the best for each approach that anyone thinks is viable

Javascript
F13=function(x){
    z=function(x){return (''+x).replace(/^(.)$/,'0$1')}
    D=x?new Date(x):new Date(),Z=864e5,X=D.getDay()%7,X+=+D+(X?Z*(5-X):0);
    do{
        X+=Z*7;
        D=new Date(X);
    }while(D.getDate()!=13)
    return D.getFullYear()+"-"+z(D.getMonth()+1)+"-"+z(D.getDate());
}

ps: yeah, I know, I broke the first rule (couldn't be just a function)
Tests on javascript shell
F13("2013-05-09") // 2013-09-13
2013-09-13
F13("2007-06-29") // 2007-07-13
2007-07-13
F13("2007-07-13") // 2008-06-13
2008-06-13
F13() //2011-05-13
2011-05-13

+1 Fight the elitist general purpose language favoring STDIN rule.

T-SQL 359 285 253 Characters
CREATE PROCEDURE f13(@d DateTime=null)AS
SET @d=ISNULL(@d,GETDATE())
;WITH d AS
(SELECT @d+1 d
UNION ALL SELECT d+1 FROM d
WHERE DATEPART(dw,d)<>6 OR DAY(d)<>13)SELECT CAST(d AS DATE) FROM d
WHERE DATEPART(dw,d)=6 AND DAY(d)=13
OPTION (MAXRECURSION 999)

I just wanted to lay the smack down on the SQLite solution with my non-clever verbose date function using T-SQL procedure.
Update: My original fear that doing a day increment would take more space than a month increment was very incorrect.
Test results (SSMS):
f13 '2013-05-09';
GO

f13 '2007-06-29';
GO

f13 '2007-07-13';
GO

f13;
GO
--

d
----------
2013-09-13

d
----------
2007-07-13

d
----------
2008-06-13

d
----------
2011-05-13

Another Javascript, 153
I post another javascript answer because I can't comment the first...
a=new Date(process.argv[2]||Date.now());for(b=1;b;b=a.getDate()!=13||!/^F/.test(a))a.setTime(a.getTime()+864e5);console.log(a.toISOString().substr(0,10))

Execute with nodeJS :
$ node fr13th
2013-12-13

$ node fr13th 2007-06-29
2007-07-13

$ node fr13th 2013-05-09
2013-09-13

Python 3.3, 166 characters
import datetime as d
t=input()
t=d.date(*map(int,t.split()))if t!=""else d.date.today()
while 1:
 t+=d.timedelta(1)
 if t.day==13and t.weekday()==4:
  print(t);break

Input is in the format 2013 1 1,
>>> ================================ RESTART ================================
>>>
2013 1 1
2013-09-13

or just press enter to use today's date (would be 2013/12/11 for this output)
>>> ================================ RESTART ================================
>>>

2013-12-13

(there is actually a mix of my solution and @gnibbler 's that counts 144 chars)
import datetime as d
t=input()
t=d.date(*map(int,t.split()))if t!=""else d.date.today()
while t.day*t.weekday()-65:
 t+=d.timedelta(1)
print(t)

The very nice line while t.day*t.weekday()-65: is from @gnibbler's solution.

Swift 4, 310 bytes
import Foundation
let (u,f)=(Calendar.current,DateFormatter())
f.dateFormat="yyyy-MM-dd"
var t={(x:Date)->Int in let c=u.dateComponents([.weekday,.day],from:x);return c.weekday!*c.day!},d=readLine().map{f.date(from:$0)!} ?? Date()
while t(d) != 65{d=u.date(byAdding:.day,value:1,to:d)!}
print(f.string(from:d))

Try it online!
-4 thanks to TagTaco.
Alas...:

needs Foundation for Date/Calendar.
Swift doesn't allow Ints to be used as Bool.
The shorthand enum syntax is helpful, though not that much.
Space is required around ??.
!= also needs spacing, lest it's interpreted as an unwrapping.

Japt, 35 bytes
ÐUªKs3 ¯A
@e ¶5©D¶Uf}a@f1Uf Ä
s3 ¯A

-8 bytes thanks to @ASCIIOnly!
Try it!

Invalid output format...

36?

Yeah, I'm working on it :) Apparently toISOString converts to UTC which changes the date

How does it change the date? Does K store time as local time?

Depending on your timezone, this will be different: https://ethproductions.github.io/japt/?v=1.4.6&code=0FWqSylqCjFvNTAwXyo4NjRlNX0p5l890ForVSlaZSC2NalaZiC2RArQVStWKXMz&input=IjIwMDEtMDEtMDEi - but anyways, I think you nailed it!

Fixed, 39 (well, kinda. It outputs the correct result for today at UTC (AFAICT) and that's good enough for me. Don't want to mess with timezones more than I already am)

37

Now we just have to wait for Shaggy to shave another 5 bytes off :P

I actually think through 36 byte solution works. There must be something different between setDate and the date constructor.

Let us continue this discussion in chat.

32 if you want to use the old 36-byter

@ASCII-only, I have 23 bytes at the moment ;)

@Shaggy :| ok i mustn't have been looking hard enough i'll be back in a few years with that 23-byter. also, it works correctly? (doesn't return the wrong date because of conversion to ISO time?)

@ASCII-only ... huh ... so it does :\ 24 bytes, so.

Ah, wait, I missed the optional input. Back to the drawing board!

VB.net (96c*)
Entry
Function NextFridayThe13th(d As Date) As Date
  While d.DayOfWeek<>DayOfWeek.Friday
    d=d.AddDays(1)
  End While
  While d.Day<>13
    d=d.AddDays(7)
  End While
  Return d
End Function

I think the CodeGolf count for vb.net shouldn't include the function signature, closing end function and the return.  So it just makes it about the internal implementation.

So my scoring is broken down as so
While d.DayOfWeek<>DayOfWeek.Friday    '35c
d=d.AddDays(1)                         '13c  48c
End While                              ' 9c  57c
While d.Day<>13                        '15c  72c
d=d.AddDays(7)                         '14c  86c
End While                              ' 9c  95c
Return d                               ' 1c  96c

Rebol, 136
d: any[do system/script/args now]until[d: d + 1 all[d/day = 13 d/weekday = 5]]print format/pad[4"-"-2"-"-2]reduce[d/year d/month d/day]

Ungolfed:
d: any [do system/script/args  now]

until [
    d: d + 1
    all [d/day = 13 d/weekday = 5]
]

print format/pad [4 "-" -2 "-" -2] reduce [d/year d/month d/day]

Example usage:
$ rebol friday13th.reb 2013-05-09
2013-09-13
$ rebol friday13th.reb
2014-06-13

Java 8, 200 197 bytes
interface M{static void main(String[]a){java.time.LocalDate z=null,r=a.length<1?z.now():z.parse(a[0]);for(;(r=r.plusDays(1)).getDayOfWeek().getValue()*r.getDayOfMonth()!=65;);System.out.print(r);}}

Explanation:
Try it here (remove the argument to use the current date).
interface M{                        // Class
  static void main(String[]a){      //  Mandatory main-method
    java.time.LocalDate z=null,     //   LocalDate to reduce bytes when using static calls
     r=a.length<1?                  //   If no argument is given:
        z.now()                     //    Start at the current date
       :                            //   Else:
        z.parse(a[0]);              //    Start at the date of the first argument
    for(;(r=r.plusDays(1))          //   Before every iteration, go to the next day
                                    //   Loop as long as:
         .getDayOfWeek().getValue()
                                    //    the 1-indexed day of the week (Friday = 5)
         *r.getDayOfMonth()         //    multiplied by the day of the month
        !=65;                       //    is not 65
                                    //    (5 and 13 are primes, so only 5*13 results in 65)
    );                              //   End of loop
    System.out.print(r);            //   Print the result Friday the 13th
  }                                 //  End of main-method
}                                   // End of class

NOTE: Java's default format when printing is already yyyy-MM-dd.

05AB1E, 141 bytes
gĀi'-¡ëžežfžg)}V[Y`2ô0Kθ4ÖUD2Qi\28X+ë<7%É31α}‹iY¬>0ëY1¾ǝDÅsD12‹i>1ë\1Dǝ¤>2}}ǝVY`UÐ3‹12*+>13*5÷s3‹Xα©т%D4÷®т÷©4÷®·()O7%6QYн13Q*#}YRεDgi0ì]'-ý

05AB1E doesn't have any builtins for Date objects or calculations. The only builtin regarding dates it has is today's year/month/day/hours/minutes/seconds/microseconds.
So because of that, almost all of the code you see are manual calculations to go to the next day, and calculating the day of the week.
Mostly derived from my 05AB1E answer in The Work Day Countdown challenge (which is why I edited that one about an hour ago when I came across a bug..)
Input is a string in the format dd-MM-yyyy (but output is in the format yyyy-MM-dd, since it's one of the rules of the challenge).
Try it online or verify all test cases.
Explanation:
gĀi        # If an input is given:
   '-¡    '#  Split it by "-"
  ë        # Else:
   že      #  Push today's day
     žf    #  Push today's month
       žg  #  Push today's year
         ) #  Wrap them into a single list
  }V       # After the if-else statement: pop and store it in variable `Y`
[          # Start an infinite loop
 Y`2ô0Kθ4ÖUD2Qi\28X+ë<7%É31α}‹iY¬>0ëY1¾ǝDÅsD12‹i>1ë\1Dǝ¤>2}}ǝV
           #  Go to the next day
           #  (see my linked The Work Day Countdown answer for an explanation)
 Y`UÐ3‹12*+>13*5÷s3‹Xα©т%D4÷®т÷©4÷®·()O7%
           #  Calculate the day of the week (0 = Saturday, 1 = Sunday, ..., 6 = Friday)
           #  (see my linked The Work Day Countdown answer for an explanation)
 6Q        #  Check if the day of the week is a Friday
 Yн        #  Push the days of the current date
   13Q     #  Check if it's the 13th
 *         #  And if both checks are truthy:
  #        #   Stop the infinite loop
}YR        # After the infinite loop: push the resulting date-list, and reverse it
ε          # Map each value to:
 Dgi       #  If it's only a single digit:
    0ì     #   Prepend a leading "0"
]          # Close both the if-statement and map
 '-ý      '# Join the result by "-"
           # (and output the result implicitly)


text:
Koch Snowflake - codegolf
The Koch snowflake (also known as the Koch star and Koch island) is a mathematical curve and one of the earliest fractal curves to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled "On a continuous curve without tangents, constructible from elementary geometry" (original French title: "Sur une courbe continue sans tangente, obtenue par une construction géométrique élémentaire") by the Swedish mathematician Helge von Koch.

Here are some ascii representations of various iterations:
n=1
__
\/

n=2
__/\__
\    /
/_  _\
  \/

n=3
      __/\__
      \    /
__/\__/    \__/\__
\                /
/_              _\
  \            /
__/            \__
\                /
/_  __      __  _\
  \/  \    /  \/
      /_  _\
        \/

Since there is obviously a limit to the resolution of the ascii representation, we must enlarge the size of the snowflake by a factor of 3 for each iteration to show the extra detail.
Write the shortest code to output the snowflake in the same style for n=4
Your program should not take any input.
Your program should write the snowflake to the console.

Koch-snowflake ..a tag .. thats interesting..!!.. seems you will be firing more questions on this tag :)

Too short for an answer: http://www.wolframalpha.com/input/?i=koch+snowflake+4 :D

Should the accepted answer be changed? There are shorter solutions now.

Python, 338 bytes
#coding:u8
print u"碜䄎쀠ࢻ﬊翀蝈⼖㗎芰悼컃뚔㓖ᅢ鄒鱖渟犎윽邃淁挢㇌ꎸ⛏偾࿵헝疇颲㬤箁鴩沬饅앎↳\ufaa4軵몳퍋韎巃๧瓠깡未늳蒤ꕴ⁵ᦸ䥝両䣚蟆鼺伍匧䄂앢哪⡈⁙ತ乸ሣ暥ฦꋟ㞨ޯ⿾庾뻛జ⻏燀䲞鷗﫿".encode("utf-16be").decode("zlib")

Just another unicode exploit
run at ideone

Fair enough, but surely that would make the source file more than 300 bytes long.

the link is broken

Python, 650 612 594 574 characters
n='\n'
S='_a/G\F I\n'
A=dict(zip(S,('III','   ','__/','  G','\  ','F__','   ','III','')))
B=dict(zip(S,('III','   ','\  ',' aF','/a ','  G','   ','III','')))
C=dict(zip(S,('___','aaa','/  ','GII','II\\','  F','   ','III','')))
def T(s):
 a=b=c=d=r=u''
 for k in s:
    a+=A[k];b+=B[k];c+=C[k]
    if k=='I':a=a[:-3]+('II\\'if'a '==d[1:3]else'GII'if' a'==d[:2]else 3*k)
    d=d[3:]
    if k==n:d=c.replace('____','__/F').replace('aaaa','aa  ').replace('/  a','/a  ').replace('a  F','  aF');r+=a+n+b+n+d+n;a=b=c=''
 return r
print T(T(T('__\n\G\n'))).translate({97:95,71:47,73:32,70:92})

This works by expanding the triangle by a factor of 3 each time.  To do that, we need to keep track of whether each symbol is a left or right boundary (e.g. how / is expanded depends on which side of the / is the inside).  We use different symbols for the two possible cases, as follows:
_: _, outside on the top
a: _, outside on the bottom
/: /, outside on the left
G: /, outside on the right
\: \, outside on the left
F: \, outside on the right
<space>: inside
I: outside

The d variable handles the special case where the expansion of an a needs to extend into the 3x3 in the next row.

+1 for getting the first answer on the board. I think you can replace the double spaces with a tab in the for loop. Also try using if k<"C" instead of K=="A" etc. Now I shall have to look closer at your algorithm :)

Can't you remove the many if statements with an associative array? And maybe the chained replace statements can be shortened with an array.

('acEei',r'_/\\ ') => ('aecEi','_\/\ ') saves 1 more. You may also want to check out the unicode.translate().

This also prints about 18 newlines before the snowflake, but I suppose the OP didn't specify whether anything other than the snowflake may be printed.

MS-DOS 16 bit machine code: 199 bytes
Decode using this site, save as 'koch.com' file and execute from WinXP command prompt.
sCAAxo7ajsKLz/OquF9fulwvvUoBM9u+BADoiQDodgDocwDogADobQDoagDodwCK8TLSs0+I98cHDQrGRwIktAnNIf7GOO5+7MNWAVwBYwFsAXoBgwGJB4DDAsOIN/7D6QQA/suIF/7P6R0A/suAPyB1AogH/suIB8OBw/8AiDfpBgD+x4gX/sM4734Ciu84z30Cis/Dg8UIg8UCgf1WAXLzg+0Mw07/dgB0GV/o9v/o5v/o8P/o3f/o2v/o5//o1//o4f9Gww==

Update
Here's an easy-to-read assembler version:
  ; L-System Description
  ;
  ; Alphabet : F
  ; Constants : +, -
  ; Axiom : F++F++F
  ; Production rules: F -> F-F++F-F
  ;
  ; Register usage:
  ;                             _        _
  ; bp = direction: 0 = ->, 1 = /|, 2 = |\, 3 = <-, 4 = |/_, 5 = _\|
  ; cl = min y, ch = max y
  ; bl = x (unsigned)
  ; bh = y (signed)
  ; si = max level

  ; clear data
  mov al,20h
  add dh,al
  mov ds,dx
  mov es,dx
  mov cx,di
  rep stosb
  mov ax,'__'
  mov dx,'/\'

  ; initialise variables
  mov bp,Direction0
  xor bx,bx
  mov si,4

  call MoveForward
  call TurnRight
  call TurnRight
  call MoveForward
  call TurnRight
  call TurnRight
  call MoveForward

  mov dh,cl
  xor dl,dl
  mov bl,79
OutputLoop:
  mov bh,dh
  mov w [bx],0a0dh
  mov b [bx+2],24h
  mov ah,9
  int 21h
  inc dh
  cmp dh,ch
  jle OutputLoop
  ret

Direction0:
  dw MoveRight
  dw MoveUpRight
  dw MoveUpLeft
  dw MoveLeft
  dw MoveDownLeft
  dw MoveDownRight
Direction6:

MoveRight:
  mov w [bx],ax
  add bl,2
  ret

MoveUpRight:
  mov b [bx],dh
  inc bl
  jmp DecBHCheckY

MoveUpLeft:
  dec bl
  mov b [bx],dl
DecBHCheckY:
  dec bh
  jmp CheckY

MoveLeft:
  dec bl
  cmp b [bx],20h
  jne MoveLeftAgain
  mov [bx],al
MoveLeftAgain:
  dec bl
  mov [bx],al
  ret

MoveDownLeft:
  add bx,255
  mov b [bx],dh
  jmp CheckY

MoveDownRight:
  inc bh
  mov b [bx],dl
  inc bl

CheckY:
  cmp bh,ch
  jle NoMaxChange
  mov ch,bh
NoMaxChange:
  cmp bh,cl
  jge NoMinChange
  mov cl,bh
NoMinChange:
  ret

TurnRight:
  add bp,8

TurnLeft:
  add bp,2

  cmp bp,Direction6
  jb ret
  sub bp,12
  ret

MoveForward:
  dec si
  push [bp]
  jz DontRecurse
  pop di
  call MoveForward
  call TurnLeft
  call MoveForward
  call TurnRight
  call TurnRight
  call MoveForward
  call TurnLeft
  call MoveForward
DontRecurse:
  inc si
  ret

Abolute magic :) , please help me understand this (atleast provide a link on what you did)

@Aman: It uses an L-system description of the Koch curve to draw the output. The level of detail is set in the SI register although the size is limited to 252 characters per line. You'll need to modify the printing code to get lines longer than 79 characters (i.e. change where it writes the '\n$' characters).

can also use "scAA...w==".decode("base64") to decode in Python2 (doesn't work for Python3)

+1 now that I have a windows machine to run it on. Any chance you can include asm version?

also runs on dosemu. I used dosemu -dumb koch.com

on windows, .com files can easily disassemble to assembly source with 'debug' command btw. debug koch.com and use sub command u.

@gnibbler: I've added an assembler version

@S.Mark: Only on 32-bit Windows versions, though ;)

How do I know this isn't mal-ware lol

@mellamokb: err, because all the source code is available perhaps?

Perl, 176 175 bytes
Posting this as a separate answer because it uses a binary source file, which is perhaps a bit cheaty. But considering that it’s still Perl source code, I think it’s remarkable that it beats the MS-DOS machine code solution!
Source as base64-encoded
JF89IsLApwag0dhnMmAmMEcGIAcGQNHYwsDRFLsQ0djCwKcGoNHYwsDRFDdbECYwcRUxe1DCwNEUuxDR2
CI7c14uXiR4PW9yZCQmOyQieCgkeD4+MykucXcoXCAvXyBfXy8gXC8gX18gX1wgLyBfXy9cX18pWyR4Jj
ddXmVnO3NeLnsyN31eJF89cmV2ZXJzZSQmO3l+L1xcflxcL347cHJpbnQkJi4kXy4kL15lZw==

Somewhat more readable
Replace all instances of /<[0-9a-f]+>/ with the relevant binary data:
# Raw data!
$_="<c2c0a706a0d1d86732602630470620070640d1d8c2c0d114bb10d1d8c2>".
   "<c0a706a0d1d8c2c0d114375b1026307115317b50c2c0d114bb10d1d8>";

# Decode left half of the snowflake (without newlines)
s^.^$x=ord$&;$"x($x>>3).qw(\ /_ __/ \/ __ _\ / __/\__)[$x&7]^eg;

# Reconstruct the right half and the newlines
s^.{27}^$_=reverse$&;y~/\\~\\/~;print$&.$_.$/^eg

In this version, the snowflake is encoded in the following way:

The 8 bits in each byte are divided like this:
+---+---+---+---+---+---+---+---+
|      5 bits       |   3 bits  |
+---+---+---+---+---+---+---+---+
          R               C

R encodes a run of spaces. The longest run is 27 characters, so all runs fit into 5 bits.
C encodes a sequence of characters which are simply looked up in the literal array. (I used to have slightly crazier encodings here where the array contained only / \ _, but the Perl code necessary to decode it was longer...)
I am lucky that the binary data does not contain any "/' or \ that would need escaping. I didn’t plan for this. But even if it did, I probably could have just changed the order of the items in the array to fix that.
It is amazing how simple this solution is compared to the tens of other solutions I went through before I came up with this. I experimented with many different bitwise encodings more complex than this one, and it never occurred to me that a simpler one might be worth it simply because the Perl code to decode it would be shorter. I also tried to compress repetitions in the data using variable interpolation (see the other answer), but with the newest version that doesn’t gain any characters anymore.

Perl, 224 223 characters
use MIME::Base64;$_=decode_base64 wsCnBqDR2GcyYCYwRwYgBwZA0djCwNEUuxDR2MLApwag0djCwNEUN1sQJjBxFTF7UMLA0RS7ENHY;s^.^$x=ord$&;$"x($x>>3).qw(\ /_ __/ \/ __ _\ / __/\__)[$x&7]^eg;s^.{27}^$_=reverse$&;y~/\\~\\/~;print$&.$_.$/^eg

Somewhat more readable
use MIME::Base64;

# raw binary data in base-64-encoded form as a bareword
$_=decode_base64
    wsCnBqDR2GcyYCYwRwYgBwZA0djCwNEUuxDR2MLApwag0djCwNEUN1sQJjBxFTF7UMLA0RS7ENHY;

# Decode left half of the snowflake (without newlines)
s^.^$x=ord$&;$"x($x>>3).qw(\ /_ __/ \/ __ _\ / __/\__)[$x&7]^eg;

# Reconstruct the right half and the newlines
s^.{27}^$_=reverse$&;y~/\\~\\/~;print$&.$_.$/^eg

How it works
For an explanation of how it works, see the other answer in which I post the same in binary. I am really sorry that I am not actually generating the Koch snowflake, just compressing it...
Previous versions

(359) Encoded the entire snowflake instead of just the left half. Spaces were included in the bit encoding; no run-length yet. Used several interpolated variables plus a @_ array which was accessed using s/\d/$_[$&]/eg. Newlines were encoded as !.
(289) First version that encoded only the left half of the snowflake.
(267) First version that used run-length encoding for the spaces.
(266) Change ' ' to $".
(224) Radically different compression, encoded as base-64. (Now equivalent to the binary version.)
(223) Realised that I can put the print inside the last subst and thus save a semicolon.

Python, 284
for s in "eJyVkNENACEIQ/+dgg1YiIT9tzgENRyWXM4/pH1tIMJPlUezIiGwMoNgE5SzQvzRBq52Ebce6cr0aefbt7NjHeNEzC9OAalADh0V3gK35QWPeiXIFHKH8seFfh1zlQB6bjxXIeB9ACWRVwo=".decode('base64').decode('zlib').split('\n'):print s+'  '*(27-len(s))+'\\'.join([c.replace('\\','/')for c in s[::-1].split('/')])

With a bit more whitespace:
for s in "eJyVkNENACEIQ/+dgg1YiIT9tzgENRyWXM4/pH1tIMJPlUezIiGwMoNgE5SzQvzRBq52Ebce6cr0aefbt7NjHeNEzC9OAalADh0V3gK35QWPeiXIFHKH8seFfh1zlQB6bjxXIeB9ACWRVwo=".decode('base64').decode('zlib').split('\n'):
  print s + '  '*(27-len(s)) + '\\'.join([c.replace('\\','/') for c in s[::-1].split('/')])

The left side is compressed; the right side is reproduced from the left side.