Let $T(p)$ be the period of the decimal expansion of $1/p$, for prime $p$ (e.g. $1/7=0.\overline{142857}\rightarrow T(7)=6$). It is known that $$T(p)=\frac{p-1}{t}$$ for some integer $t$. Then, Artin's conjecture states that the fraction of primes for which $t=1$ is positive and is given by Artin's constant: $$ A_1=\lim_{x\rightarrow\infty}\frac{\#\{p:\frac{p-1}{T(p)}=1\text{ } \ {\rm and } \ p\leq x\}}{\#\{p:p\leq x\}}=\prod_{p} \left(1-\frac{1}{p(p-1)}\right)=0.3739558136... $$ Artin's constant can be generalized by considering the fraction $A_t$ of primes that satisfy some arbitrary $t$. My question is: Is there some known formula to calculate it for any $t$?
By searching about the subject, I found some articles that seem to give expressions for that, but they are quite hard to read and understand. Ram Murty in this article and Wagstaff in this one seem to imply that $$A_t=\frac{A_1}{t^2}\prod_{p\mid t}\left(\frac{p^2-1}{p^2-p-1}\right)$$ But by considering the first 1,000,000 primes, it doesn't seem to give the correct result for some values of $t$, such as $t=40$. So, in addition to the first question, what are the limitations of the above formula?
Your question is answered by Lenstra, Moree, and Stevenhagen's paper "Character sums for primitive root densities": https://arxiv.org/abs/1112.4816. On pages 2 and 3 they write (their $r$ is $10$ for you)
See Section 6, "Near-primitive roots" where for $r \in \mathbf Q^\times - \{\pm 1\}$ and a positive integer $t$ they aim to compute "the density of the set of primes $q$ for which $r \bmod q$ generates a subgroup of $\mathbf F_q^\times$ of exact index $t$". That's what you want. Their Theorem 6.4 answers your question, using 10 for their $r$ in the formula for $\delta(S)$. For example, to calculate the density with $t = 40$, you want their $E\cdot A(10,40)$.
Their Theorem 6.7 describes exactly when the density vanishes and they describe in a paragraph before that theorem the difficulty of using the formulation for the density in Wagstaff's paper to determine if such a density is zero or not.