Problems & Puzzles: Puzzles

Puzzle 694 S(p,q)=p&q

Here we ask to find pair of primes p&q such that the sum of the integers in between p and q (including p and q) is equal to p&q (q appended to the right of p).


2+3+4+5+6+7 = 27


As far as I know these are the only two pairs known.

Q1. Find more pairs of these primes.

BTW, it may be demonstrated that: 1(3)n+...+5(3)n = 1(3)n5(3)n, for n=>1

Q2. Find a n>1 value such that both 1(3)n and 5(3)n are primes; or show that no both can be primes at the same time for n>1.


Contributions came from Carlos Rivera, Claudio Meller & Emmanuel Vantieghem


Rivera wrote

I tried to find prime solutions to the complementary equation S(p,q)=q&p. I failed to find one single solution, but I found two infinite non-prime family solutions;

a) p=5(3)n2, q=21(3)n2, S(p,q)=21(3)n25(3)n2

b) p=6(2)n, q=21(7)n, S(p,q)=21(7)n6(2)n

Meller wrote:

S(p,q) = (q^2 + q - p^2 + p) / 2
and pq = 10^n p + q (where n = number of digits of q )

So (q^2 + q - p^2 + p) / 2 = 10^n p + q
Then q^2 - q = (2*10^n - 1) p + p^2

Seeking positive solutions in Wolfram I didnīt found cases where x and y are prime except those you mention (I do not give solutions for n> 6 because it takes much time)

The numbers of form 1333 .... and 5333 ... (with the same length( are always solutions, I seek this numbers (until 246 digits) but I couldnīt find two primes

A curiosity : S(13,1613) = 13 +14 + ... +11612 +1613 = 1301613

Emmanuel wrote:

Q1.  I found no more pairs of such primes.

Q2.  If  1(3)n  and  5(3)n  are prime, then  n  must be odd and bigger than  22002

(this took a lot of time ...)

However, it is not difficult to prove that, to solve  Q1, it suffices to solve Q2.

Indeed, if  A  and  B  are primes such that  S(A,B) = A&B, then :

   either   A = 2  and  B = 7
   or      A = 1(3)m  and  B = 5(3)m  for some natural number  m.
Here is an outline of the proof (I ommitted many details) :
We have : S(A,B) = (A+B)(B-A+1)/2  and  A&B = B+A*10^k,
where  k  is the number of digits of  B.
Thus, S(A,B) = A&B  implies (after some manipulations) :
   B(B - 1) = A(A+D), where  D = 2*10^k - 1.
If  A  and  B  are both prime, then :
   B - 1 = n*A    (1)
   A+D = n*B     (2)
for some natural number  n > 1.
Looking closely at the number of digits of  A, B  and  n,
it is not difficult to obtain from  (1)  and  (2)  that  
n  has at most two digits and
that  A  has at least  k - 2  digits. 
Eliminating  B  from the equations  (1)  and  (2)  gives :
   (n^2 - 1)A = 2*10^k - (n+1). 
This immediately implies that  n+1  should divide  2*10^k,
which reduces the possible values for  n  to 
It is then not hard to prove that the only values of  n  for which the quotient 
     (2*10^n - n - 1)/(n^2 - 1)
is an integer are :
1)  n = 3  when  k = 1, A = 2  and
2)  n = 4, k>=2, A= 1(3)(k-1)  (and hence, B = 5(3)(k-1)),

For the non-prime solutions:

I found lots of solutions of the equation  S(A,B) = A&B.  Among them are the infinite families A = 35(63)n, B =91(63)n  and  A = 1(7)n8, B = 6(2)n3


Abhiram R Devesh wrote on June 30 2013:

I could not find any solutions other than the ones published, but i was trying to find if the term p&q can occur in the summation value along with prefixed and/or suffixed digits
p        q                 S(p,q)
3   1123             631123
7 62869   1976286994 
These are results for p and  q < 10^5

Later he added:

I found some interesting solutions to the (with slight change in puzzle defn,) puzzle 694. 
definition: Sum of numbers between p and q equal to reverse of q&p (q appended to the right of p and flipped).
Solution batch 1: Exact equality
449      79       97944 
223   4349   9434322 
1861 5741 14751681 
Solution batch 2: Reverse(p&q) part of the sum
3 3719 6917337


Records   |  Conjectures  |  Problems  |  Puzzles