List the first 20 friendly number pairs
APL (50)
↑⊃,/{g/⍨{=/{⍵÷⍨+/z/⍨0=⍵|⍨z←⍳⍵}¨⍵}¨g←⍵∘.,⍳⍵-1}¨⍳936
The list is slightly different but oeis.org agrees with me.
Output:
28 6
140 30
200 80
224 40
234 12
270 84
308 66
364 78
476 102
496 6
496 28
532 114
600 240
644 138
672 120
700 150
812 174
819 135
868 186
936 864
C (132)
x=1,e;float d(a,b){return b?1.f*(a%b==0)*b/a+d(a,--b):0;}main(){while(x<1148)for(e=x++;--e;)d(x,x)-d(e,e)||(printf("%d,%d\n",e,x));}
Thanks to shiona for the ideas on shorter code. And Felix Eve for the Code(counting down makes more sense if you only search pairs). With the added Pairs even shorter.
Readable Version:
x=1,e;
float d(a,b)
{
return b?1.f*(a%b==0)*b/a+d(a,--b):0;
}
main()
{
while(x<1148)
for(e=x++;--e;)
d(x,x)-d(e,e)||(printf("%d,%d\n",e,x));
}
Ruby, 90 characters
h={}
1.upto(1150){|n|s=0
1.upto(n){|x|s+=x if n%x<1}
r=s/n.to_r
p [h[r],n] if h[r]
h[r]=n}