# Finding joker numbers

Let $$n$$ be an integer, $$q(n)$$ be the smallest prime number which divides $$n$$ and $$r(n)$$ be the biggest prime number less than or equal to $$\sqrt{n}$$. We say that $$n$$ is joker if $$q(n)=r(n)$$.

Except $$8$$, joker numbers are of the form $$p_n\cdot p_{n+k}$$, with $$k\geq 0$$. The converse is obviously false. If $$(p_n)$$ is the prime numbers sequence, it is easy to prove that a number of the form $$p_n\cdot p_{n+k}$$ is joker if and only if $$p_{n+1}^2 > p_n\cdot p_{n+k}$$. In particular, if a number is not joker for $$k$$, it is not joker for $$k+1$$ (with the same $$n$$). So, all the numbers of the form $$p_n^2$$ and $$p_n\cdot p_{n+1}$$ are jokers. Using a spreadsheet, we can see that for $$n\leq 1000$$, the percentage of numbers of the form $$p_n\cdot p_{n+k}$$ which are jokers, with $$k=2, 3, 4, 5, 6$$ and $$7$$ is respectively $$52 \%, 19.2 \%, 7.8 \%, 2 \%, 0.5 \%$$ and $$0.1 \%$$.

Question : for any $$k$$, does there exist $$n$$ such that the number $$p_n\cdot p_{n+k}$$ is joker ?

• Please put dollar signs around your maths, and use curly brackets for stuff in subscripts. Look up how to use Mathjax. – Benjamin Wang Jan 13 at 20:30
• Unless there is something going on that I don't understand, it seems to me that $n=2p_m$ is always a joker number. $2$ is the smallest prime that divides $n$, and $p_m^2>2p_m \Rightarrow p_m> \sqrt{2p_m}$ so the largest prime $\le \sqrt{n}$ is also $2$. Since $m$ can be made as large as pleased, and the index of the prime $2$ is $1$, there should be a solution for every $k$ – Keith Backman Jan 13 at 21:23
• @KeithBackman $r(n)$ is the largest prime number less than or equal to $\sqrt{n}$. It does not have to be a factor of $n$. For example, $r(10)=3>2=q(10)$, so $10$ is not joker. – Kevin Long Jan 13 at 21:30

With PARI/GP, I could find examples upto $$k=22$$ , listed in the following output :

gp > for(s=2,25,z=primes(s);[a,b,c]=[z,nextprime(z+1),z[s]];q=1;while(b^2<=a*c,q=q+1;a=b;b=nextprime(b+1);c=nextprime(c+1));print(s-1,"   ",q))
1   1
2   2
3   4
4   30
5   180
6   462
7   890
8   1532
9   3385
10   19871
11   29040
12   31545
13   31545
14   31545
15   597311
16   1293698
17   1293698
18   1293698
19   2279181
20   2279181
21   118374763
22   118374763


If the gap to the next prime is denoted with $$a$$ and the difference $$p_{n+k}-p_n$$ is denoted with $$b$$ , then $$2a>b$$ is sufficient for an example.

Considering that the merit of a prime gap defined as $$\frac{p_{n+1}-p_n}{\ln(p_n)}$$ can be arbitarily large, such a solution should exist for arbitarily large $$k$$ , but this is of course no proof.

Note that a solution immediately implies that there is a solution for all smaller $$k$$ as well. So, chances are very good that the answer to your question is "yes".

• Thanks a lot, Peter. I'm convinced that the answer is "yes" and I'm looking for proof. Your idea, may be, will help me. – Denis Jan 14 at 17:35
• It looks like other people have looked into this on OEIS (see A230777 and A228098), but don't have as much data as you, so it would help if you update OEIS with your findings. – Kevin Long Jan 14 at 18:08
• Thanks, Kevin ! I didn't know thos sequence on OEIS. So, there is no value > 14 in the 100000 first terms of A228098, and only one equals to 14: A228098(31545), which corresponds to prime(31545) = 370261. We coulld propose a conjecture like "If n is big, largesz – Denis Jan 14 at 21:06
• "If n is big, largest k is equivalent to ln(n) + ln(ln(n))... :) – Denis Jan 14 at 21:07

NOT AN ANSWER. An extended discussion to restate the question being asked, which won't fit as a comment

OP uses $$n$$ both as the name for joker numbers and as the primary index of primes. For clarity, I will avoid using $$n$$ as the primary index of primes.

A number $$n$$ with $$3$$ or more prime factors can have at most one prime factor larger than $$\sqrt{n}$$; if it had more than one such prime factor, their product alone would be greater than $$n$$. Thus if $$n$$ has $$3$$ or more prime factors, at least two of them must be smaller than $$\sqrt{n}$$. The only way that such a number might be a joker number is if the two prime factors $$p_a$$ smaller than $$\sqrt{n}$$ are equal: $$n=(p_a)^2\cdot c$$. Then $$\sqrt{n}=p_a\sqrt{c}$$ where $$c$$ has prime factors $$\ge p_a$$.

Specific cases: $$p_a=c=2$$ affords the noted exception $$n=8$$. $$p_a=2,\ c=3 \Rightarrow n=12$$, and $$12$$ is not a joker number by examination. $$p_a\ge 3 \Rightarrow n\ge 27$$, and since $$27>25=p_{a+1}^2$$, this affords no joker numbers. $$c\ge 4 \Rightarrow p_a\sqrt{c}\ge 2p_a$$ and by Bertrand's postulate, $$p_a$$ is not the smallest prime $$\le \sqrt{n}$$. Since $$n$$ has at least $$2$$, and (excepting $$8$$) cannot have $$3$$ or more prime factors, $$n$$ is a semiprime.

For any particular $$p_a$$, the joker numbers containing it as a prime factor lie within the interval $$(p_a)^2$$ to $$(p_{a+1})^2$$. OP's question can be stated: Let $$k$$ be the count of numbers in that interval that are products $$p_ap_b$$ such that $$p_a; does there always exist $$p_a$$ such that $$k$$ can be arbitrarily large?

Let $$p_{a+1}=p_a+g_a$$, where $$g_a$$ is the gap between $$p_a$$ and $$p_{a+1}$$. Then acceptable $$p_b$$ to be counted are defined as $$p_a. For sufficiently large $$p_a$$ we can consider $$\frac{g_a^2}{p_a}$$ to be an error term. We also know that there is only one prime to be counted within the interval from $$p_a$$ to $$p_{a+1}$$. So the question becomes: In the interval from $$p_{a+1}$$ to $$p_{a+1}+g_a$$, can there be arbitrarily many prime numbers?

At this time, I don't have an answer to that question.

• As we can observe it, after a large interval we have not necessary only small intervals. But if we have it once a least, it could be sufficient. – Denis Jan 14 at 21:11
• @Denis I agree. Qualitatively, my discussion indicates that large values of $k$ arise when a large gap between primes is followed by relatively dense clusters of primes. But I can't find a quantitative expression that precisely describes that relationship. – Keith Backman Jan 15 at 3:54
• thanks a lot and totally agree with you. It seems we don't know enough about prime numbers distribution – Denis Jan 15 at 17:10
• I also tried reasoning by the absurd but without result... – Denis Jan 15 at 17:11