To prove:
The sum of the first n even squares, less the sum of the first n squares, is equal to the nth square, plus the nth cube, plus the nth triangular number.
The sum of the first n odd squares, less the sum of the first n squares, is equal to the nth cube, less the nth triangular number.
sum1=0; sum2=0;tr=0;
for n=1:15
sum1=sum1+3*n^2;
tr=tr+n;
sum2=n^2+n^3+tr;
disp([sum1 sum2])
end
disp(' ')
sum1=0; sum2=0;tr=0;
for n=1:15
sum1=sum1+(2*n-1)^2-n^2;
tr=tr+n;
sum2= n^3-tr;
disp([sum1 sum2])
end
finds equal compares for both parts:
>> nonnEasyNice
3 3
15 15
42 42
90 90
165 165
273 273
420 420
612 612
855 855
1155 1155
1518 1518
1950 1950
2457 2457
3045 3045
3720 3720
0 0
5 5
21 21
54 54
110 110
195 195
315 315
476 476
684 684
945 945
1265 1265
1650 1650
2106 2106
2639 2639
3255 3255
They appear to be A059270 and A160378 in the OEIS, which describes each as nonn and easy.
|
Posted by Charlie
on 2022-11-23 11:20:15 |