Comment

Comment by joe24pack

I think I might be doing it wrong, because I didn't do any looping. I'm a bit too lazy and impatient for that, who wants to spend their afternoon adding all those numbers up even with a computer.

  [joe24pack@staropramen ~]$ python
  Python 2.6.6 (r266:84292, May  1 2012, 13:52:17) 
  [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> def gauss(x):
  ...   return (x+1)*(x/2)
  ... 
  >>> gauss(10)
  55
  >>> gauss(1000000000)
  500000000500000000
  >>>
parent joe24pack 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton