public Rational at ( int n ) { if ( n == 1 ) { return ( new Rational ( - 1 , 2 ) ) ; } else if ( n % 2 != 0 ) { return Rational . ZERO ; } else { final int nindx = n / 2 ; if ( a . size ( ) <= nindx ) { for ( int i = 2 * a . size ( ) ; i <= n ; i += 2 ) { set ( i , doubleSum ( i ) ) ; } } return a . get ( nindx ) ; } }
The Bernoulli number at the index provided .