# Matching exponents using Cases[]

I have a question regarding pattern matching. Can anyone explain the results i get ?

Cases[Table[x^n, {n, 1, 10}], a_^1]


Which gives the following result.

{x, x^2, x^3, x^4, x^5, x^6, x^7, x^8, x^9, x^10}

I was expecting it to return x only similar to the case of x^2 shown below

Cases[Table[x^n, {n, 1, 10}], a_^2]


{x^2}

Thanks David.

a_^1 is converted to a_ before Cases is executed, matching each element of the Table.

Trace[Cases[Table[x^n, {n, 1, 10}], a_^1]]


(The output is a bit long to be presented here.)

Most Likely is because x^n^1 == x^n

x^n == (x^n)^1
(*True*)


a_ can be anything including x^n

If you try for example

Cases[Table[x^n, {n, 1, 10}], Power[x,1]]
(*{x}*)