Does digit $6$ always lead to $\ 25921=161^2\ $?

A comment on strategy too long for the comment section, but not a complete answer:

You want to find $6!\prod a_i! +1=x^2$ where $a_i$ are single digits. Note that the single digits are $0,1,2,3,2^2,5,2\cdot 3,7,2^3,3^2$, so the factorials will all either be $1$ or will have only the prime factors $2,3,5,7$.

Rearranging, $6!\prod a_i!=x^2-1=(x-1)(x+1)$. LHS is even, so $(x-1)\ \text{and}\ (x+1)$ are both even. Successive even numbers have only a single factor of $2$ in common.

$2^2\cdot3^2\cdot5\cdot\prod a_i!=\frac{(x-1)}{2}\frac{(x+1)}{2}$. RHS are two consecutive numbers; hence their gcd is $1$. So the first problem is to find consecutive numbers which only have prime factors of $2,3,5,7$, and none in common.

$161$ leads to a solution because $\frac{161-1}{2}=80=2^4\cdot 5;\ \frac{161+1}{2}=81=3^4$.

$17$ leads to a solution (although not for the $6$ question) because $\frac{17-1}{2}=8=2^3;\ \frac{17+1}{2}=9=3^2$.

Finding candidate consecutive numbers will not necessarily lead to a solution, as the numbers of various prime factors will have to be distributable among the $a_i!$, which might prove difficult if (for example) the number of factors of $2$ is less than the number of factors of $3$ in the consecutive numbers. If consecutive numbers can be found that satisfy that requirement, then identifying suitable $a_i$ will be possible, and as OP points out, it should then be possible to generate a prime starting number by strategic insertion of digits $0,1$.


The answer is: $25921=161^2$ is the only possible square.

This solution is based on Keith's partial solution on the requirements of the solution if one exists, and Strømer's Theorem, which is a theorem on the finitude of smooth pairs.

Keith pointed out that the necessary condition for a solution $x^2$ fulfilling the conditions of the question is that both $\frac{x-1}{2}$ and $\frac{x+1}{2}$ are 7-smooth. Another condition will be that, if both $\frac{x-1}{2}$ and $\frac{x+1}{2}$ are not divisible by 7, then $180\mid\frac{(x-1)(x+1)}{4}$, or otherwise $907200\mid\frac{(x-1)(x+1)}{4}$.

Strømer's Theorem states that there are only finitely many pairs of consecutive smooth numbers up to any specific degree of smooth. An algorithm invented by Strømer, later simplified by Lehmer, can be used to find all pairs of consecutive smooth numbers. As a result, we can inspect all 7-smooth pairs in reasonable time for such a solution.

The algorithm states that we need only $2^{\pi(k)}-1$ Pell equations to find all $k$-smooth pairs. Let $P$ be the set of prime numbers which are at most $k$, then the equations we need to solve are the following:

$$x^2-2(\prod_{q\in Q} q)y^2=1\text{ for every }Q\in (\mathcal{P}(P)\setminus\{2\})$$

We only need to inspect the first $\max(3, \frac{k+1}{2})$ solutions per equation, and each solution $(x,y)$ for the Pell equation gives a pair $(\frac{x-1}{2},\frac{x+1}{2})$ which may or may not be both $k$-smooth. For a Pell equation with the form $x^2-ay^2=1$, by analyzing the continued fraction of $\sqrt{a}$ the solutions are easy to find.

In this case, we need to find all 7-smooth pairs, so we need to solve $2^{\pi(k)}-1=15$ equations, and for each equation we need $\max(3, \frac{7+1}{2})=4$ pairs of solutions. The calculations are organized into the table below:

enter image description here
Table 1 All 15 Pell equations needed to generate all 23 7-smooth pairs (shown in green background). Click to enlarge.

From Table 1, there are only 23 pairs of consecutive 7-smooth numbers. They are organized into the table below:

enter image description here
Table 2 All 23 7-smooth pairs, where $a=\frac{x-1}{2}$ and $b=\frac{x+1}{2}$. Click to enlarge.

From Table 2, only 3 7-smooth pairs have a product divisible by 180, in which 2 are divisible by 7. Since neither of those is divisible by 907200, there is only one possible solution, which is indeed the $25921=161^2$ case, fulfilling $2^2\cdot 3^2\cdot 5\prod a_i!=\frac{(x-1)(x+1)}{4}$ as required in Keith's partial answer. As a result, your $6$ always leads to $25921=161^2$.

Footnote: I ran the exhaustion search up to $x=10^{425}$ using Keith's method before I found how to reach the conclusion of having no other solutions.