Few problems on divisibility - almost have the answers I'm currently tackling a few problems about divisibility and gcd, and I'm stumped by a few things. The arguments aren't that long for most of them so I'll write them in a list-type structure.
1:
Let $a$ and $n$ be positive integers with $n \neq 1$. Prove that, if $a^n -1$ is a prime number, then $a=2$ and $n$ is a prime number.
Using the factorization $x^n - y^n = (x-y) \sum_{i=1}^n x^{n-i}y^{i-1}$, we see that, choosing $x=a$ and $y=1$ that, in order for the number not to be composite, $x$ must equal $2$. But why must $n$ be a prime number for $a^n-1$ to be prime?
2:
Let $a$ and $n$ be positive integers with $a > 1$. Prove that, if $a^n+1$ is a prime number, then $a$ is even and $n$ is a power of $2$.
Suppose $a$ is odd, then $a^n$ is odd and $a^n+1$ is even and hence not a prime. But why must $n$ be a power of $2$?
Thanks! I hope you can help.
 A: Hint for the 1st one:
You're on the right track to use the identity $x^n-1 = (x-1)(x^{n-1}+\cdots+1)$. Now, suppose that $n$ is not a prime number, i.e. it can be decomposed into $n=ab$ for $a,b>1$. You can write $x^{n}=x^{ab}=(x^{a})^b$.
Hint for the 2nd one:
Notice that if $n$ is odd, we can use the identity: $x^n+y^n=(x+y)(x^{n-1}-x^{n-2}y+\cdots-xy^{n-2}+y^{n-1})$. You can prove the identity by distributing $(x+y)$ over $(x^{n-1}-x^{n-2}y+\cdots-xy^{n-2}+y^{n-1})$ and then canceling the terms.
In particular, if $x=2$ and $y=1$ then $2^n+1$ is divisible by 3. Now what if $n=2k$ where $k$ is odd? Can you apply the same identity in some way?
Remark: The numbers of the form $2^n-1$ and $2^n+1$ are important type of numbers from historical point of view. The former type is called a Mersenne prime while the later one is called Fermat prime and there are still many questions open about them.
A: Hint for 1: Think about the factorization of composite exponents $n$ in $x^n-y^n$
Hint for number $2$: Using  $1$, what happens if $n$ has an odd factor?
