In four dimensional string theories with N=4 and N=8 supersymmetries one can
often define twisted index in a subspace of the moduli space which captures
additional information on the partition function than the ones contained in the
usual helicity trace index. We compute several such indices in type IIB string
theory on K3 x T^2 and T^6, and find that they share many properties with the
usual helicity trace index that captures the spectrum of quarter BPS states in
N=4 supersymmetric string theories. In particular the partition function is a
modular form of a subgroup of Sp(2,Z) and the jumps across the walls of
marginal stability are controlled by the residues at the poles of the partition
function. However for large charges the logarithm of this index grows as 1/n
times the entropy of a black hole carrying the same charges where n is the
order of the symmetry generator that is used to define the twisted index. We
provide a macroscopic explanation of this phenomenon using quantum entropy
function formalism. The leading saddle point corresponding to the attractor
geometry fails to contribute to the twisted index, but a Z_n orbifold of the
attractor geometry produces the desired contribution.Comment: LaTeX file, 35 pages; v2: references adde