login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A061786 Number of distinct sums i^2 + j^2 for 1<=i<=j<=n. 4

%I #13 Oct 17 2023 15:11:19

%S 1,3,6,10,15,21,27,34,42,52,61,72,83,94,108,122,135,151,165,183,200,

%T 218,234,254,275,296,317,339,361,387,409,434,460,484,512,542,570,598,

%U 627,661,689,722,753,784,821,854,888,925,960,998,1036,1075,1109,1148

%N Number of distinct sums i^2 + j^2 for 1<=i<=j<=n.

%H Alois P. Heinz, <a href="/A061786/b061786.txt">Table of n, a(n) for n = 1..1000</a>

%e 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.

%p b:= proc(n) b(n):= {seq(n^2+i^2, i=1..n)} end:

%p s:= proc(n) s(n):= `if`(n=0, {}, b(n) union s(n-1)) end:

%p a:= n-> nops(s(n)):

%p seq(a(n), n=1..100); # _Alois P. Heinz_, May 07 2014

%t f[x_] := x^2 Table[Length[Union[Flatten[Table[f[u]+f[w], {w, 1, m}, {u, 1, m}]]]], {m, 1, 75}]

%o (Python)

%o 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

%Y Cf. A000217.

%K nonn

%O 1,2

%A _Labos Elemer_, Jun 22 2001

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)