Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> “How can you sum the numbers from 1 to 10 without using a loop?”

Sum = n(n+1)/2



Yeah, I assume it's missing some context that the numeric solution was off the table.


When all you know is hammers, all you can think of are nails. Screws are impossible to use and understand. How are you supposed to hammer in a screw? All those ridges are in the way!


I remember being amazed when I learnt about summing arithmetric series.


Not even Erlang can beat Gauss




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: