 <p>You are using <a href="http://stackoverflow.com/q/3602827/560648">integer division</a>, so your series converges really, really quickly.</p> <p>Make <code>s</code> and <code>a</code> be <code>double</code>s, and replace <code>4</code> with <code>4.0</code>.</p>