Inspired by Is the number $333{,}333{,}333{,}333{,}333{,}333{,}333{,}333{,}334$ a perfect square?, I wonder when numbers like these are perfect squares. Certainly, all numbers of the form $000...0001$ are equal to the (non-prime) square $1$, and numbers of the form $999...9990$ are never primes (although sometimes they're $90$ times a repunit prime) and never squares (unless $0$ counts) because $90$ is divisible by $2$ and not $4$.
Therefore, the question I have boils down to:
For which integers $d\in[1,8]$ and $n\ge1$ is $1+d*\sum_{j=0}^n10^j=1+d*\left(10^{n+1}-1\right)/9$ a perfect square? a prime?
Here are some initial calculations and observations for each value of $d$:
- Never prime and never a square because $12$ and $112$ are not squares and numbers ending in $1112$ are divisible by $8$ but not $16$. However, $1112$, $1111112$, and $1111111111111112$ are all $8$ times a prime.
- $23$, $223$, $22222223$, $22222222223$, $222222222222222222222222222222222223$ are all prime.
- Never prime and never a square because $34$ is divisible by $2$ and not $4$. However, $34$, $334$, $3334$, $333334$, $3333333334$, $333333333334$, $333333333333334$, and $333333333333333333333333333333334$ are all twice a prime.
- Never prime and never a square because $45$ is divisible by $5$ and not $25$. Each one of these is $5$ times a $d=8$ number.
- Never prime because $56$ is divisible by $4$. However, $56$, $556$, $555556$, and $555555555555556$ are all four times a prime.
- $67$, $666667$, $66666667$, $666666667$, $66666666667$, $66666666666666666667$, and $66666666666666666666667$ are all prime.
- Never prime and never a square because $78$ is divisible by $2$ and not $4$. However, $78$, $778$, $7777778$, $777777777777777778$, and $777777777777777777778$ are all twice a prime.
- $89$, $88888888888889$, $88888888888888889$, and $88888888888888888888888888888888889$ are all prime.
I don't know how to even approach "are there infinitely many primes for some $d$?" (and that may be hard since it's not known if there are infinitely many repunit primes) or proving that there are no squares (but I have more hope that that's solvable).
This is a partial answer.
This answer proves that there are no such squares.
Proof :
Suppose that there are positive integers $d,n,k$ such that $d\leqslant 8$ and $$1+d\cdot\frac{10^{n+1}-1}{9}=k^2$$ i.e. $$9+d\cdot 10^{n+1}-d=9k^2$$ from which we have $$1-d\equiv k^2\pmod 4$$
You already know that $d$ cannot be $1,3,4,7$.
$d$ cannot be $2,6$ because supposing that $d=2,6$ gives $k^2\equiv 3\pmod 4$ which is impossible.
For $d=5$, we have $2^{n+1}\cdot 5^{n+2}=(3k-2)(3k+2)$, so there have to be non-negative integers $p,q,r,s$ such that $q+s\geqslant 3,3k-2=2^p5^q$ and $3k+2=2^r5^s$ from which $4=2^r5^s-2^p5^q$ follows.
For $d=8$, we have $2^{n+4}\cdot 5^{n+1}=(3k-1)(3k+1)$, so there have to be non-negative integers $p,q,r,s$ such that $q+s\geqslant 2,3k-1=2^p5^q$ and $3k+1=2^r5^s$ from which $4=2^{r+1}5^s-2^{p+1}5^q$ follows.
So, in order to prove that $d$ cannot be $5,8$, it is sufficient to prove that there are no non-negative integers $p,q,r,s$ such that $q+s\geqslant 2$ and $4=2^r5^s-2^p5^q$.
If $q\geqslant 1$ and $s\geqslant 1$, then RHS is divisible by $5$ while LHS isn't. So, we have either $q=0$ or $s=0$.
(Case 1) For $q=0$, we have $4=2^r5^s-2^p$. If $p=0$, then $5=2^r5^s$ implies $(p,q,r,s)=(0,0,0,1)$ which does not satisfy $q+s\geqslant 2$. If $p=1$, $6=2^r5^s$ is impossible. So, $p\geqslant 2$ and then since $r\geqslant 2$, we have $1=2^{r-2}5^s-2^{p-2}$. If $r-2\geqslant 1$ and $p-2\geqslant 1$, then RHS is divisible by $2$ while LHS isn't. So, we have either $r-2=0$ or $p-2=0$. If $p-2=0$, then $2=2^{r-2}5^s$ so $(p,q,r,s)=(2,0,3,0)$ which does not satisfy $q+s\geqslant 2$. If $r-2=0$, then $1=5^s-2^{p-2}$. Since $1\equiv (-1)^s-(-1)^{p-2}\pmod 3$, $s$ has to be odd. So, letting $s=2t+1$, we have $2^{p-2}=5\cdot 25^t-1$. If $p-2\geqslant 3$, then LHS is divisible by $8$ while RHS isn't. So, we have $p-2\lt 3$, and so $(p,q,r,s)=(4,0,2,1)$ which does not satisfy $q+s\geqslant 2$.
(Case 2) For $s=0$, we have $4=2^r-2^p5^q$. If $r=0$, then $3=-2^p5^q$ is impossible. If $r=1$, then $2=-2^p5^q$ is impossible. So, $r\geqslant 2$, and then since $p\geqslant 2$, we have $1=2^{r-2}-2^{p-2}5^q$. If $r-2\geqslant 1$ and $p-2\geqslant 1$, then RHS is divisible by $2$ while LHS isn't. So, we have either $r-2=0$ or $p-2=0$. If $r-2=0$, then $0=-2^{p-2}5^q$ is impossible. So, $p-2=0$ gives $1+5^q=2^{r-2}$. If $r-2\geqslant 2$, then RHS is divisible by $4$ while LHS isn't. So, we have $r-2\lt 2$, and so $(p,q,r,s)=(2,0,3,0)$ which does not satisfy $q+s\geqslant 2$.
In conclusion, there are no such squares.$\quad\blacksquare$