I couldn't find this exact question. I know that there are an infinite number of prime numbers and positive squares. I also found that there are more prime numbers than perfect squares, but does the ratio of primes to perfect positive squares approach infinity or some other value?
The ratio of prime numbers to perfect squares
prime numberssquare-numbers
Related Solutions
In 1923, Hardy and Littlewood [Some problems of “partitio numerorum”, III, Acta Math., 44 (1923), pp. 1-70] conjectured that all sufficiently large integers $n$ can be written in the form $n=p+a^2+b^2$ where $p$ is a prime, and $a,b$ are integers. In 1959–1960, Linnik [Hardy–Littlewood problem on the representation as the sum of a prime and two squares, Dokl. Akad. Nauk SSSR, 124 (1959), pp. 29-30 and An asymptotic formula in an additive problem of Hardy and Littlewood, Dokl. Akad. Nauk SSSR, 24 (1960), pp. 629-706] confirmed this conjecture.
See also Hooley, On the representation of a number as the sum of two squares and a prime.
$$1 + p + p^2 + \dots + p^n = {{p^{n+1} - 1}\over{p-1}} = x^2,\quad x \in \mathbb{N}$$ You get an equation of the form $p(x^2 - p^n) = x^2 - 1$ (after fiddling with the terms in the equations). This means that for every $p$ must be such that it is less than $x^2 - 1$ as the above equation implies $p \mid x^2 - 1$ y FTA [Fundamental theorem of arithmetic, if you didn't understand the abbreviation] (Just as you have said in your question).
Also note that the other factor is $x^2 - p^n$, which means we must check for the least power of the prime less than $x^2$ and put a constraint on the power of $p^n$ in our equation.
Now checking the values of $x^2 - 1$ for every $x \in \mathbb{N}$:
$1^2 - 1 = 0$, but we can't take it as $\nexists p : p \in \mathbb{P}, p <0$
$2^2 - 1 = 3$, and $2$ & $3$ are the only primes $\leq 3$, and $n = 1$ & $p = 3$ is an apt solution as you stated in the question.
$3^2 - 1 = 8$, the greatest prime factor of $8$ is $2$, but putting $p = 2$, you get the equation as $2(9 - 2^n) = 8$, which is impossible as $9 - 2^n$ is odd.
$4^2 - 1 = 15$, the only prime factors of $15$ are $3$ and $5$, so substituting each in the equation, you'll get $3(16 - 3^n) = 15$ and $5(16 - 5^n) = 15$, but in both cases, an $n$ is impossible as $16 - 3 = 13$ and $16 - 5 = 11$ aren't powers of $5$ and $3$ respectively.
$5^2 -1 = 24$, and the prime factors of $24$ include $2$ and $3$ only, so if you check, you'll get :
- $2(25 - 2^n) = 24 \implies 25 = 2^n + 12$ (which is impossible as $2 \mid 2^n + 12$ but $2 \nmid 25$
- $3(25 - 3^n) = 24 \implies 25 = 3^n + 8 \implies 3^n = 17$, but this is impossible as $17$ is not a power of $3$
$6^2 - 1 = 35 ,\implies$
- $5(36 - 5^n) = 35 \implies 36 = 5^n + 7$, but again that is impossible as $29$ is not a power of $5$.
- $7(36 - 7^n) = 35 \implies 36 = 7^n + 5$, which is again impossible as $31$ is not a power of $7$.
It's obvious through observation that if $\log_{p_1}{{x^2 - p_2}\over{p_1}} \notin \mathbb{N}, x^2 - 1 = {p_1}^{a}.{p_2}^{b}$, you can't have a solution.
These may be the same results as you must have obtained, and it's clear that the test is easier for those predecessors of squares that have only two prime factors (irrespective of power). Things will surely get harder as per @SatvikAcharya's comment beneath your question, for higher number of prime factors.
Thus the best hint I can give is: if you can find those predecessors of squares of the form $x = p_1p_2 : p_1, p_2 \in \mathbb{P}$, check if $\log_{p_1}{{x + 1 - p_2}\over{p_1}} \in \mathbb{N}$ or $\log_{p_2}{{x + 1 - p_1}\over{p_2}}\in \mathbb{N}$
Also, please check @EricSnyder's comment beneath this answer. You can see that in the case of three prime factors too one can find a solution. As I can see from it, $x^2 - 1$ is of the form $\prod\limits_{i=1}^{k} {p_1}^{m_i}$, so what you have to do is check if $\log_{p_j}\big{(}{{x^2 - {{x^2 - 1}\over{{p_j}^{m_j}}}}\over{p_j}}\big{)}, j \leq k \in \mathbb{N}$.
Best Answer
The number of squares in $[1, x]$ is asymptotically $\sqrt{x}$, whereas the number of primes in $[1,x]$ is asymptotically $x/\ln x$ by the prime number theorem, so you could say that in ratio there are more primes than squares, as $(\sqrt x)/(x/\ln x) \to 0$.
This makes sense if you think that probabilistically, the chance that a large given $N$ is prime (resp. square) is approximately $1/\ln N$ (resp. $1/\sqrt N$), and $1/\ln N > 1/\sqrt N$ for large $N$. That is, it is "more likely" for a large $N$ to be prime than square.
Edit: to more directly answer your original question, the above observations imply that the ratio of primes to squares in $[1,x]$ is asymptotically $\sqrt x/\ln x$, which goes to infinity. One can interpret this as "for sufficiently large $x$, there are more than $k$ times as many primes in $[1,x]$ as squares", and it will be true for any fixed $k$.