This open-ended question was originally posted on Twitter here. Specifically,
Problem
Given $a,m \in \mathbb{N}$ with $a, m \gt 1$, find the minimal value $n \in \mathbb{N}$ such that $(a-1)^m \mid a^n - 1$.
Work So Far
Existence
Consider $\frac{a^n - 1}{(a-1)^m}$ and let $b = a - 1$. This gives us $\frac{(b + 1)^n - 1}{b^m} = ... = \sum_{i=1}^{n} {n \choose i} b^{i-m}$
Note that ${n \choose i} b^{i-m} \in\mathbb{N}$ for $i-m\geq0$, so it suffices to look at the range $i \in \{1,2,..,m-1\}$.
Recalling ${n \choose i} = \frac{n(n-1)\cdots(n-i+1)}{i!}$ we can bring the salient terms into the form
$\frac{n((m-1)! + (m-2)!b(n-1) + \cdots b^{m-2}(n-1)\cdots(n-m+2))}{(m-1)!\ b^{m-1}}$
by creating a common denominator and factoring. From this, we are able to deduce that $n=(m-1)!(a-1)^{m-1}$ is a satisfactory value.
Question
Minimality
The value above is not minimal from some simple checks with small values of $a,m$, but I am unable to make much headway into finding an analytical solution.The graph of $a=3$ below lends me to believe it may not be as complicated as I think however.
Graph of minimal n vs m for a = 3
The numbers get unwieldy quickly, so I'm not able to do much further numerical work unfortunately. Any ideas?