A061790 a(n) = A000217(n) - A061786(n).
0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 5, 6, 8, 11, 12, 14, 18, 20, 25, 27, 31, 35, 42, 46, 50, 55, 61, 67, 74, 78, 87, 94, 101, 111, 118, 124, 133, 143, 153, 159, 172, 181, 193, 206, 214, 227, 240, 251, 265, 277, 290, 303, 322, 337, 350, 363, 378, 392, 410, 421, 440, 461
Offset: 1
Keywords
Examples
S={1,4,9,...,100,121} provides 61 different sums of two (not necessarily different) squares: {2,5,8,..,202,221,242}. Only 5 of these sums arise more than once: 50 = 1 + 49 = 25 + 25; 65 = 1 + 64 = 16 + 49; 85 = 4 + 81 = 36 + 49; 125 = 4 + 121 = 25 + 100; 130 = 9 + 121 = 49 + 81. Therefore a(11) = (12*11/2) - 61 = 5.
Programs
-
Maple
N:= 100: # for a(1) .. a(N) V:= Vector(2*N^2, datatype=integer[4]): R:= Vector(N): count:= 0: for n from 1 to N do for i from 1 to n do t:= i^2 + n^2; V[t]:= V[t]+1; if V[t] = 1 then count:= count+1 fi; od; R[n]:= n*(n+1)/2 - count od: convert(R,list); # Robert Israel, Jun 26 2025
-
Mathematica
f[x_] := x^2 t0=Table[Length[Union[Flatten[Table[f[u]+f[w], {w, 1, m}, {u, 1, m}]]]], {m, 1, 75}] t1=Table[(w*(w+1)/2)-Part[t0, w], {w, a, b}]
-
Python
def A061790(n): return (n*(n+1)>>1)-len({i**2+j**2 for i in range(1,n+1) for j in range(1,i+1)}) # Chai Wah Wu, Jun 27 2025
Extensions
Definition corrected by Robert Israel, Jun 26 2025
Comments