A385713 Numbers w + x + y + z where (w,x,y,z) are nonnegative solutions to the Diophantine equation w^2 + x^2 + y^2 + z^2 = w*x*y*z.
0, 8, 12, 32, 108, 292, 392, 1452, 3392, 3712, 5408, 11808, 20172, 34872, 40332, 50572, 75272, 162212, 280908, 480512, 518252, 595052, 700352, 1048352, 1639308, 3912492, 4599172, 4911172, 5725732, 6049292, 6508932, 7132608, 8279808, 9739812
Offset: 1
Keywords
Examples
8 is a term because (w,x,y,z) = (2,2,2,2) is the first nontrivial solution. 12 is a term because (2,2,2,6) is a solution.
Links
- Bence Bernáth, Table of n, a(n) for n = 1..10000
- Michael Magee and Brady Haran, A simple equation that behaves weirdly, Numberphile, Youtube video, 2025.
Programs
-
Python
import math def is_perfect_square(n): return (math.isqrt(n)) ** 2 == n def generate_all_solutions(radius): solutions = set() visited = set() # Initial known solution seed = (2, 2, 2, 2) queue = [seed] solutions.add(seed) while queue: quad = queue.pop(0) for ii in range(4): # Cyclically rotate variables: solve for the ii-th one rotated = list(quad[ii:] + quad[:ii]) x, y, z, w = rotated # Use Vieta's formula: x^2 - (yzw)x + (y² + z² + w²) = 0 product = y * z * w sumsq = y**2 + z**2 + w**2 D = product**2 - 4 * sumsq if D < 0 or not is_perfect_square(D): continue sqrt_D = (math.isqrt(D)) for sign in [+1, -1]: x_new = (product + sign * sqrt_D) if x_new % 2 != 0: continue x_new //= 2 if not (0 < x_new < radius): continue new_quad = [x_new, y, z, w] if any(val >= radius for val in new_quad): continue new_quad_sorted = tuple(sorted(new_quad)) if new_quad_sorted not in visited: solutions.add(new_quad_sorted) queue.append(tuple(new_quad)) visited.add(new_quad_sorted) # Return solutions sorted by sum of elements return sorted([list(sol) for sol in solutions], key=lambda tup: sum(tup)) print([sum(sol) for sol in generate_all_solutions(10000000)])
Comments