List of perfect squares upto n ^ 2
ArrayList perfectSquares = getPerfectSquares ( ( int ) Math . Pow ( n , 2 ) ) ; int count = 0 ; for ( int a = 1 ; a <= n ; a ++ ) { int aSquare = ( int ) Math . Pow ( a , 2 ) ; for ( int i = 0 ; i < perfectSquares . Count ; i ++ ) { int cSquare = ( int ) perfectSquares [ i ] ;