The sum of c consecutive positive integers = c^2. Example, c=5: 3+4+5+6+7 = 25 ; 5^2 = 25 (last integer = 7) If c = 9999, what is the last integer? What is the last integer in terms of c?
Follow Math Help Forum on Facebook and Google+
Code: c:=9999: for n from 1 to 10000 do if sum(k,k=n..n+c-1)=c^2 then print(n+c-1); break; end if; end do; for , last integer = in terms of , last integer =
c:=9999: for n from 1 to 10000 do if sum(k,k=n..n+c-1)=c^2 then print(n+c-1); break; end if; end do;
Good one Princeps. Accidentally got that while fooling around with consecutive numbers. Had you seen the "easy formula" last integer = (3c - 1)/2 before? Amazing that there is a solution for ALL odd c's.
Last edited by princeps; April 11th 2012 at 05:47 AM.
View Tag Cloud