Equilibrium index of a sequence
Golfscript 17 16

Since the form of the input isn't specified, this takes a string in Golfscript array format from stdin.

~0\{1$+.@+\}/])?


So run as e.g.

golfscript.ry eqindex.gs &lt;&lt;&lt;"[-7 1 5 2 -4 3 0]"


The idea is very simple: it takes an array of A_i and maps to an array of A_i + 2 SUM_{j&lt;i} A_j and then looks for the first index which is equal to the sum of the whole array.



For @mellamokb's challenge I offer:

~0\{1$+.@+\}/:S;]:A,,{A=S=},`


for 29 chars.