The motivation for this question is from one of well known Landau Problems which asks for proof of the statement:

Are there infinitely many primes $p$ such that $p − 1$ is a perfect square? In other words: Are there infinitely many primes of the form $n^2 + 1$.

But this is not what I am asking. Before I ask my question let me explain the scenario.

A prime $p$ is called $\color{blue}{\text{Nice prime}} \ $if sum of its digits is of the form $n^2+1$ For example $37\rightarrow 3+7=3^2+1$ . The primes sum of whose digits is of the form $n^2$ (Eg $31\rightarrow 4=2^2$) or $n^2-1$ (Eg $71\rightarrow 8=3^2-1$) will be called Almost Nice primes.

The question is are there infinitely many Nice primes?

Now, I tried to find Nice and Almost Nice primes by hand till $400$ and here is what I've got:

Nice primes are:


While Almost Nice primes are:

$n^2\rightarrow 1,3,31,79,97,103,211,277,367,349$

$n^2-1\rightarrow 3,17,53,71,107,233,251$

There is a reason why I called primes whose sum of digits is of the form $n^2$ and $n^2-1$ Almost nice primes.

If you have an Almost Nice Prime of the form $n^2-1$ then adding $2\times10^k$ to it (here $k$ is the highest power of $10$ in decimal expansion of $n^2-1$) will give you a Nice prime if it is a prime (by it I mean $n^2-1+2\times10^k$). In a similar manner, if a prime $p$ is an Almost Nice prime of the form $n^2$ then if $n^2+10^k$ is a prime then it will be a Nice prime.

But introducing Almost Nice prime is not much helpful as we have to make sure that $\text{Almost Nice prime (of the form $n^2$)}+10^k$ $\text{or Almost Nice prime (of the form $n^2-1$)+$2\times10^k$}$ is a prime before concluding that it met our Nice prime criteria.

Since the post is long, I again remind you the question. Are there infinitely many Nice primes?


  • 1
    $\begingroup$ What do you obtain with the prime number theorem for the expected number of primes $p \le x$ whose sum of digits is $N$ ? $\endgroup$ – reuns Sep 28 '17 at 18:12
  • 1
    $\begingroup$ Since $n^2+1$ is never divisible by $3$, it is even likely that for every number of the form $n^2+1$ with $n\ge 1$, there exists a prime $p$ with digit-sum $n^2+1$ because the number of numbers with the given digit sum, already for $n=8$ (there is a prime for $n=1,2,\cdots,7$) is so large that we can expect to find several primes. But to prove that (or even the weaker) statement will probably be very difficult, if not impossible. $\endgroup$ – Peter Sep 28 '17 at 18:35
  • 2
    $\begingroup$ Your list of Nice primes to 400 is not correct. You missed 2, and 373 is not a Nice prime. I recommend writing code to generate such things. Here is a list to 1000: 2,5,11,19,23,37,41,73,89,101,109,113,127,131,163,179,181,197,269,271,307,311,359,401,433,449,467,523,541,557,593,613,631,647,683,719,773,809,811,827,863,881,953,971. This sequence is not in the OEIS. $\endgroup$ – Matthew Conroy Sep 28 '17 at 18:35
  • 1
    $\begingroup$ It there are infinite many primes of the form $2\cdot 10^n+3$ or $4\cdot 10^n+1$ , then the statement is already true. $\endgroup$ – Peter Sep 28 '17 at 18:43
  • 1
    $\begingroup$ Thanks @MatthewConroy $\endgroup$ – Vidyanshu Mishra Sep 28 '17 at 18:46

Even the set of positive integers with digit sum $101$, only having the digits $0$ and $1$ and ending with a $1$, contains $$\binom{n-2}{99}$$ $n$-digit numbers.

This means, that we have , for example, about $\large \color\red {10^{438}}$ numbers with a million digits in the set. Plenty of them should be primes, since they share no common factor.

If $n$ increases, the binomial coefficient grows much faster than $n$ itself. So there is an overwhelming statistical evidence that infinite many nice primes exist.

Of course, such an evidence is no proof.

  • $\begingroup$ you made any progress?? Although incomplete but still it seems that your reasoning is the way to reach the conclusion. If not, should I place a bounty on the question (I am personally baffled in this matter so asking you)? $\endgroup$ – Vidyanshu Mishra Sep 29 '17 at 14:30
  • $\begingroup$ @VidyanshuMishra Placing a bounty is not a bad idea. Perhaps, someone knows a rigorous proof. $\endgroup$ – Peter Sep 29 '17 at 16:39
  • $\begingroup$ Ha ha, perhaps someone knows a rigorous proof and waiting for bounty...... $\endgroup$ – Vidyanshu Mishra Sep 29 '17 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.