login
A061786
Number of distinct sums i^2 + j^2 for 1<=i<=j<=n.
6
1, 3, 6, 10, 15, 21, 27, 34, 42, 52, 61, 72, 83, 94, 108, 122, 135, 151, 165, 183, 200, 218, 234, 254, 275, 296, 317, 339, 361, 387, 409, 434, 460, 484, 512, 542, 570, 598, 627, 661, 689, 722, 753, 784, 821, 854, 888, 925, 960, 998, 1036, 1075, 1109, 1148
OFFSET
1,2
LINKS
EXAMPLE
If the {s+t} sums are generated by addition 2 terms of an S set consisting of n different entries, then at least 1, 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. E.g. S={1,4,9,16,25,36,49} provides 27 different sums of two, not necessarily different squares: {2,5,8,10,13,17,18,20,25,26,29,32,34,37,40,41,45,50,52,53,58,61,65,72,74,85,98}_ Only a single sum arises more than once: 50=1+49=25+25. Therefore a(7)=(7*8/2)-1=27.
MAPLE
b:= proc(n) b(n):= {seq(n^2+i^2, i=1..n)} end:
s:= proc(n) s(n):= `if`(n=0, {}, b(n) union s(n-1)) end:
a:= n-> nops(s(n)):
seq(a(n), n=1..100); # Alois P. Heinz, May 07 2014
MATHEMATICA
f[x_] := x^2 Table[Length[Union[Flatten[Table[f[u]+f[w], {w, 1, m}, {u, 1, m}]]]], {m, 1, 75}]
PROG
(Python)
def A061786(n): return len({i**2+j**2 for i in range(1, n+1) for j in range(1, i+1)}) # Chai Wah Wu, Oct 17 2023
CROSSREFS
Cf. A000217.
Sequence in context: A240443 A033439 A194082 * A171971 A184009 A105334
KEYWORD
nonn
AUTHOR
Labos Elemer, Jun 22 2001
STATUS
approved