We know:
Map[Head, {a, a^2, a^3}]
(* {Symbol, Power, Power} *)
and Map[Head, {2, 2^2, 2^3}] all of them will be known as Integers.
But how can we get the result of
Map[Head, {2, 2^2, 2^3}]`
{Integer, Power, Power}
I mean how Mathematica recognize a value is a power of two others?
#[[1, 0]] & /@ {Hold[2], Hold[2^2], Hold[2^3]}givesInteger, Power, Power– LLlAMnYP Feb 19 '16 at 09:112^2evaluates and becomes4, it is not aPower. – LLlAMnYP Feb 19 '16 at 09:13SetAttributes[f, HoldAll]; f[x_]:=Head@Unevaluated@x; Map[f, Unevaluated@{2, 2^2, 2^3}]– LLlAMnYP Feb 19 '16 at 09:17PrimePowerQ[]. – J. M.'s missing motivation Feb 19 '16 at 11:27