text:
Calculate digits of Pi
This is a somewhat different task. Calculate 1024 hexadecimal digits of π, beginning at the 1024th hexadecimal place.
Formally: Your program should complete in less then 1 minute and produce the following output:

25d479d8f6e8def7e3fe501ab6794c3b976ce0bd04c006bac1a94fb6409f60c45e5c9ec2196a246368fb6faf3e6c53b51339b2eb3b52ec6f6dfc511f9b30952ccc814544af5ebd09bee3d004de334afd660f2807192e4bb3c0cba85745c8740fd20b5f39b9d3fbdb5579c0bd1a60320ad6a100c6402c7279679f25fefb1fa3cc8ea5e9f8db3222f83c7516dffd616b152f501ec8ad0552ab323db5fafd23876053317b483e00df829e5c57bbca6f8ca01a87562edf1769dbd542a8f6287effc3ac6732c68c4f5573695b27b0bbca58c8e1ffa35db8f011a010fa3d98fd2183b84afcb56c2dd1d35b9a53e479b6f84565d28e49bc4bfb9790e1ddf2daa4cb7e3362fb1341cee4c6e8ef20cada36774c01d07e9efe2bf11fb495dbda4dae909198eaad8e716b93d5a0d08ed1d0afc725e08e3c5b2f8e7594b78ff6e2fbf2122b648888b812900df01c4fad5ea0688fc31cd1cff191b3a8c1ad2f2f2218be0e1777ea752dfe8b021fa1e5a0cc0fb56f74e818acf3d6ce89e299b4a84fe0fd13e0b77cc43b81d2ada8d9165fa2668095770593cc7314211a1477e6ad206577b5fa86c75442f5fb9d35cfebcdaf0c7b3e89a0d6411bd3ae1e7e4900250e2d2071b35e226800bb57b8e0af2464369bf009b91e5563911d59dfa6aa78c14389d95a537f207d5ba202e5b9c5832603766295cfa911c819684e734a41b3472dca7b14a94a

The program with the shortest length wins. You have to calculate all the digits at runtime. You do not have to implement the algorithm that computes π; if your language already provides that functionality, you can use it.

Hah, should be easy. (+1, still) I bet I can make it execute in less than a few seconds.

@muntoo: And? Where is your solution?

I forgot to do it. :) BTW, speed != code-golf.

@muntoo: I know. But I also think, that 5 days is a good time for such an easy task.

Sage, 29 char
This isn't technically cheating, since the digits are computed at runtime.  That said, it's still cheap as hell.
hex(floor(pi*2^8192))[1025:]

Definitly not cheating.

Mmmm, floor pi.

Shell Utilities: 48
curl -sL ow.ly/5u3hc|grep -Eom 1 '[a-f0-9]{1024}'

All output is "calculated" at runtime. (thanks to OP posting the solution)
Runs in under a minute. (may be dependent on your internet connection speed)

Usually I downvote that kind of solutions, because they are a common abuse of the rules and no longer funny. But just because you are so sneaky to take the provided reference solution and write All output is "calculated" at runtime. (thanks to OP posting the solution), I give you an upvote ;)

Golfed version: curl -sL ow.ly/shKGY|grep -Po \\w{99,} (37). Works in Dash. Bash would need an additional byte.

JavaScript, 536
(Linebreaks and indentation for legibility only)
var d='0123456789abcdef',p='',o='',l=3e3,c=0,e='length';d=d+d;
function $(n,r){return n[e]<=r?0:d.indexOf(n[r])}
function g(a,b){for(i=0,t='',s=16;i<l;i++,t+=d[~~(s/b)],s=(s%b)*16);
for(;a--;t=_(t,t,1));return t}
function _(a,b,s){for(i=(a[e]>b[e]?a[e]:b[e])-1,r='',c=0;i>=0;r=(s?
  function(k){c=k>15;return d[k]}($(a,i)+$(b,i)+c):
  function(k){c=k<0;return d[k+16]}($(a,i)-$(b,i)-c))+r,i--);return r}
for(i=0;i<l;i++,p+='2');
for(j=1;j<l;p=_(p,(o+='0')+_(_(_(g(2,8*j+1),g(1,8*j+4)),g(0,8*j+5)),g(0,8*j+6)),1),j++);
console.log(p.slice(1024,2048))

It takes about 25 seconds, on Google Chrome 14 on my lap-top using Intel i5 core. Can someone else golf this code? I can't golf well.. :(
Below is non-golfed. I just remove all comments and changed for loop to golfing.
Don't mention about for(;s>=b;s-=b);s*=16;. I changed it to s=(s%b)*16. :P
/**
Calculate PI-3 to 3000 (3e3) digits.
a : a
b : b
c : carry
d : digits
e : length
f : get from d
g : calculate (2^a)/b.
i,j, : for looping
l : length to calculate
p : pi
r,t : return value
*/
var d='0123456789abcdef',p='',o='',l=3e3,c=0,e='length';
d=d+d;//for carring

function $(n,r){return n[e]<=r?0:d.indexOf(n[r])}
/*
Calculate (2^a)/b. Assume that 2^a < b.
*/
function g(a,b){
    for(i=0,t='',s=16;i<l;i++){t+=d[~~(s/b)];for(;s>=b;s-=b);s*=16;}
    for(;a--;t=_(t,t,1));return t}
/*
Calculate a±b. (+ when s=1, - when s=0) When calculating minus, assume that 1>b>a>0.
*/
function _(a,b,s){
    for(i=(a[e]>b[e]?a[e]:b[e])-1,r='',c=0;i>=0;
        r=(s?function(k){c=k>15;return d[k]}($(a,i)+$(b,i)+c):
            function(k){c=k<0;return d[k+16]}($(a,i)-$(b,i)-c))+r,i--);return r;
}
/*
Using BBP formula. Calc when j=0...
4/1 - 2/4 - 1/5 - 1/6 = 3.22222222.... (b16)
*/
for(i=0;i<l;i++,p+='2');
//Calc when j>0
for(j=1;j<l;p=_(p,(o+='0')+_(_(_(g(2,8*j+1),g(1,8*j+4)),g(0,8*j+5)),g(0,8*j+6)),1),j++);
console.log(p.slice(1024,2048));

EDIT : Removed totally unused function. (Why did I keep that? :/ )
PS. First 100 digits of PI
243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89452821e638d01377be5466cf34e90c6cc0ab

@FUZxxl : Was the non-golfed code not enough? ..:(

It was indeed. But IMHO it looks better, if you use the code formatting instead of using the backtick syntax. As I wrote, feel free to revert if you dislike.

d='0123456789abcdef',l=3e3,p=Array(l+1).join(2),o='',c=0,e='length';d+=d;function _(a,b,s){for(i=(a[e]>b[e]?a[e]:b[e])-1,r='',c=0;i+1;r=d[Z=F(b,i,1)+c,k=F(a,i,1)+(s?Z:16-Z),c=s?k>15:k<16,k]+r,i--);return r}function F(a,b,f){if(f)f=a[e]>b?d.indexOf(a[b]):0;else{for(i=0,f='',s=16;i++<l;f+=d[~~(s/b)],s=(s%b)*16);while(a--)f=_(f,f,1)}return f}for(j=0;++j<l;p=_(p,(o+='0')+_(_(_(F(2,z=8*j+1),F(1,z+3)),F(0,z+4)),F(0,z+5)),1));console.log(p.slice(1024,2048))

That's really all micro-optimisations, although some of them look quite large. The biggest saving comes from eliminating the two anonymous functions in the middle of _ in favour of the , operator. The trickiest one is the merging of $ and g into one function, with an optional argument to select between them. function and return are both quite expensive, so an if(f)...else and a couple of ,1 is a reasonable tradeoff.

PHP 116 114 bytes
<?for(;$g?$d=0|($$g=$g--/2*$d+($$g?:2)%$g*$f)/$g--:4613^printf($i++>257?'%04x':'',$e+$d/$f=4*$g=16384)^$e=$d%$f;);

This solution calculates all of pi up to 2048 hex digits, four hex digits at a time, and outputs the last half of them. Execution time is less than 5 seconds. The formula used for the calculation is the following:
pi = 2 + 1/3*(2 + 2/5*(2 + 3/7*(2 + 4/9*(2 + 5/11*(2 + 6/13*(2 + 7/15*(2 + ... )))))))

The precision is obtained storing the remainders in an array, and continuing each of the 2^14 divisions incrementally.
Python 64 bytes
x=p=16385
while~-p:x=p/2*x/p+2*2**8192;p-=2
print('%x'%x)[1025:]

Same method as above. Runs in about 0.2s.
Or as a one-liner in 73 bytes:
print('%x'%reduce(lambda x,p:p/2*x/p+2*2**8192,range(16387,1,-2)))[1025:]

PARI/GP-2.4, 141
forstep(d=1024,2047,8,y=frac(apply(x->sum(k=0,d+30,16^(d-k)/(8*k+x)),[1,4,5,6])*[4,-2,-1,-1]~);for(i=0,7,y=16*frac(y);printf("%X",floor(y))))

Using the Bailey–Borwein–Plouffe formula (of course).
Runs in well under a minute.

C code:
long ki,k,e,d=1024;
int  dig,tD=0,c,Co=0,j,js[4]  ={1,4,5,6};
double res=0.0,tres=0.0,gT,ans[4] ={0.0};
while(tD < 1024)
{while(Co<4){ j= js[Co],gT=0.0,ki= 0;
 for(; ki < d+1;ki++){ k = 8*ki+j,e= d-ki,c=1; while(e--) c = 16*c % k; gT+=((double)(c)/(double)k);}
 ans[Co] = (gT - (int)gT),++Co;}
 double gA = 4*ans[0]-2*ans[1]-ans[2]-ans[3];
 gA = (gA<0) ? gA + -1*(int)gA +1 : gA -(int)gA;
 dig=0;while(dig++ < 6 && tD++ < 1024) gA *=16, printf("%X",gA),gA -= (int)gA;
 d+=6,Co = 0;}

runtime = 8.06 seconds on a intel Quad core

This is code golf. Try to compress your code as much as possible by using short variable names and avoiding whitespace. For instance, you could save a lot of chars by using printf("%X",(int)gA) instead of that long list.

Perl - 59
use ntheory"Pi";say substr int(Pi(3000)<<8192)->as_hex,1027

Less than 0.1s.

PARI/GP - 40 bytes
This version 'cheats' by using \x to display the hexadecimal digits of the result.
\p8197
x=Pi<<4^6;x-=x\1;x=(x<<4^6)\1
\xx

This version takes 87 bytes to convert to hexadecimal in the usual way.
\p8197
x=Pi<<4^6;x-=x\1;concat([Vec("0123456789abcdef")[n+1]|n<-digits((x<<4^6)\1,16)])

Both versions run in a small fraction of a second.

Shell 68
tools: bc -l, tr, cut
echo "scale=2468;obase=16;4*a(1)"|bc -l|tr -d '\\\n'|cut -c1027-2051

Shell 64, tools: bc -l, tr, tail, differs in the rounding of the last place
echo "scale=2466;obase=16;4*a(1)"|bc -l|tr -d '\\\n'|tail -c1024

Might be considered cheating, since the knowledge how to compute PI is in 4*a(1), and that 1 have to use scale=2466 was iteratively investigated.
Thanks to breadbox for the idea to use cut.

I don't see how it could be considered cheating; the digits are computed at runtime. Although I should note that when I run it, it output differs on the last digit (7 instead of A). BTW, I think you can replace the dd command with tail -c1024 to save a few chars.

Yes, I observed the difference too (and spend half an hour on it :) ). If I tell bc to use a scale of x digits, it rounds to that digit in decimal mode, and does hex conversion afterwards. So if I take one more digit, it produces a 69, not a 7. However - rounding style or truncation wasn't specified in the question. And thanks for the tail idea. :)

The question specifies: terminate and produce an output identically to what is specified.

@FUZxxl: "should...", not "must..." - I thought it should be a help to check, whether the hex conversion is doing well, and the count of characters to skip, not as part of the specification, to conform to the last digit of 1024. But I gave in and added 16 chars to replace one.

Given that the sentence starts with the word "Formally", I would agree that the OP probably meant it in the RFC sense of the word. Also, you can still improve your new solution by replacing the use of dd with cut -c1027-2051. (The shell has many tools for manipulating text streams.)

@breadbox: Thanks, integrated cut.

I actually meant to imply that producing the exact output is a requirement for each correct solution. Sorry for being ambiguously. As breadbox said, one could probably say that I said “formally,“ yet the RFC referenced just says “SHOULD This word (...) [means] that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.” Printing a different number surely has a certain implication that must be understood – the answer is not valid.

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


text:
Simple Geometric problem
This problem (see below) has been given as a High School Programming League code golf challenge. The shortest codes submitted during the contest were: 177 bytes in Ruby, 212 bytes in Python 2.5, 265 bytes in C. Can anyone make it shorter? Other programming languages are also allowed.
Problem formulation: Given 8 integers: -1000 < x1, y1, x2, y2, x3, y3, x4, y4 < 1000. Check what is the shape of the intersection of two axis-aligned rectangles: P1 = (x1, y1), (x1, y2), (x2, y2), (x2, y1) and P2 = (x3, y3), (x3, y4), (x4, y4), (x4, y3).
* If the rectangles do not intersect print *nothing*.
* If there is exactly one point in common print *point*.
* If the intersections of P1 and P2 is a line segment print *line*.
* If they have a rectangular area in common print *rectangle*.

Input data specification: The first line contains the number of test cases t (1<=t<1000). Each of the following t lines contains 8 integers: x1, y1, x2, y2, x3, y3, x4, y4 (The area of both rectangles is greater than 0).
You can test your solution here.

How come I don't see any submitted solutions to this problem?

@Keith Randall  The contest session is over, results for submitted solutions are summarized here

What if the coordinates don't make rectangles? What if the shapes overlap to form a shape other than a rectangle?

@J843136028 you can assume that they do form a rectangle. To the second part off the question  I can see now that it is not mentioned that rectangles are axis-aligned (missing word added).

Python, 200 characters
f=lambda a,b,c,d:min(2,sum((x-c)*(x-d)<=0for x in range(min(a,b),max(a,b)+1)))
for i in' '*input():z=map(int,raw_input().split());print('nothing','point','line',0,'rectangle')[f(*z[::2])*f(*z[1::2])]

f returns:
0 if the intervals [a,b] and [c,d] don't overlap
1 if the intervals [a,b] and [c,d] overlap in only one point
2 if the intervals [a,b] and [c,d] overlap in a range of points

OCaml, 265 chars
let a,c,p=abs,compare,print_endline
let q s t u v w x y z=match
c(a(s-u)+a(w-y))(a(s+u-w-y)),
c(a(t-v)+a(x-z))(a(t+v-x-z))with
0,0->p"point"|0,1|1,0->p"line"|1,1->p"rectangle"|_->p"nothing"
let()=for n=1 to read_int()do Scanf.scanf"%d %d %d %d %d %d %d %d\n"q done

Uses (abuses) the fact that compare returns 0, 1 or -1. This is not guaranteed according to its documentation but true with OCaml 3.10.1.

Nice! One suggestion:I would write Scanf.scanf" %d %d %d %d %d %d %d %d" (-1 char)

source: Stack Exchange

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/3.0/

sort: votes


text:
Draw a Suanpan abacus
Write the shortest program that takes a single integer as input and prints out a Suanpan abacus
Testcases
Input:
314159

Output:
|\======================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
||  (__)  (__)  (__)  (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)  (__)  ||
|<======================================>|
||  (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||   ||    ||   (__)   ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/======================================\|

Input:
6302715408

Output:
|\==============================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||   (__)   ||   (__)   ||    ||   (__)  ||
|<==============================================================>|
||  (__)  (__)   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  ||
||   ||   (__)   ||   (__)  (__)   ||    ||   (__)   ||   (__)  ||
||   ||   (__)   ||    ||    ||    ||    ||   (__)   ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||   (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||   ||    ||   (__)   ||    ||    ||   (__)   ||   (__)   ||   ||
||  (__)   ||   (__)   ||    ||   (__)  (__)   ||   (__)   ||   ||
||  (__)   ||   (__)  (__)  (__)  (__)  (__)   ||   (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||   (__)  (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==============================================================\|

Can the number be given on the command-line?

Any restrictions on input length?

Similar to http://golf.shinh.org/p.rb?Soroban+Fixed if anyone needs some ideas on how to golf more.

So the top row and the bottom row are always completely filled? Why did they invent such a redundant abacus? :)

@Timwi, the same abacus can be used for hexidecimal. When used for decimal the extra rows are mostly used when performing multiplications and divisions

It's a bit late to comment on this question, but... I hate the decorations in the second and second to last columns. HATE HATE HATE.

@JesseMillikan, never too late. Time and golf are orthogonal concepts.

J, 126 124 121 119 116 115 113 105 116 115 112 characters
'|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1[(s=:[,.~,.)9!:7'\=/<=>/=\|='

Takes input from the keyboard. Example:
   '|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1[(s=:[,.~,.)9!:7'\=/<=>/=\|='
6302715408
|\==============================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||   (__)   ||   (__)   ||    ||   (__)  ||
|<==============================================================>|
||  (__)  (__)   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  ||
||   ||   (__)   ||   (__)  (__)   ||    ||   (__)   ||   (__)  ||
||   ||   (__)   ||    ||    ||    ||    ||   (__)   ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||   (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||   ||    ||   (__)   ||    ||    ||   (__)   ||   (__)   ||   ||
||  (__)   ||   (__)   ||    ||   (__)  (__)   ||   (__)   ||   ||
||  (__)   ||   (__)  (__)  (__)  (__)  (__)   ||   (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||   (__)  (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==============================================================\|

The main trick here is the abuse of J's boxing by redefining the characters it uses. It uses a global parameter - 9!:7 - to do this. There may be room for further golfing, but to be honest I was just glad to get something working that should compensate for my last attempt at this question.
Fits in a tweet with enough characters left to say 'Gaz made this' :-).
Edit: 3 characters of savings are due to borrowing the 2 6$'  ||   (__)' from Jesse Millikan's answer.
Further edit: Lost 11 characters adding extra spaces at either side that I hadn't noticed were not present.
Explanation:
The code is in three main sections:
1) Setup
[(s=:[,.~,.)9!:7'\=/<=>/=\|='

This is itself in two parts.
9!:7'\=/<=>/=\|=' redefines the characters that J will use to display boxes. J's boxing normally looks like this:
   2 2$<"0[1 2 3 4
┌─┬─┐
│1│2│
├─┼─┤
│3│4│
└─┴─┘

but after redefining it looks like this:
   2 2$<"0[1 2 3 4
\===/
|1|2|
<===>
|3|4|
/===\

(s=:[,.~,.) defines a verb I'm going to be using a couple of times later. This turns out to be the best place to declare it. It takes a character on the left and an array of characters on the right and sandwiches the array between the character. For example:
   3 5$'abcdefghijklmno'
abcde
fghij
klmno

   '-' s 3 5$'abcdefghijklmno'
-abcde-
-fghij-
-klmno-

The final [ just serves to separate the setup from the next part.
2) Input and Representation
,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1

".,.1!:1[1 takes the input from the keyboard and separates it into individual digits:
   ".,.1!:1[1
314159
3 1 4 1 5 9

((i.5)</5|]) creates a zeros and ones representation of the bottom part of the abacus:
   ((i.5)</5|]) 3 1 4 1 5 9
1 1 1 1 0 1
1 0 1 0 0 1
1 0 1 0 0 1
0 0 1 0 0 1
0 0 0 0 0 0

|:@(1,.<&5) creates a zeroes and ones representation of the top part of the abacus:
   |:@(1,.<&5) 3 1 4 1 5 9
1 1 1 1 1 1
1 1 1 1 0 0

These two parts are boxed together using ;:
   (|:@(1,.<&5);((i.5)</5|])) 3 1 4 1 5 9
\=======================/
|1 1 1 1 1 1|1 1 1 1 0 1|
|1 1 1 1 0 0|1 0 1 0 0 1|
|           |1 0 1 0 0 1|
|           |0 0 1 0 0 1|
|           |0 0 0 0 0 0|
/=======================\

Then the boxes are placed one on top of the other to form the basis of the abacus, giving:
   ,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\===========/
|1 1 1 1 1 1|
|1 1 1 1 0 0|
<===========>
|1 1 1 1 0 1|
|1 0 1 0 0 1|
|1 0 1 0 0 1|
|0 0 1 0 0 1|
|0 0 0 0 0 0|
/===========\

3) Output
'|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>

&.> means that what follows will operate on both boxes in turn.
(,-.) this is a hook which will negate the input and then add it to the end of the original:
   2 5$1 0 1 0 1
1 0 1 0 1
1 0 1 0 1

   (,-.) 2 5$1 0 1 0 1
1 0 1 0 1
1 0 1 0 1
0 1 0 1 0
0 1 0 1 0

This is really part of the representation, but for golfing purposes it's better to have it in this section. Applied to the previous input:
   (,-.)&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\===========/
|1 1 1 1 1 1|
|1 1 1 1 0 0|
|0 0 0 0 0 0|
|0 0 0 0 1 1|
<===========>
|1 1 1 1 0 1|
|1 0 1 0 0 1|
|1 0 1 0 0 1|
|0 0 1 0 0 1|
|0 0 0 0 0 0|
|0 0 0 0 1 0|
|0 1 0 1 1 0|
|0 1 0 1 1 0|
|1 1 0 1 1 0|
|1 1 1 1 1 1|
/===========\

[:,.(_6[\'  ||   (__)'){~ The zeroes and ones are now used to select a string to represent a bead or the absence of one:
   ([:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\====================================/
| (__)  (__)  (__)  (__)  (__)  (__) |
| (__)  (__)  (__)  (__)   ||    ||  |
|  ||    ||    ||    ||    ||    ||  |
|  ||    ||    ||    ||   (__)  (__) |
<====================================>
| (__)  (__)  (__)  (__)   ||   (__) |
| (__)   ||   (__)   ||    ||   (__) |
| (__)   ||   (__)   ||    ||   (__) |
|  ||    ||   (__)   ||    ||   (__) |
|  ||    ||    ||    ||    ||    ||  |
|  ||    ||    ||    ||   (__)   ||  |
|  ||   (__)   ||   (__)  (__)   ||  |
|  ||   (__)   ||   (__)  (__)   ||  |
| (__)  (__)   ||   (__)  (__)   ||  |
| (__)  (__)  (__)  (__)  (__)  (__) |
/====================================\

But now, as Howard pointed out to me, there is one space short on either side of the beads. So we use the predefined s verb to sandwich the contents of each box between two columns of spaces:
   (' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\======================================/
|  (__)  (__)  (__)  (__)  (__)  (__)  |
|  (__)  (__)  (__)  (__)   ||    ||   |
|   ||    ||    ||    ||    ||    ||   |
|   ||    ||    ||    ||   (__)  (__)  |
<======================================>
|  (__)  (__)  (__)  (__)   ||   (__)  |
|  (__)   ||   (__)   ||    ||   (__)  |
|  (__)   ||   (__)   ||    ||   (__)  |
|   ||    ||   (__)   ||    ||   (__)  |
|   ||    ||    ||    ||    ||    ||   |
|   ||    ||    ||    ||   (__)   ||   |
|   ||   (__)   ||   (__)  (__)   ||   |
|   ||   (__)   ||   (__)  (__)   ||   |
|  (__)  (__)   ||   (__)  (__)   ||   |
|  (__)  (__)  (__)  (__)  (__)  (__)  |
/======================================\

Having done that, all that's left is to convert this into a string using ": so that we can sandwich it between two columns of |:
   '|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
|\======================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
||  (__)  (__)  (__)  (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)  (__)  ||
|<======================================>|
||  (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||   ||    ||   (__)   ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/======================================\|

I felt there was something "wrong" with your output but it took me some time to recognize: you omit an empty column on the very left and right of the display (third and third-last ascii column).

@Howard Woah, good spot. I didn't notice that. I'll have a look at fixing it.

@Howard Fixed at a cost of 11 characters. Shame, I thought I might have a chance at getting below 100. :-(

Nice work. Looks like @Howard has a lot of work to do to catch up

Bounty has 3 days left. I've marked this one as accepted for the mean time.

Upvoted just for the beautiful explanation.

Ruby 1.9, 154 characters
puts'|\%s/|'%$r=?=*(2+6*gets.size),(0..14).map{|a|a==4?"|<#$r>|":"|| #{$_.gsub(/./){(5*a+n=$&.hex)/10!=1&&(a-n%5)/5!=1?' (__) ':'  ||  '}} ||"},"|/#$r\\|"

Assumes the input is not terminated by a newline.
Fun fact: Due to the way I'm turning the input digits into numbers ($&.hex is one byte shorter than $&.to_i), this abacus actually works with hex digits up to e:
$ echo -n "0123456789abcdef" | ruby suanpan.rb
|\==================================================================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||    ||    ||    ||    ||    ||   ||
||  (__)  (__)  (__)  (__)  (__)   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||    ||    ||    ||    ||   (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|<==================================================================================================>|
||   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   ||
||   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||   ||
||   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)  ||
||  (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  ||
||  (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  ||
||  (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==================================================================================================\|

For 0xf, a third bead magically appears in the upper half.
When allowing additional flags during script invocation, this can be shortened to 152 bytes (149 bytes code + 3 bytes additional invocation flags):
puts'|\%s/|'%$r=?=*(2+6*~/$/),(0..14).map{|a|a==4?"|<#$r>|":"|| #{$_.gsub(/./){(5*a+n=$&.hex)/10!=1&&(a-n%5)/5!=1?' (__) ':'  ||  '}} ||"},"|/#$r\\|"

Run with ruby -n suanpan.rb.

Perl (151 chars)
(168 163 158 157 156 154)
$i=<>;$c.=$_-4?"
||  $i||":"
|<$m>|",$m='==',$c=~s!\d!$m.='='x6;($_-$&%5)/5%2|(5*$_+$&)/10%7==1?' ||   ':'(__)  '!eg for 0..14;print"|\\$m/|$c
|/$m\\|"

Explanation
# Read the number from STDIN.
$i = <>;

# for statement starts here...

    # Append to $c a line containing either the horizontal dividing bar (in row #4)
    # or the current abacus row with the digits in place of the pegs.
    # This relies on the fact that $m will have been computed after at least one iteration.
    $c .= $_-4 ? "\n||  $i||" : "\n|<$m>|",

    # Notice that $m is redundantly recomputed from scratch in each iteration.
    $m = '==',

    # Substitute the correct pegs for the digit characters.
    $c =~ s!\d!
        $m .= '=' x 6;

        # Weird expression for the abacus function.
        # I have to use “% 7” because otherwise the division is floating-point...
        # Notice that $_ is the row and $& is the digit.
        ($_ - $& % 5)/5 % 2 | (5*$_ + $&)/10 % 7 == 1
        ? ' ||   '
        : '(__)  '
    !eg
for 0..14;

# Could shorten further by using “say” if you don’t mind excluding the “-E” from the count...
print "|\\$m/|$c\n|/$m\\|"

Edits

(154 → 151) Changed three \ns to actual newline characters. Can’t believe I didn’t think of that earlier!

This is just... Awesome!

Windows PowerShell, 191
$y='='*(2+6*($i=[char[]]"$input").Count)
filter f($v){"|| $((' (__)','  || ')[($i|%{iex $_%$v})])  ||"}"|\$y/|"
f 1
f 10-ge5
f 1+1
f 10-lt5
"|<$y>|"
1..5|%{f 5-lt$_}
1..5|%{f 5-ge$_}
"|/$y\|"

History:

2011-03-11 23:54 (340) Initial attempt.
2011-03-12 00:21 (323) Using string interpolation throughout the code.
2011-03-12 00:21 (321) Inlined $l.
2011-03-12 01:07 (299) Used a function for the more repetitive parts as well as a format string.
2011-03-12 01:19 (284) Changed the arguments to the function slightly. Hooray for command parsing mode.
2011-03-12 01:22 (266) More variables for recurring expressions.
2011-03-12 01:28 (246) Now every row is generated by the function.
2011-03-12 01:34 (236) Since I use the chars only in string interpolation I can safely ignore the % that makes numbers from the digits.
2011-03-12 01:34 (234) Slightly optimized the array index generation in the function.
2011-03-12 01:42 (215) I no longer need $r and $b. And $a is also obsolete. As is $l.
2011-03-12 01:46 (207) No need to set $OFS if I need it only once.
2011-03-12 01:49 (202) Inlined $f.
2011-03-12 01:57 (200) No need for the format string anymore. String interpolation works just fine.
2011-03-12 02:00 (198) Slightly optimized generating the individual rows (re-ordering the pipeline and array index).
2011-03-12 02:09 (192) No need for -join since we can actually use the additional space to good effect.

Haskell, 243 characters
z x|x=" (__) ";z _="  ||  "
h[a,b]d f w='|':a:replicate(2+6*length d)'='++b:"|\n"++q z++q(z.not)
 where q b=w>>=(\v->"|| "++(d>>=b.(>v).f)++" ||\n")
s d=h"\\/"d(5-)[-9,0]++h"><"d(`mod`5)[0..4]++h"/\\"d id[]
main=interact$s.map(read.(:[])).init

Not particularly clever. I'm sure it can be shortened somehow...

Edit: (246 -> 243) took @FUZxxl's suggestion to use interact

How about using interact

First line can be shortend to z x|x=" (__) "|0<1="  ||  ".

Your alternative first line is only shorter because you dropped two spaces that are required!

Oops! You're of course right.

Delphi, 348
This version builds up a string to write just once; The digits are handled by a separate function that works via a digit modulo m >= value construct (negated if value <0).
var d,s,o,p:string;c:Char;i:Int8;function g(m,v:Int8):string;begin p:='|| ';for c in d do p:=p+Copy('  ||   (__) ',1+6*Ord(((Ord(c)+2)mod m>=Abs(v))=(v>0)),6);g:=p+' ||'^J;end;begin ReadLn(d);s:=StringOfChar('=',2+6*Length(d));for i:=1to 5do o:=g(5,6-i)+o+g(5,-i);Write('|\'+s+'/|'^J+g(1,-1)+g(10,-5)+g(1,1)+g(10,5)+'|<'+s+'>|'^J+o+'|/'+s+'\|')end.

Delphi, 565
First attempt :
var _:array[0..6]of string=('  ||  ',' (  ) ','======','|\==/|','||  ||','|/==\|','|<==>|');m:array[0..186]of Byte;o:array[0..16]of string;i,j,c,f,l:Word;begin for i:=0to 9do begin f:=i*17;m[f+1]:=1;m[f+2]:=Ord(i<5);m[f+3]:=0;m[f+4]:=Ord(i>4);for j:=6to 10do m[f+j]:=Ord(i mod 5>j-6);for j:=11to 15do m[f+j]:=Ord(i mod 5<=j-11);m[f]:=2;m[5+f]:=2;m[16+f]:=2;end;f:=170;m[f]:=3;for i:=1to 15do m[f+i]:=4;m[f+5]:=6;m[f+16]:=5;repeat for i:=0to 16do Insert(_[m[f+i]],o[i],l);Read(PChar(@c)^);c:=c-48;f:=c*17;l:=Length(o[0])-2;until c>9;for i:=0to 16do WriteLn(o[i])end.

This uses 3 arrays; one for the 7 strings that could be discerned, one for the output lines and one to map the 7 strings to 11 columns (10 digits and 1 initial column).

GolfScript, 139 characters
0+17'|':Q*:R'\<||'4Q**'/'+@{48-.5<)[1]*2,2*$+4<\5%[1]*2,5*$+10<+`{{1$=}%+2>'=='1/*5/('='+\+}+'     (|_|_ )'2//}/;;;;'/>||'4Q**'\\'+R]zip n*

Not much golfed yet, but it fits into a tweet (with only ASCII). Try it here.

J, 225
Passes two tests given, should work up to at least several hundred digits.
c=:2 6$'   ||   (__)'
f=:(2{.[),('='#~2+6*#@]),2}.[
d=:'||',"1'  ||',~"1,"2&(c{~|:)
g=:('|\/|'&f,d&(1,.-.,.0,.])&(4&<),'|<>|'&f,d&(5($!.0"1)0,~"(1)1#~"0|~&5),|.&d&(5($!.0"1)1#~"0(5-5|])),'|/\|'&f)
4(1!:2)~LF,"1 g"."0}:(1!:1)3

First off: Yes, yes, gravedigging. Second: That's just embarassingly long. Oh well. I haven't decided yet whether to golf it further or curl up in fetal position and cry. (Or both!)
Here's a bit of explanation in lieu of a shorter program:

c is 2x6 table of empty cell, bead cell for rendering.
f renders an '=' row with the four outside characters as left argument.
d renders an abacus row by translating 0/1 matrices into bead cells padded with ||
g takes digits and vertically compiles character rows using f for 'formatting' rows and d for abacus rows.
The last row gets input, splits into characters and converts those to numbers, feeds to g and then prints.

C, 277 274 characters
You know, it seems to me that we just don't have enough solutions here that really take advantage of the C preprocessor. Partly that's because those #defines actually take up a fair bit of space. But still, there's so much potential. I feel the need to address this deficiency.
#define L(x,z)for(printf("|"x),p=b;*p||puts(#z)<0;++p)printf(
#define F(x,y,z)L(#x,==z|)"======",y);
#define T(y)L("|  ",||)*p-47 y?"(__)  ":" ||   ");
i;char*p,b[99];main(j){gets(b);F(\\,0,/)T()T(<6)T(<1)T(>5)F(<,*p>52?*p-=5:0,>)
for(;++i<6;)T(>i)for(;++j<7;)T(<j)F(/,0,\\)}

That's better.

Mathematica 281
w@n_:= Module[{t=Table,f,g},
 f@d_:=ReplacePart["O"~t~{7},{2-Quotient[d,5]-> "|",3+Mod[d,5]-> "|"}];
 g@k_:=IntegerDigits@n~PadLeft~10;
 Grid[Insert[Insert[(f/@g@n)T,"=="~t~{10},{{1},{3},{8}}]T,""~t~{10},{{1},{11}}]T]]

Example
w[6302715408]

Congrats on 10k! :-D

@Doorknob.  Thanks!  Congrats to you, too!

C, 548
#define p(a) printf(a);
#define F(x,m) for(x=0;x<m;x++)
#define I(x) {p("||")F(j,l)if(b[l*(i+x)+j]){p("  (__)")}else{p("   || ")}p("  ||\n")}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int a,char* c[]){int i,j,l,m,*b;l=strlen(c[1]);b=(int*)malloc(l*56);m=6*l;F(i,14*l)b[i]=0;
F(j,l){b[j]=1;if(c[1][j]<53){b[l+j]=1;}else{b[3*l+j]=1;c[1][j]-=5;}F(i,5){if(i<c[1][j]-'0'){
b[(i+5)*l+j]=1;}else{b[(i+9)*l+j]=1;}}}p("|\\=")F(i,m)p("=")p("=/|\n")F(i,4)I(0)p("|<=")F(i,m)
p("=")p("=>|\n")F(i,9)I(5)p("|/=")F(i,m)p("=")p("=\\|\n")}

First version, just a bit of golfing so far.

Scala (489 characters)
def a(i:String){val b=" (__) ";val n="  ||  ";1 to 17 map{l=>;{print(l match{case 1=>"|\\=";case 6=>"|<=";case 17=>"|/=";case _=>"|| "});print(l match{case 1|6|17=>"======"*i.size;case 2|16=>b*i.size;case 4|11=>n*i.size;case 3=>i flatMap{d=>{if(d.asDigit<5)b else n}};case 5=>i flatMap{d=>{if(d.asDigit>4)b else n}};case _=>i flatMap{d=>{if(l<11)if(d.asDigit%5<l-6)n else b else if(d.asDigit%5>l-12)n else b}}});;print(l match{case 1=>"=/|";case 6=>"=>|";case 17=>"=\\|";case _=>" ||"})}}}

Pretty crappy attempt really.

Sclipting, 77 chars
The bounty refers to tweets, and Twitter counts characters (not bytes). :)
꿓뤽꿓뤽①長復標독렽꿐②껷렊밃겠上❶가侔是丟돃렽꿐②꿧렊不돇렠글⓶①各❷❷걐剩減갰減갰分❸⓷걀大加增增감右與꺅뭟꺒갠⓵긇롼긂갠嗎⓶終丟돇렊終終돂묽꿐②뇇렊

I actually wrote this years ago (when this challenge was posted), but I never posted it because I invented Sclipting after this challenge was first posted. If you feel that this makes it ineligible, I understand.
Explanation
꿓뤽꿓뤽①長復 | let x = "======" times the length of the input string
標 | mark
독렽꿐②껷렊 | "|\\==" + x + "/|\n"
밃겠上 | for row in [-4 .. 10]
    ❶가侔是 | if row == 0
        丟돃렽꿐②꿧렊 | "|<==" + x + ">|\n"
    不 | else
        돇렠글 | "||  "
        ⓶①各 | foreach char c in input
            | ((r-(c%5)-3)/3 & ((r + (c>4?3:2)) >> 1)) ? "(__) " : " ||   "
            ❷❷걐剩減갰減갰分❸⓷걀大加增增감右與꺅뭟꺒갠⓵긇롼긂갠嗎⓶
        終丟
        돇렊 | "||\n"
    終
終
돂묽꿐②뇇렊 | "|/==" + x + "\\|\n"

Thanks for your interesting answer. I agree that it's best to stick to the rule that only languages that are published prior to the question being asked should be eligible. I don't believe you would deliberately have designed your language to win this challenge, but at the same time I don't think it's fair on the other answerers, and we don't want to open the floodgates for newly invented languages on old questions since we know what will happen...

@gnibbler: Sure, I’m fine with that. I think this rule is an important one.

Python, 309 301 288 chars
Compact version:
q=p,b="  ||  "," (__) "
t="|| %s ||\n"
a=lambda h:t%"".join(q[i]for i in h)
n=[int(d)for d in str(input())]
c=len(n)
e="="*(c*6+2)
h="|\\"+e+"/|"
print h+"\n"+t%(b*c)+a(d<5 for d in n)+t%(p*c)+a(d>4 for d in n)+"|<"+e+">|\n"+"".join(a((d%5>i%5)^(i>4)for d in n)for i in range(10))+h[::-1]

Clear version:
bead = " (__) "
pole = "  ||  "
template = "|| %s ||\n"
output = ""
def addline(hasbeads):
    global output
    output += template % "".join([bead if item else pole for item in hasbeads])

digits = [int(d) for d in str(input())]
count = len(digits)
equalsigns = "=" * (count * 6 + 2)
output = ""
header = "|\\" + equalsigns + "/|"
output += header + "\n"
output += template % (bead * count)
addline([d < 5 for d in digits])
output += template % (pole * count)
addline([d > 4 for d in digits])
output += "|<" + equalsigns + ">|\n"
for i in range(5):
    addline([d % 5 > i for d in digits])
for i in range(5):
    addline([d % 5 <= i for d in digits])
output += header[::-1]
print output

Note that for compactification, variables were renamed to a single letter, and list comprehensions were changed to generators that don't require extra brackets.

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