This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A061790 #23 Jun 27 2025 20:59:40 %S A061790 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, %T A061790 67,74,78,87,94,101,111,118,124,133,143,153,159,172,181,193,206,214, %U A061790 227,240,251,265,277,290,303,322,337,350,363,378,392,410,421,440,461 %N A061790 a(n) = A000217(n) - A061786(n). %C A061790 If the {s+t} sums are generated by addition 2 terms of an S set consisting of n different entries, then at least 1 and at most n(n+1)/2=A000217(n) distinct values can be obtained. The set of first n squares gives results falling between these two extremes. %C A061790 Original name: "Number of sums i^2 + j^2 that occur more than once for 1 <= i <= j <= n." This was incorrect because sums that occur more than twice are overcounted. - _Robert Israel_, Jun 26 2025 %e A061790 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: %e A061790 50 = 1 + 49 = 25 + 25; %e A061790 65 = 1 + 64 = 16 + 49; %e A061790 85 = 4 + 81 = 36 + 49; %e A061790 125 = 4 + 121 = 25 + 100; %e A061790 130 = 9 + 121 = 49 + 81. %e A061790 Therefore a(11) = (12*11/2) - 61 = 5. %p A061790 N:= 100: # for a(1) .. a(N) %p A061790 V:= Vector(2*N^2, datatype=integer[4]): %p A061790 R:= Vector(N): %p A061790 count:= 0: %p A061790 for n from 1 to N do %p A061790 for i from 1 to n do %p A061790 t:= i^2 + n^2; %p A061790 V[t]:= V[t]+1; %p A061790 if V[t] = 1 then count:= count+1 fi; %p A061790 od; %p A061790 R[n]:= n*(n+1)/2 - count %p A061790 od: %p A061790 convert(R,list); # _Robert Israel_, Jun 26 2025 %t A061790 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}] %o A061790 (Python) %o A061790 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 %Y A061790 Cf. A000217, A385352. %K A061790 nonn %O A061790 1,8 %A A061790 _Labos Elemer_, Jun 22 2001 %E A061790 Definition corrected by _Robert Israel_, Jun 26 2025