I am trying to bound the number of squares appearing only in the open intervals $(k^n-k, k^n)$. Here $n$ is fixed and $k\lt T$ for some $T$. For example, with $n=3,T=4$, the intervals are $(0,1),(6,8),(24,27)$, and among these endpoint-excluded intervals only the square $25$ appears.
How shall I approach this problem?