# Idea from doing some problems on brilliant.org

Look at this Pascal (pseudocode) program

  1 2 3 4 5 6 7 8 9 10 11 12 13 14  //This is a Pascal Pseudocode for i := 2 to 1000 do begin sum := 0; str(i,s); for j := 1 to length(s) do begin val(s[j],temp); inc(sum,temp*temp*temp) end; val(s,temp); if (sum = temp) then writeln(temp) end; 

Above is a Pseudocode of a program.
What is the sum of all the output of the temp variable ?

×