Re:I wear your shirt
by icey on Wednesday November 25, 2009 @08:18AM
(#961047)
A REPL is nice too:
[ Parent
| on HN ]
Python:
reduce (operator.add, range(366))or
sum(range(366)) (sum (range 1 365))
assuming you defined these already; I have them in my utils library ;-) (defun range (start end)
(loop for x from start to end collecting x))
(defun sum (sequence)
(reduce #'+ sequence))didn't even think of that one! :)
Re:I wear your shirt
by karanbhangui on Wednesday November 25, 2009 @12:52PM
(#961519)
or plain math: n(n+1)/2
How quickly can you generalize the plain math formula to these sequences: http://www.research.att.com/njas/sequences/index.html