Let S1= 1,4,9,16,…,n^2 and S2=1,5,14,30,…,n(n+1)(2n+1)/6
Clearly the first sequence represents the squares of positive integers while the second their interim sums.
For what smallest value of n (excluding the trivial n=1) will the average of the first n squares be a square number itself?
clc
n=1;
sq=1;
sumsq=1;
numsq=1;
solct=0;
for i=1:1000000
avg=sumsq/numsq;
if avg==round(avg)
if round(sqrt(avg))^2==avg
fprintf('%6d %15d %10d %6d\n',n, sumsq, sumsq/numsq, sqrt(sumsq/numsq))
end
end
n=n+1;
sq=n^2;
sumsq=sumsq+sq;
numsq=n;
end
n sum of squares avg square
root
1 1 1 1
337 12814425 38025 195
65521 93762728983561 1431033241 37829
so, excluding the trivial case of n = 1, we have the sum of the average of the first 337 squares is 38025 = 195^2.
The next case is the average of the first 65521 squares is 1431033241 = 37829^2.
|
Posted by Charlie
on 2023-11-15 11:32:53 |