Now iterate through all numbers and quickly check for Fibonacci
for ( int i = 0 ; i < x . Length ; i ++ ) { if ( fib . Contains ( x [ i ] ) ) { result . Add ( x [ i ] ) ; } } foreach ( int i in result ) Console . Write ( i + " ▁ " ) ; }