<s>[INST] How to prove :If $p$ is prime greater than $3$ and $\gcd(a,24\cdot p)=1$ then $a^{p-1} \equiv 1 \pmod {24\cdot p}$? I want to prove following statement :

If $p$ is a prime number greater than $3$ and $\gcd(a,24\cdot p)=1$ then :
$a^{p-1} \equiv 1 \pmod {24\cdot p}$

Here is my attempt :
The Euler's totient function can be written in the form :
$n=p_1^{k_1}\cdot p_2^{k_2} \ldots \cdot p_r^{k_r} \Rightarrow \phi(n)=p_1^{k_1}\cdot\left(1-\frac{1}{p_1}\right)\cdot p_2^{k_2}\cdot\left(1-\frac{1}{p_2}\right)\ldots p_r^{k_r}\cdot \left(1-\frac{1}{p_r}\right)$
So,
$\phi(24 \cdot p)=2^3\cdot \left(1-\frac{1}{2}\right)\cdot3^1\cdot\left(1-\frac{1}{3}\right)\cdot p\cdot\left(1-\frac{1}{p}\right)=8\cdot(p-1)$
Euler's totient theorem states that :
if $\gcd(a,n)=1$ then $a^{\phi(n)} \equiv 1 \pmod n$
Therefore we may write :
$a^{\phi(n)}-1 \equiv 0 \pmod n \Rightarrow a^{\phi(24\cdot p)}-1=a^{8\cdot(p-1)}-1 \equiv 0 \pmod{24\cdot p} \Rightarrow$
$\Rightarrow \left(a^{p-1}\right)^8-1=(a^{p-1}-1)\cdot \displaystyle \sum_{i=0}^7 a^{(p-1)\cdot i} \equiv 0\pmod{24\cdot p}$
So we may conclude :
$(a^{p-1}-1) \equiv 0 \pmod {24\cdot p}$ , or $\displaystyle \sum_{i=0}^7 a^{(p-1)\cdot i} \equiv 0\pmod{24\cdot p}$
How can I prove that $\displaystyle \sum_{i=0}^7 a^{(p-1)\cdot i} \not\equiv 0\pmod{24\cdot p}$ ?
 [/INST] HINT $\ $ By Carmichael's simple generalization of Euler $\phi$, since prime $\rm\:p\:$ is coprime to $2,3$
$\rm\ \ \lambda(8\cdot3\cdot p) = lcm(\lambda(8),\lambda(3),\lambda(p)) = lcm(\phi(8)/2,\phi(3),\phi(p)) = lcm(2,2,p-1) = p-1\ $ 
therefore $\rm\quad gcd(n,24\:p) = 1\ \ \Rightarrow\ \ 1\ \equiv\ n^{\:\lambda(24\:p)}\: \equiv \ n^{p-1}$
</s>