Problems & Puzzles: Puzzles

Puzzle 810. Primes and Sum of consecutive triangulars

Vicente Felipe Izquierdo sent the following nice puzzle:

It seems that only the sum of 3 or 6 consecutive triangular numbers may produce prime numbers.

The smallest examples for each type are:

19 = 3+6+10
83=
3+6+10+15+21+28

Q1. Can you prove the above statement?

Q2. Is it possible that the same prime number may be obtained by 3 and 6 consecutive triangular numbers?

 


Contributions came from Emmanuel Vantieghem, Jan van Delden, Jean Brette, T. D. Noe

***

Emmanuel Vantieghem wrote:

Q1.
Let  t(n) = n(n+1)/2 be the  nth  triangular number.
It is well known that  S(n) = t(1)+t(2)+...+t(n) = n(n+1)(n+2)/6  (this can be found almost 'everywhere', for instance in Wikipedia).
Thus  t(n)+t(n+1)+...+t(n+k-1) = S(n+k-1) - S(n-1)
=  k (3 n^2 + 3 k n + k^2 - 1)/6.
We can see immediately that this sum cannot be prime when  k > 6.
For k = 1, the sum is obviously non prime except when  n = 2.
For k = 2, the sum is  (n+1)^2, surely non prime.
For k = 4, the sum is  2(n^2+4n+5), allways even
For k = 5, the sum is  5(n^2+3n+8), allways divisible by 5.
So, only k =3 or k = 6 can give a prime.

 
Q2.
The answer is : NO.
The sum of three triangular numbers equals  (3n^2+9n+8)/2.
The sum of six triangular numbers equals  3m^2+18m+35.
Equality of these numbers leads us to the equation :
3n^2+9n+8=6m^2+36m+70 
which is even impossible modulo 3.

 
NB. The  n  that make the sum of three trianglulars prime are
2, 3, 7, 10, 15, 18, 19, 22, 30, 35, 38, 43, 47, 54, 55, 67, 70, 75, 79, 82, 83, 94, 98, 102, 103, 107, 114, 115, ...
(the corresponding primes are found in  https://oeis.org/A125602)
The  n  that make the sum of  6  triagulars prime are
1, 3, 6, 9, 13, 16, 19, 24, 26, 29, 51, 64, 66, 68, 69, 71, 76, 79, 96, 101, 103, 108, 111, 113, 124, ...
(the corresponding primes are found in  https://oeis.org/A159071)

***

Jan van Delden wrote:

Q1:
 
Given:   T(n)=n*(n+1)/2 The n’th triangular number.
Than:    S(n)=sum(T(i),i=1..n-1)=(n^3-n)/6
 
Define:    H(u,v)=S(v)-S(u)=1/6*(v-u)*((v-u)^2-1+3uv)
 
[Note, we have H(u,v)=sum(T(i),i=u..v-1)].
 
We know that H(u,v) is integer (by construction).
We are interested in the case v>u. [H(u,u)=0 and H(v,u)=-H(u,v)].
 
If v-u=+/-1 mod 6 we have H(u,u+6k+/-1)=(6k+/-1)*(36k^2+/-12k+3uv)/6 = (6k+/-1)*(k*(6k+/-2)+uv/2)
If k=0 this simplifies to uv/2=u*(u+1)/2. Since we want the result to be prime we must have u=2.
If k>0 we have at least 2 divisors.
 
If v-u=+/-2 mod 6 we have H(u,u+6k+/-2)=(3k+/-1)*(12k^2+/-8k+uv+1)
If k=0 this simplifies to uv+1 = u^2+2u+1=(u+1)^2 which can not be prime.
If k>0 we have at least 2 divisors.
 
If v-u=3 mod 6 we have H(u,u+3k)=k*(9k^2-1+3uv)/2
If k=1 this simplifies to 4+(3uv)/2=4+3u(u+3)/2 which can generate prime solutions.
If k>1 we have at least 2 divisors.
 
If v-u=0 mod 6 we have H(u,u+6k)= k*(36k^2-1+3uv)
If k=1 this simplifies to 35+3uv which can generate prime solutions.
If k>1 we have at least 2 divisors.
 
Prime solutions if v-u=3 or 6. [And the solution H(2,3)=T(2)=3].
 
Q2:
 
H(a,a+6)=H(b,b+3) and solving for a gives  a = –3+/-sqrt(D)/6 with D=18b^2+54b-48.
We have D=6(3b^2+9b-8). If we want an integer solution we should have 6|3b^2+9b-8.
However 3b^2+9b-8 mod 6 = 3b(b+1)+4 mod 6=4 mod 6. So there are no integer solutions.
 
There are no solutions (and therefore also no prime solutions).

***

Jean Brette wrote:

Tn  is the nth triangular number : Tn = 1+2+…+ n =  n (n+1) / 2

To avoid the factor 1/2,   let be     S (k, n) = 2 ( Tn+ T n+1 + … +T n+k-1 )


 

Question Q1 can be reformulate :

  Prove that :   If  k ≠ 3 or 6, S (k,n) cannot be equal to twice a prime number P.

Answer : 

Of course, S (k,n) is even, so we must prove that if  k ≠ 3 or 6,  S (k, n) has a divisor ≥ 4.
 

It is easy to show that    S(k, n) =  k. n^2 +  k^2 . n +  k ( k^2 - 1) / 3
 

1) If  k = 3.m, with   m > 2, then

S (3m, n) = 3m. n^2 + 9. m^2. n + m (9 m^2 –1) is a multiple of  m

 

2) If  k is not a multiple of 3, then  (k^2 - 1)  is  multiple  of 3 :   (k^2-1)= 3. K,

and S become : S(k, n) =  k. n^2 +  k^2 . n +  k K.   which is a multiple of  k.

Note : When k = 2, S(2, n) = 2.n^2 + 4n +2 = 2. (n+1)^2 is a multiple of (n+1)

 

3) k = 3

S(3, n) = 3. n^2 + 9.n + 8.

The first values I have found for n such  that  S(3,n) = 2P  are :

n = 2, 3, 7, 10, 15, 18, 19, 22, 30, 35, 38, 43, 47,    which give the primes :

P = 19, 31, 109, 199, .....

 

4) k = 6

S (6, n) =  6. n^2 + 36. n + 70 

If n is an odd number, S is a multiple of 4. So, to have S = 2.P, the number   n  must be even.

The first values I have found for  n  such  that  S(6,n) = 2P  are :

n = 2, 6, 12, 16, 26, 38, 46, 58, 68, 72, 76, 82, 88, 96,  which give the primes :

P = 83, 251, 683, 1091, ... 
 

Question Q2 : 

No integer (prime or not)  may be obtained as a sum of  3  and  6 consecutive triangular numbers.

 
It suffices to look the two sums modulo 3
 
1) The sum (prime or not) of 6 consecutive triangular numbers is equal  to  2  (modulo 3).
This sum is :  S (6, n) / 2 =  (6. n^2 + 36. n + 70) / 2 =   3. n^2 + 18. n + 35   ==  35 (mod 3) == 2 (mod 3)
 
2) The sum (prime or not) of 3 consecutive triangular numbers is equal  to  1  (modulo 3).
 
This sum is :  S(3, n) / 2 = (3. n^2 + 9.n + 8 ) / 2  
 
One can rewrite :  3. n^2 + 9.n + 8 = (3. n^2 + 3. n) + 6.n + 8 = 3 n(n+1) + 6. n + 8.
 
n(n+1) is always even. Say n (n+1) = 2. j.
 
So  S(3, n) / 2 = 3. j + 3. n + 4  which is equal to  1  modulo   3.

***

T. D. Noe wrote:

Q1:

The triangular numbers 0, 1, 3, 6, 10,..., numbers of the form n(n+1)/2 for
n >= 0 are composite except for the number 3, which is the term generated
for n = 2.

It is easy finding formulas for the sum of any number of consecutive
triangular numbers: just add n(n+1)/2 + (n+1)(n+2)/2 +...+ (n+k)(n+k+1)/2.
For example, for 5 terms we obtain (5/2)*(8 + 5n + n^2).  The general
formula for the sum of k consecutive triangular numbers is
(1/2)((k-1)k(k+1)/3 + (k^2)*n + k*n^2).  This formula can be simplified.

Note that when 3 does not divide k, then 3 divides k-1 or k+1 and the
formula becomes f1(n) = (k/2)*((k-1)(k+1)/3 + k*n + n^2).  When 3 does
divide k, then the formula is f2(n) = (k/3/2)*((k-1)(k+1) + 3*k*n + 3*n^2).
The important fact to note in these formulas is that (1) the multiplying
constant is k/2 or k/3/2 and (2) the numbers generated by f1(n) and f2(n)
are composite for k > 6.  The number 2 in the denominator either (1)
divides into k when k is even or (2) divides into (k-1)(k+1) + 3*k*n +
3*n^2 when k is odd.

The first 10 formulas are
  (1/2) * (0 + n + n^2)
  1     * (1 + 2*n + n^2)
  (1/2) * (8 + 9*n + 3*n^2)
  2     * (5 + 4*n + n^2)
  (5/2) * (8 + 5*n + n^2)
  1     * (35 + 18*n + 3*n^2)
  (7/2) * (16 + 7*n + n^2)
  4     * (21 + 8*n + n^2)
  (3/2) * (80 + 27*n + 3*n^2)
  5     * (33 + 10*n + n^2)

The numerators in the initial multiplying constant (1, 1, 1, 2, 5, 1, 7, 4,
3, 5,...) are in the sequence http://oeis.org/A060789


Q2:

Consider the two sequences produced by the sum of three consecutive
triangular numbers (8 + 9n + 3n^2)/2 and the sum of six consecutive
triangular numbers 35 + 18n + 3n^2.  Look at these sequences modulo 3.  If
these sequences ever produce the same number, then it will be the same
number modulo 3.  However, it is easy to see that (8 + 9n + 3n^2)/2 mod 3 =
1 for all integers n and 35 + 18n + 3n^2 mod 3 = 2 for all integer n.
Hence, these two sequences never have the same number.


The prime numbers formed from the sum of consecutive triangular numbers are
shown in http://www.IntegerSequences.org/s000757.html

***

 

Records   |  Conjectures  |  Problems  |  Puzzles