Talk:Lagrange's four-square theorem

message: I can't seem to find information on this elsewhere, but this seems to fail on very simple cases, such as the number 5. Since 5 is odd, and has only itself as a divisor (or do we count the trivial divisor 1?) We should have 8(5) = 40 possible combinations of sums of squares.  But there exists only one:
22 + 12 + 2(02) = 5
Assuming we allow all permutations of order, that only gives us 4!, and this is not unique to this decomposition either.  Allowing squares of negative numbers naively seems to be an unnecessary complication, but I still don't see how this works.  Explanation someone please? --71.11.128.29 01:36, 4 January 2007 (UTC)
replies: text: Actually "allowing all permutations of order" gave you 4!/2 = 12, because 2 of the 4 numbers being permuted are identical(0 and 0). But then allowing pluses and minuses on 1 and 2 multiplies the 12 by 4, giving 48 in all. Since 8 times (1 + 5) = 48, Jacobi's theorem is verified for this example. Hope this helps. Thanks for the thoughtful question.Rich 01:50, 4 January 2007 (UTC)
thread_title: Problem with Jacobi's Combinations

message: Why does it matter if the integers are negative?
:negative integers can't be represented as the sum of squares. Horndude77 19:02, 16 July 2005 (UTC)
replies: text: He was referring to "More formally, for every positive integer n there exist non-negative integers x1, x2, x3, x4". Since negatives square always square up to positives I don't see any reason why the should be non-negative. I've edited accordingly. --poorsodtalk 16:53, 23 May 2007 (UTC)
thread_title: Question

message: I removed the following:
:"In 2005, Zhi-Wei Sun proved that any natural number can be represented as the sum of a square, an even square and a triangular number."
This may or may not be true but why does it have to be here? -- Taku 01:11, July 19, 2005 (UTC)
Word kevinbocking 22:18, 3 July 2007 (UTC)
thread_title: Removal

message: The proof appears in ja article. I might translate it to here if I have time. Anyone interested to see it? -- Taku 07:40, 18 July 2007 (UTC)
thread_title: Proof

message: The article says (uncited) "An earlier proof by Fermat was never published." Does this proof definitely exist, or is it another of those marginal notes like the one about his last theorem? AndrewWTaylor 17:20, 24 October 2007 (UTC)
replies: text: It does indeed exist. According to Wolfram's MathWorld: "Although the theorem was proved by Fermat using infinite descent, the proof was suppressed. Euler was unable to prove the theorem. "  —Preceding unsigned comment added by 71.88.108.163 (talk) 03:18, 8 July 2008 (UTC)
thread_title:  Fermat's proof? 

message: By symmetry, the statement "if we assume, without loss of generality, that a ≤ b ≤ c ≤ d then there are exactly 54 possible choices for a, b, c and d such that (*) is solvable in integers x1, x2, x3, x4 for all n" is meaningless.  Each x_n is a square.  
Borat fan (talk) 23:36, 17 July 2008 (UTC)
replies: text: I don't understand what you were trying to say. Eric Kvaalen (talk) 18:51, 14 October 2013 (UTC)
thread_title:  Ramanujan's General Solution 

message: In the article currently, it says that the total number of ways a given positive integer n can be represented as the sum of four squares is eight times the sum of the divisors of n if n is odd and 24 times the sum of the odd divisors of n if n is even. Other sources, e.g. this one say it is eight times the sum of all its divisors which are not divisible by 4. These are equivalent (although not immediately obvious in some cases). It might be helpful to give both formulas. MSGJ (talk) 13:38, 11 August 2008 (UTC)
replies: text: On reflection I have moved the stuff on Jacobi's theorem to a new article Jacobi's four-square theorem because although related to the Lagrange theorem, it seems not to belong here. MSGJ (talk) 13:38, 11 August 2008 (UTC)
thread_title:  Jacobi's Four Square Theorem 

message: I think I have found some gaps in this pseudo-proof. First of all: where do we use the fact that 'The generalized Euclidean algorithm' works ? The second one: I am not sure but I think that Hurwitz integers haven't got a property of unique factorization. Because:
2 = (1+i)(1-i) = (1-j)(1+j) = (1-k)(1+k)
The last one: even if this proof is correct, we only show that 'p' is a sum of four square of integers or four square of half-integer.  — Preceding unsigned comment added by 89.231.20.14 (talk) 08:29, 9 July 2011 (UTC)
replies: text: I have rewritten parts of the proof to avoid invalid references to unique factorization, and I believe it is correct now. However, I wonder whether it’s a good idea to use fancy abstract algebra like (not quite) Euclidean domains and irreducible elements at all. The relevant part of the proof can be framed as a quite elementary infinite descent argument, and one can do it with Lipschitz quaternions instead of Hurwitz. It does not seem to me to be significantly longer than the current proof, and it might be more accessible.—Emil J. 20:03, 7 October 2013 (UTC)
replies: text: It ought to be unnecessary to debate how to write a correct proof: simply use what is given in the independent reliable source that you are using, and cite it.  Otherwise, it's original research, and it gets taken out.  Deltahedron (talk) 21:33, 22 March 2014 (UTC)
thread_title:  There are some gaps in this 'proof' ! 

message: A few months ago I changed the "norms" mentioned to be norms according to the definitions given in both Norm (mathematics) and Quaternion. But User:EmilJ reverted all that to the "norms" that were there before, which are actually the squares of the norms, with the comment "Calling this a norm is a perfectly standard terminology, and the extra square roots only serve to obfuscate the proof." It's true that the square of the usual norm is a "field norm", but I don't think it's standard simply to call this "the norm" of a quaternion. Eric Kvaalen (talk) 18:51, 14 October 2013 (UTC)
replies: text: There are any number of sources that call it exactly that: the first page of a Google search gave . It is obvious from your contribution list that your background is in analysis and continuous structures. Here you are in a different universe, this article is about quite discrete algebra (or rather, algebraic number theory). Different fields of mathematics use different terminological conventions, for good reasons. Face it. Now I noticed that you made the same misguided edit to other articles on integer quaternions, I’m going to revert that as well.—Emil J. 11:49, 15 October 2013 (UTC)
replies: text: I only changed the article on Hurwitz quaternions. Are you going to change the quaternion article as well? I had nothing to do with that. Eric Kvaalen (talk) 12:52, 15 October 2013 (UTC)
replies: text: The quaternion article does not deal with algebraic integers, so there would be no point in introducing this concept of a norm there. (I wrote “other articles” before I realized that Lipschitz quaternion and Hurwitz quaternion are the same article. Sorry for the confusion.)—Emil J. 14:38, 15 October 2013 (UTC)
thread_title: Norm

message: // the largest integer whose square is less than or equal to N
    public int SquRt(int N)
    {
        return (int)std::sqrt((double)N);
    }
#typedef pair<int,int> pairint; 
#typedef pair<pairint, pairint> quadint; // so, I'm lazy
#typedef forward_list<pairint> list2;
#typedef list<quadint> list4;
using std;
// Return a list of all integer quads (a,b,c,d), where:
    //      a^2 + b^2 + c^2 + d^2 = N,
    // and  a >= b >= c >= d,
    // and  a,b,c,d >= 0
    public list4 FindAllFourSquares(int N)
    {
        list2[] Sqr2s = new list2[N+1];
// Sqr2s[i], for 0 <= i <= N
// will be a list of all pairs (a,b) such that a^2 + b^2 = i,
// in increasing order
        list4 Sqr4s;
 
        for (int i = SquRt(N); i >= 0; i--)
        {
            for (int j = 0; j <= i; j++)
            {
                int sum = (i * i) + (j * j);
                if (sum > N)
                {
                    break;
                } else {
                    Sqr2s[sum].push_front(pair(i,j));
                }
            }
        }
        for (   int i=N, int j=0;
                i>=j;
                i--, j++ )
        {
            if (Sqr2s[i].empty() || Sqr2s[j].empty() )
            {
                continue;
            }
            for (pairint & p1 : Sqr2s[i])
            {
                for (pairint & p2 : Sqr2s[j])
                {
                    if (p1.second >= p2.first)
                    {
                        Sqr4s.push_back(pair(p1,p2));
                } else {
                        break;
                }
            }
        }
    }
    return Sqr4s;
}
No "lang="c++"?  Anyway, this is adapted from the stackexchange code.  Being lazy, I left the sequence (a,b,c,d) as pair(pair(a,b),pair(c,d)).  If you want to translate that into tuple<int, int, int, int> or another representation of a sequence of 4 integers, go ahead.
— Arthur Rubin  (talk) 21:23, 30 March 2014 (UTC)
replies: text: OK, OK, I am being slowly convinced that Wikipedia is probably not the best place for code snippets which are not relevant to the content of the article, and it seems to be the case here. But then I would be against adding any more algorithms here. The python code seems just interesting enough to be included. And I am entirely against adding anything in C++, which is almost as far from pseudo-code as one can imagine. melikamp (talk) 15:17, 1 April 2014 (UTC)
thread_title:  Proposed C++ algorithm (using C+11 standard) 

message: The current lead of the Euclidean algorithm article includes, "Finally, [the algorithm] is a basic tool for proving theorems in number theory such as Lagrange's four-square theorem and the uniqueness of prime factorizations."  When I followed the link to this article, I didn't see the Euclidean algorithm mentioned anywhere.  There is the statement that the Hurwitz quaternions have some properties of a Euclidean domain, but nothing about the Euclidean algorithm.
The Euclidian algorithm article is a featured article.  Surely it has passed multiple levels of review.  Any ideas why that statement was added to the lead?
Thanks, 24.240.67.157 (talk) 23:11, 10 February 2016 (UTC)
replies: text: Thanks for this remark. I indeed don't see that there is any use of the Euclidean algorithm in any proof of the four-square theorem. In case I am mistaken, I put a "citation needed" tag on this assertion. Unless somebody provides  reference to a proof using the algorithm, I will delete the assertion. Sapphorain (talk) 15:51, 19 February 2016 (UTC)
thread_title:  Use of Euclidean algorithm in proof? 

message: THIS THEOREM HAS SOME CONTRADICTION.
LIKE IN NUMBER 
96 = 9² + 3² + 2² + 1² + 1²
     = 81 + 9 + 5 + 1 + 1
IT NEEDS 5 SQUARES TO MAKE THE NUMBER 96 Ishan Shekhar (talk) 14:56, 15 June 2021 (UTC)
replies: text: 96 = 64 + 16 + 16 + 0 --Sapphorain (talk) 17:49, 15 June 2021 (UTC)
thread_title:  LAGRANGE'S FOUR SQUARE THEOREM 

message: The subscripts in p = a_0^2 + a_1^2 + a_2^2 + a_3^2 are too hard to read with the exponents, so I think it best to rewrite this as p = a^2 + b^2 + c^2 + d^2. 47.211.220.38 (talk) 16:22, 7 April 2023 (UTC)
thread_title:  Subscripts