BrainF***-optimize a series of numbers
Python, 205 characters

def o(l):
    d=lambda l,a:[(d+1,m-a)if m&gt;a/2 else(d,m) for d,m in(divmod(x,a)for x in l)]
    a,x=min((a+sum(abs(x)+abs(y)for x,y in d(l,a)),a,d(l,a))for a in range(1,max(l)+1))[1:]
    return [a]+zip(*x)


Examples:

&gt;&gt;&gt; o([3,16,8,4])
[4, (1, 4, 2, 1), (-1, 0, 0, 0)]
&gt;&gt;&gt; o([87,75,68,96])
[11, (8, 7, 6, 9), (-1, -2, 2, -3)]
&gt;&gt;&gt; o([4,4,4])
[4, (1, 1, 1), (0, 0, 0)]
&gt;&gt;&gt; o([1,2,3,4,5,6,7,8])
[4, (0, 0, 1, 1, 1, 1, 2, 2), (1, 2, -1, 0, 1, 2, -1, 0)]


As a bonus for a very long solution, the BF formater:

def bf(l):
    N,f,s=o(l)
    return ('%s[%s%s-]%s'%(N*'+',
                           ''.join('&gt;' + x*'+' for x in f),
                           ''.join('&lt;' for _ in f),
                           ''.join('&gt;' + abs(x)*('+' if x&gt;0 else '-')for x in s)))

&gt;&gt;&gt; bf([3,16,8,4])
'++++[&gt;+&gt;++++&gt;++&gt;+&lt;&lt;&lt;&lt;-]&gt;-&gt;&gt;&gt;'