Now you can easyly find a primenumber position without having to count it ... just use the algorithm below:
(* Definir intervalo de índices *)
indices = Range[1, 100];
(* Calcular tabela com índice, primo e resto mod 3 *)
tabela = Table[ {i, Prime[i], Mod[Prime[i]^i - i, 3]}, {i, indices}];
(* Separar em classes *)
classe0 = Select[tabela, #[[3]] == 0 &];
classe1 = Select[tabela, #[[3]] == 1 &];
classe2 = Select[tabela, #[[3]] == 2 &];
(* Mostrar tabelas organizadas *)
Grid[Prepend[classe0, {"Índice", "Primo", "Resto=0"}], Frame -> All]Grid[Prepend[classe1, {"Índice", "Primo", "Resto=1"}], Frame -> All]Grid[Prepend[classe2, {"Índice", "Primo", "Resto=2"}], Frame -> All]
(* Visualização gráfica para ver o padrão *)
ListPlot[ Table[{i, Mod[Prime[i]^i - i, 3]}, {i, indices}], PlotStyle -> {Red}, AxesLabel -> {"Índice i", "Resto mod 3"}, PlotRange -> {0, 3}, Ticks -> {Automatic, {0, 1, 2}}]
Select[
Range[1, 200],
Prime[#] == 113 && Mod[Prime[#]^#, 3] == 1 &
]
Mod[Prime[30]^30 - 30, 3]