Finding Powers Of Powers of k mod n

Time: :

k0,k1,k2,k3, ..., kr, k21, k22, k23,..., k2s, k31, k32, k33,..., k3t,...
where r, s, t,... are the orders of k1 mod n, k2 mod n, k3 mod n, ...