A174070 Numbers that can be written as a sum of at least 3 consecutive squares.
14, 29, 30, 50, 54, 55, 77, 86, 90, 91, 110, 126, 135, 139, 140, 149, 174, 190, 194, 199, 203, 204, 230, 245, 255, 271, 280, 284, 285, 294, 302, 330, 355, 365, 366, 371, 380, 384, 385, 415, 434, 446, 451, 476, 492, 501, 505, 506, 509, 510, 534, 559, 590, 595
Offset: 1
Keywords
Examples
14 = 1^2 + 2^2 + 3^2, 29 = 2^2 + 3^2 + 4^2. 30 = 1^2 + 2^2 + 3^2 + 4^2, 50 = 3^2 + 4^2 + 5^2.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
N:= 1000: # to get all terms <= N R:= [seq(b*(b+1)*(2*b+1)/6, b=0..ceil(sqrt(N/3)))]: sort(convert(select(`<=`, {seq(seq(R[i]-R[j],j=1..i-3),i=1..nops(R))},N),list)); # Robert Israel, Jul 18 2017
-
Mathematica
max=50^2;lst={};Do[z=n^2+(n+1)^2;Do[z+=(n+x)^2;If[z>max,Break[]];AppendTo[lst,z],{x,2,max/2}],{n,max/2}];Union[lst] (* Second program: *) Function[s, Function[t, Union@ Flatten@ Map[TakeWhile[#, # < t[[1, -1]] &] &, t]]@ Map[Total /@ Partition[s, #, 1] &, Range[3, Length@ s]]][Range[16]^2] (* Michael De Vlieger, Jul 18 2017 *) Module[{nn=30,sq},sq=Range[nn]^2;Take[Union[Flatten[Table[Total/@ Partition[ sq,n,1],{n,3,nn-2}]]],2nn]] (* Harvey P. Dale, Nov 16 2017 *)
Comments