Code Golf: 6174 - Kaprekar's mythical constant
Ruby 1.9, 122 characters
puts&quot;Iterations: #{(1..7).find{s=$_.chars.sort*&quot;&quot;;puts [r=s.reverse,?-,s,?=,$_=&quot;%04d&quot;%(r.to_i-s.to_i)]*&quot; &quot;;~/6174/}}.&quot;

Example invocation:
$ echo 1211 | ruby -ln kaprekar.rb

I've counted the -ln flag as 4 characters (difference between the normal invocation ruby kaprekar.rb and ruby -ln kaprekar.rb).