# How to use IntegerQ on list?

t1 ={0, 1, 2, Log[6]/Log[2], 3, Log[12]/Log[2], 4, Log[24]/Log[2]}


I want to get the Position of the Integers. I can do it by

Flatten[Position[Length /@ t1, 0]]


to get the result {1,2,3,5,7}. How would I use IntegerQ here to get the same result?

• Use Position[t1, <pattern>, 1] and find some way to use IntegerQ in a pattern (spoiler). Mar 18 at 15:51

Note that

IntegerQ/@t1


gives a vector consisting if Trues and Falses. So you want the Positions of all those that have True:

Flatten@Position[IntegerQ /@ t1, True]
{1,2,3,5,7}

• Also Flatten@Position[t1, _Integer, 1] Mar 18 at 22:05