Problem: What is the remainder of $a^{72} \mod 35$ if $a$ is a whole number not having $5$ or $7$ as divisors. I have the following problem:
Problem: What is the remainder of $a^{72} \mod 35$ if $a$ is a whole number not having $5$ or $7$ as divisors.
If $a$ cannot be divided by $5$ or $7$ it cannot be divided by $35$, so the remainder is not $0$.
However the remainder can be everything between $1$ and $34$ excluding numbers divisible by $5$ or $7$ ? 
Thanks for your time.

Since $a$ and $35$ are coprime $(gcd (a, 35) = 1)$, use Euler's totient function:
$$a^{\phi(n)} = 1 \hspace{2 pt} mod \hspace{2 pt}n$$
So you get $$a^{\phi(35)} = a^{24} =  1 \hspace{2 pt} mod \hspace{2 pt}35$$
Thus,
$$a^{24^3} = a^{72} = 1^3 mod 35 = 1$$
So $1$ is your remainder.
Example: Set $a = 24$. http://www.calculatorpro.com/calculator/modulo-calculator/
