I'm am trying to find a way to check if the first first a number in a nested list equals to x. 

> 
> check(X,L), X= is a number and Y is a nested list.
> 
> 
> 

```
check(2,[a,b[g,4],y,8]).
false

check(2,[a,b[g,2],y,8]).
true

```

It seems that recursion would do best. But I still do not understand how to approach it with recursion in Prolog. 
I had this idea of flattening the nested list and then check if first element is a number and if it equals to X. 
Can anyone help me?