A001974 Numbers that are the sum of 3 distinct squares, i.e., numbers of the form x^2 + y^2 + z^2 with 0 <= x < y < z.
5, 10, 13, 14, 17, 20, 21, 25, 26, 29, 30, 34, 35, 37, 38, 40, 41, 42, 45, 46, 49, 50, 52, 53, 54, 56, 58, 59, 61, 62, 65, 66, 68, 69, 70, 73, 74, 75, 77, 78, 80, 81, 82, 83, 84, 85, 86, 89, 90, 91, 93, 94, 97, 98, 100, 101, 104, 105, 106, 107, 109, 110, 113
Offset: 1
Examples
5 = 0^2 + 1^2 + 2^2.
Links
- T. D. Noe, Table of n, a(n) for n=1..1000
- Franz Halter-Koch, Darstellung natürlicher Zahlen als Summe von Quadraten, Acta Arithmetica 42 (1982), pp. 11-20.
- Index entries for sequences related to sums of squares
Programs
-
Mathematica
r[n_] := Reduce[0 <= x < y < z && x^2 + y^2 + z^2 == n, {x, y, z}, Integers]; ok[n_] := r[n] =!= False; Select[ Range[113], ok] (* Jean-François Alcover, Dec 05 2011 *)
-
Python
from itertools import combinations def aupto(lim): s = filter(lambda x: x <= lim, (i*i for i in range(int(lim**.5)+2))) s3 = set(filter(lambda x: x<=lim, (sum(c) for c in combinations(s, 3)))) return sorted(s3) print(aupto(113)) # Michael S. Branicky, May 10 2021
Comments