human
Lagrange 's four square theorem | Prints all the possible combinations 4 numbers whose sum of squares is equal to the given no ..
loops checking the sum of squares.
if sum of four squares equals the given no ..
printing the numbers.
Driver Code.
74 = 0 * 0 + 0 * 0 + 5 * 5 + 7 * 7 74 = 0 * 0 + 1 * 1 + 3 * 3 + 8 * 8 74 = 0 * 0 + 3 * 3 + 4 * 4 + 7 * 7 74 = 1 * 1 + 1 * 1 + 6 * 6 + 6 * 6 74 = 2 * 2 + 3 * 3 + 5 * 5 + 6 * 6"
Solution in Python:
 ... What is a code to lagrange 's four square theorem and the other steps required?
assistant
#Here is code to lagrange 's four square theorem and the other steps required.
 def printFourSquares ( a ) :
	i = 0
	while ( i * i <= a ) :
		j = i
		while ( j * j <= a ) :
			k = j
			while ( k * k <= a ) :
				l = k
				while ( l * l <= a ) :
					if ( i * i + j * j + k * k + l * l == a ) :
						print ( " { } ▁ = ▁ { } * { } ▁ + ▁ { } * { } ▁ + " . format ( a , i , i , j , j ) , end = " ▁ " )
						print ( " { } * { } ▁ + ▁ { } * { } " . format ( k , k , l , l ) , end = " " )
					l = l + 1
				k = k + 1
			j = j + 1
		i = i + 1
a = 74
printFourSquares ( a )