let
int(sqrt(n))=k
then
k<=sqrt(n)<k+1
k^2<=n<(k+1)^2
the perfect squares from 1 to 2016 are:
1^2,2^2,...,44^2
thus we can subdivide the summation as so
sum(k=1 to 44,sum(n=k^2 to (k+1)^21,(1)^n*k))
we can take the k out of the inner sum
sum(k=1 to 44,k*sum(n=k^2 to k(k+2),(1)^n)
several of the terms in the inner sum will cancel
if k is even then we get 1
if k is odd then we get 1
so the inner sum is simply (1)^k
so now we have
sum(k=1 to 44,k*(1)^k)
which can be computed by hand to be
22
finally, for k=44 we included too many values of n
so we need to make a final adjustment
for k=44 we let n range from 1936 to 2024
however the original sum stops at 2016
so we need to subtract the following sum
sum(n=2017 to 2024,44*(1)^n)
which turns out to be 0
thus the final answer is 22

Posted by Daniel
on 20160818 07:01:22 