login
a(n) = Sum_{i=1..n} i^2*(-1)^ceiling(sqrt(i)).
1

%I #16 Jan 23 2026 21:27:28

%S -1,3,12,28,3,-33,-82,-146,-227,-127,-6,138,307,503,728,984,695,371,

%T 10,-390,-831,-1315,-1844,-2420,-3045,-2369,-1640,-856,-15,885,1846,

%U 2870,3959,5115,6340,7636,6267,4823,3302,1702,21,-1743,-3592,-5528,-7553,-9669,-11878,-14182,-16583,-14083

%N a(n) = Sum_{i=1..n} i^2*(-1)^ceiling(sqrt(i)).

%C If n is of the form k^2+k-1 where k is some positive integer then abs(a(n)) is a triangular number (A000217).

%t a[n_]:=Sum[i^2*(-1)^Ceiling[Sqrt[i]],{i,n}]; Array[a,50] (* _Stefano Spezia_, Jan 19 2026 *)

%o (PARI) a(n) = sum(i=1, n, if (ceil(sqrt(i)) % 2, -i^2, i^2)); \\ _Michel Marcus_, Jan 19 2026

%Y Cf. A000290, A000217, A392243.

%K sign,easy

%O 1,2

%A _Dwight Boddorf_, Jan 19 2026