Abstract
The classical problem of finding all integers a and M such that the sums of M consecutive squared integers  equal the squared integer , where M is the number of terms in the sum,  the first term and , , yields remarkable regular linear features when plotting the values of M as a function of a. These linear features correspond to groupings of pairs of a values for successive same values of M found on either side of straight lines of equation , where c is an integer constant and  a parameter taking some rational values, called allowed values. We find expressions of a and s as a function of M for the allowed values of  and M and parametric expressions of a, M, and s. Further, Pell equations deduced from the conditions of M are solved to find the allowed values of  and to provide all solutions in a and M. These results yield new insights into the overall properties of the classical problem of the sums of consecutive squared integers equal to squared integers and allow us to solve this problem completely by providing all solutions in infinite families.
    Keywords:
                                                                    sums of consecutive squared integers equal to square integers;                    quadratic Diophantine equation;                    generalized Pell equation;                    fundamental solutions;                    Chebyshev polynomials        MSC:
                11E25; 11D09; 33D45
            1. Introduction
Throughout this paper, we are considering sums of squared integers equal to another squared integer
      
      
        
      
      
      
      
    
      where  are positive integers, M is the number of terms in the sum and  is the first term in the sum.
The study of integer squares equal to sums of consecutive squared integers can be dated back to 1873, when Lucas stated [] that  is an integer square only for  and 24. Lucas proposed later in 1875 [] the well-known cannonball problem. This problem can clearly be written as a Diophantine equation . The only solutions are  and 4900, which correspond to the sum of the first M squared integers for  and . This was partially proven by Moret-Blanc [] and Lucas [], and entirely proven later on by Watson [] (using elliptic functions for one case), Ljunggren [], Ma [] and Anglin [].
Instead of starting at 1, finding all integers  for which the sum of M consecutive integer squares starting from  is itself an integer square  is a more general problem. Various approaches have been followed in attempts at finding solutions to this problem. Alfred proposed [] several necessary conditions on M (with the notations of this paper), yielding  until M = 500 by solving congruence equations of M, without conclusions for . Philipp [] showed further that solutions exist for  but not for  and proved that there are a finite or an infinite number of solutions depending on whether M is or is not a square integer. Laub demonstrated [] that the set of M yielding the sum of M consecutive squared integers being a squared integer is infinite and has density zero. Eight necessary conditions were imposed on M by Beeckmans [], yielding a list of values of  with the corresponding smallest value of . Two cases for  and 842 were found satisfying the eight necessary conditions but not yielding solutions to the problem.
This author showed [] that (1) has no integer solutions if  or  and that (1) has integer solutions for non-squared integer M congruent to  or , or to  or , or to , and for squared integer M congruent to .
In this paper, we investigate and characterize the properties of groupings of pairs of integers a for same values of M. These groupings are found in an  plot on either side of the inclined straight lines of equation , where c is a constant, that can be approximated by , for rational values of , where  are integers such that  is an irreducible fraction.
In Section 2.1, we give a definition of pairs of integers a solutions of (1) for the same value of M and a theorem giving the expressions of a and s as a function of M for allowed values of  and M. In Section 2.2, we give parametric expressions of a, M and s. In Section 2.3, we solve Pell equations to find the allowed values of . In Section 3, we give and discuss examples of some infinite families of solutions of (1). Conclusions are drawn in Section 4.
2. Materials and Methods
2.1. Observed Linear Features in the (a,M) Plot
For , the sum of M consecutive squared integers  equaling a squared integer  can be written [] as
        
      
        
      
      
      
      
    
For  and , there are only 4078 couples of values of a and M among the approximately  possibilities such that (2) holds. Figure 1 shows the distribution of these 4078 couples in an  plot, where several groupings of interest are seen.
      
    The most visible is the grouping around a straight line of equation , where c is a constant, corresponding to a double infinite family of integers a. This grouping starts with the identity and the Pythagorean relations
        
      
        
      
      
      
      
    
      
        
      
      
      
      
    
        for the same value of  and, respectively, for  and 3. This double infinite family has the property that couples of a values correspond to the same value of M. There are other similar groupings and double infinite families around straight lines of general equation  for certain rational values of , and where  is a constant different for each value of . Only groupings around inclined lines are considered, as the limit cases of  and  corresponding to groupings around, respectively, vertical and horizontal lines are not treated here. The “horizontal” case for which one or several solutions in a exist for each value of M was investigated in [,].
2.2. Definition of Pairs and Theorem on Conditions on μ, M and a
Definition 1. 
For , for a given , two integers  are called a pair  if for the same value of  and , the relations
      
        
      
      
      
      
    
      
        
      
      
      
      
    hold, where  is a linear integer function of k for each value of μ, yielding
      
        
      
      
      
      
    where the upper or lower sign is taken for  or 2.
The two families of  and  are characterized for each value of  around the straight line of equation  in the following theorem. However, relations (5) to (7) hold only for certain values of  and of , called allowed values, which are determined further.
Theorem 1. 
For , , for allowed values of , let  be an irreducible fraction; if  is a pair of integers  for the same value of  and if
      
        
      
      
      
      
    holds , then the sums of squares of  consecutive integers  for  to  are always equal to squared integers , with
      
        
      
      
      
      
    
      
        
      
      
      
      
    where the upper (respectively, lower) sign is taken for  (respectively, 2).
Proof.  
Let , ,  forming an irreducible fraction, i.e., . Let further  be a yet-unknown integer function of k for each value of . Replacing in the second equality of (2) M by  and a by  from (7) yields, successively,
          
      
        
      
      
      
      
    
          where the upper (respectively, lower) sign in (11) is taken for  (respectively, 2). For the expression between brackets in (11) to be a square, replace in (11)  by
          
      
        
      
      
      
      
    
          from (8), immediately yielding (10). Replacing  (12) in (7) then yields (9).    □
In addition, from Theorem 2, the following relations hold 
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
2.3. Parametric Expressions of , , ,
The above results hold only for certain values of  and of , which are called allowed values. They can be determined as follows. Relation (8) also reads
        
      
        
      
      
      
      
    
It was shown [] that for (18) to hold:
- -
 - and or , or and ;
 - -
 - or and or and either and or and , and .
 
Parametric expressions of , ,  and  as a function of ,  and initial values are found as follows.
Theorem 2. 
For , , , , for allowed values of  and for pairs ,  is a linear function of k,  and  are quadratic functions of k and  is a cubic function of k, as follows:
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    where  for  or ,  for  and where the upper (respectively, lower) sign is taken for  (respectively, 2).
Proof.  
For , , , , for allowed values of  and for pairs , let  (6) be a linear function of k, , where  is the initial value for  of the difference (6) and x an integer function to be defined for some parameters. Then, (8) yields
          
      
        
      
      
      
      
    The second term on the right of (23) is  by (8).
(ii) If , simplifying the first term by 3, (23) reads
          
      
        
      
      
      
      
    
As ,  is a factor of x. However, as  or  for ,  and as  , x must be replaced by , then yielding (19) and (20) with .
2.4. Finding Allowed Values of and
Finding the allowed values of ,  and  requires solving the generalized Pell Equation (18) for  in variables  and .
In general, for  and D square-free (i.e., ), a generalized Pell equation  admits either no solution or one or several fundamental solution(s)  and also one or several infinite branches of solutions . Several methods exist to find the fundamental solutions of the generalized Pell equation (see [,,]). Two methods are used further: first, a brute-force search method, i.e., trying several values of Y until the smallest  is found; second, Matthews’ method [] based on an algorithm by Frattini [,,] using Nagell’s bounds [,]. Once fundamental solution(s)  have been found one way or another, noting , the fundamental solutions of the related simple Pell equation , the other solutions  can be found by
        
      
        
      
      
      
      
    
        for a proper choice of sign ± [], which can also be written as a function of Chebyshev’s polynomials []
        
      
        
      
      
      
      
    
      
        
      
      
      
      
    
        where  and  are Chebyshev polynomials of the first and second kinds evaluated at .
The generalized Pell Equation (18) can be written as
        
      
        
      
      
      
      
    
        with , ,  and , and where  if  or  and  if .
To use Matthews’ method [], the parameters D and N must be fixed with values of  and  that can be chosen from the allowed congruent values (see Section 2.3) and be tried one by one until fundamental solutions are found. Alternatively, fixing the values of  and , a brute-force search method can be used to find  for the smallest value of , with, from (12),
        
      
        
      
      
      
      
    
Relation (29) then yields the allowed values of  and  given in Table 1 for  , for  ([] gives all values of  such that  is prime, for which (29) holds.) and in  [] for , for .
       
    
    Table 1.
    Values of  and  for .
  
3. Results and Discussion
To demonstrate the soundness of the method exposed above using the Pell equation approach, we give here several examples.
Example 1. 
For  and ,  and  from Table 1. Using  and δ as constants in (28) with , it reduces to a simple Pell equation  (see, e.g., [,,,]) that admits the single fundamental solution  or  and an infinity of other solutions that can be found  by
      
        
      
      
      
      
    
      
        
      
      
      
      
    where  are the Pell numbers [] of even indices minus one. These new values of  for  define new groupings around straight lines of general equation , with the initial value .
- For , , i.e., , , , , (20) to (22) yield
 - ,
 - , ,
 - , ,
 - and values of , and for are given in Table 2.
 
       
    
    Table 2.
    Values of , ,  for  and .
  
      
    
    Figure 2.
      Distribution of M versus a for .
  
Example 2. 
For  and ,  and  from Table 1. Using  and δ as constants in (28) with  yields the generalized Pell equation . Using Matthews’ method [] yields the single fundamental solution , which is of no use. However, as the right-hand term is a squared integer, the equation can be rewritten as a simple Pell equation , which admits the fundamental solution  or  and an infinity of other solutions 
      
        
      
      
      
      
    
      
        
      
      
      
      
    
- For , , i.e., , , , , (20) to (22) yield (see Table 2)
 - ,
 - , ,
 - ,
 - .
 
      
    
    Figure 3.
      Distribution of M versus a for .
  
Example 3. 
For  and , i.e., ,  and  []. Using  and δ as constants in (28) with  yields , which, by [], has two fundamental solutions  and , yielding  and , respectively. The fundamental solutions of the related simple Pell equation  are . Other values of  can be found on the two infinite branches corresponding to these two fundamental solutions by (30) and (31) as
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    for the first fundamental solution and
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    
      
        
      
      
      
      
    for the second fundamental solution. For , , i.e., , , , , (20) to (22) yield (see Table 2).
- ,
 - , ,
 - ,
 - .
 
      
    
    Figure 4.
      Distribution of M versus a for .
  
4. Conclusions
Definition 1 and Theorem 2 allowed us to show that regular linear features exist in the distribution of couples of values a and M in the  plot, where  and M are the first term and the number of terms in sums of consecutive squared integers equal to integer squares. These regular features correspond to groupings of pairs of a values for successive same values of M found on either side of straight lines of equation  for positive rational values of  and where c is a constant.
For allowed values of  and  such as  and  or , if  holds  and for pairs , then the sums of  consecutive squared integers starting with  or  are always equal to squared integers  or . Parametric equations are found as a function of : linear for , quadratic for ,  and  and cubic for  and .
The allowed values of  and of the difference  are found by solving the generalized Pell equation  and further allowed values of  and  can be calculated for fixed values of  and  using Chebyshev polynomials.
This approach allows us to completely solve the classical problem of the sums of consecutive squared integers equal to squared integers and provide all solutions in infinite families.
Funding
This research received no external funding.
Data Availability Statement
There are no data associated with this work.
Acknowledgments
This research was conducted under the good auspice of the European Space Agency Technical and Research Centre (The Netherlands) and the Engineering and Technology Centre for Space Utilization (Beijing).
Conflicts of Interest
The author declares no conflicts of interest.
References
- Lucas, E. Recherches sur l’analyse Indéterminée et l’arithmétique de Diophante; C. Desrosiers: Moulins, France, 1873; p. 90. Available online: http://edouardlucas.free.fr/pdf/oeuvres/diophante.pdf (accessed on 25 January 2024).
 - Lucas, E. Question 1180. Nouv. Ann. Math. 1875, 14, 336. [Google Scholar]
 - Moret-Blanc, M. Question 1180. Nouv. Ann. Math. 1876, 15, 46–48. [Google Scholar]
 - Lucas, E. Solution de la Question 1180. Nouv. Ann. Math. 1877, 15, 429–432. [Google Scholar]
 - Watson, G.N. The Problem of the Square Pyramid. Messenger Math. 1918, 48, 1–22. [Google Scholar]
 - Ljunggren, W. New solution of a problem proposed by E. Lucas. Norsk Mat. Tid. 1952, 34, 65–72. [Google Scholar]
 - Ma, D.G. An Elementary Proof of the Solutions to the Diophantine Equation 6y2 = x(x + 1)(2x + 1). Sichuan Daxue Xuebao 1985, 4, 107–116. [Google Scholar]
 - Anglin, W.S. The Square Pyramid Puzzle. Am. Math. Mon. 1990, 97, 120–124. [Google Scholar] [CrossRef]
 - Alfred, U. Consecutive integers whose sum of squares is a perfect square. Math. Mag. 1964, 37, 19–32. [Google Scholar] [CrossRef]
 - Philipp, S. Note on consecutive integers whose sum of squares is a perfect square. Math. Mag. 1964, 37, 218–220. [Google Scholar] [CrossRef]
 - Laub, M. Squares Expressible as a Sum of n Consecutive Squares, Advanced Problem 6552. Am. Math. Mon. 1990, 97, 622–625. [Google Scholar] [CrossRef]
 - Beeckmans, L. Squares Expressible as Sum of Consecutive Squares. Am. Math. Mon. 1994, 101, 437–442. [Google Scholar] [CrossRef]
 - Pletser, V. Congruence conditions on the number of terms in sums of consecutive squared integers equal to squared integers. arXiv 2014, arXiv:1409.7969. [Google Scholar] [CrossRef]
 - Pletser, V. Finding all squared integers expressible as the sum of consecutive squared integers using generalized Pell equation solutions with Chebyshev polynomials. arXiv 2014, arXiv:1409.7972. [Google Scholar] [CrossRef]
 - Pletser, V. Congruent conditions on the number of terms, on the ratio number of terms to first terms and on the difference of first terms for sums of consecutive squared integers equal to squared integers. arXiv 2014, arXiv:1410.0727. [Google Scholar] [CrossRef]
 - Matthews, K.R. The Diophantine Equation x2 − Dy2 = N, D > 0, in integers. Expo. Math. 2000, 18, 323–331. [Google Scholar]
 - Mollin, R.A. Fundamental Number Theory with Applications; CRC Press: New York, NY, USA, 1998; pp. 294–307. [Google Scholar]
 - Robertson, J.P. Solving the Generalized Pell Equation X2 − DY2 = N. 2004. Available online: https://studylib.net/doc/18752934/solving-281 (accessed on 28 December 2023).
 - Matthews, K. Quadratic Diophantine Equations BCMATH Programs. Available online: http://www.numbertheory.org/php/main_pell.html (accessed on 28 December 2023).
 - Frattini, G. Dell’analisi indeterminata di secondo grado. Period. Mat. 1891, 6, 169–180. [Google Scholar]
 - Frattini, G. A complemento di alcuni teore mi del sig. Tchebicheff Rom. Acc. L. Rend. 1892, 5, 85–91. [Google Scholar]
 - Frattini, G. Dell’analisi indeterminata di secondo grado. Periodico di Mat. 1892, 7, 172–177. [Google Scholar]
 - Matthews, K.; Robertson, J. On the Converse of a Theorem of Nagell and Tchebicheff. Available online: http://www.numbertheory.org/PDFS/nagell2.pdf (accessed on 28 December 2023).
 - Nagell, T. Introduction to Number Theory; Wiley: New York, NY, USA, 1951; pp. 195–212. [Google Scholar]
 - Matthews, K. The Diophantine Equation x2 − Dy2 = N. Available online: http://www.numbertheory.org/PDFS/patz5.pdf (accessed on 28 December 2023).
 - Nambi, P. Numbers n such that 3*n⌃2 + 1 is prime, Sequence A111051 in The On-line Encyclopedia of Integer Sequences. Available online: https://oeis.org/A111051 (accessed on 28 December 2023).
 - Pletser, V. Fundamental Solutions of the Generalized Pell Equation (δf)2 − M(η + δ)2 = δ2(M + 1)/3 for 0 < η, δ < 100. Res. Gate. 2014. Available online: https://www.researchgate.net/publication/264496057_Fundamental_solutions_of_the_generalized_Pell_equation_%28f%292-M%28%292_2%28M1%293_for_0__100?ev=prf_pub (accessed on 7 August 2014).
 - Lagrange, J.L. Solution d’un Probleme d’Arithmetique, in Oeuvres de Lagrange; Serret, J.-A., Ed.; Gauthier-Villars: Paris, France, 1867; Volume 1, pp. 671–731. [Google Scholar]
 - Lenstra, H.W., Jr. Solving the Pell Equation. Not. Ams. 2002, 49, 182–192. [Google Scholar]
 - O’Connor, J.J.; Robertson, E.F. Pell’s Equation, JOC/EFR February 2002. Available online: https://mathshistory.st-andrews.ac.uk/HistTopics/Pell/ (accessed on 28 December 2023).
 - Pletser, V. On continued fraction development of quadratic irrationals having all periodic terms but last equal and associated general solutions of the Pell equation. J. Number Theory 2013, 136, 339–353. [Google Scholar] [CrossRef]
 - Sloane, N.J.A. Pell Numbers, Sequence A000129 in The On-line Encyclopedia of Integer Sequences. Available online: https://oeis.org/A000129 (accessed on 28 December 2023).
 
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.  | 
© 2024 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).