The following question was asked today as part of a friendly coding competition at Europython.
Find the sum of the digits in the number 1000! (! -> factorial)
Bonus points were awarded for "the shortest one liner possible". Here at the conference, it is somewhat implied that we'd be using Python, but feel free to use your favorite language.

Here's my submission, can anyone do better?
sum([int(x) for x in iter(str(math.factorial(1000)))])
PS: If you don't know how to write one liners, you can still participate in the exercise; it's good practice!
Again, in AutoIT:
$product = 1
Dim $a
For $a = 1 to 65 Step 1
   $product = $product * $a
Next
Dim $sum
$b = 1
For $b = 1 To StringLen(String($product)) Step 1
   $sum = $sum + Int(StringRight(StringLeft(String($product),$b),1))
Next
MsgBox(0,"SUM",$sum)
Can only get to 65 before address limitation kicks in...

NOTE: AutoIT is very BASIC-like. With a few modifications (or none), you could get this code running in BASIC.
Ruby doesn't have either a built-in methods for sum or factorial, but it's not too bad even without those:
(1..1000).inject(:*).to_s.chars.inject(0) { |sum, char| sum + char.to_i }
The variable names in the last block could be shorter, but kept them long for clarity.
Total[IntegerDigits[1000!]]
rahmu wroteHere's my submission, can anyone do better?
sum([int(x) for x in iter(str(math.factorial(1000)))])
you can drop the iter() and the [ ], works as a generator expression.

edit: Since you're importing math, you might as well do this
from math import factorial as f
The end result would be
sum(int(x) for x in str(f(1000)))
and an even shorter one
sum(map(int,str(f(1000))))
That's one character longer than geeks!
Matlab:
sum(char(num2str(factorial(1000),'%10.0f'))-48)
@mesa177: good luck with fitting that into memory! by the way, it computes a different sum.
geek wroteby the way, it computes a different sum.
you're right, I misread the problem, I'll edit it
@xterm
You're right:
from math import factorial 
print sum(map(int,list(str(factorial(1000)))))
I think there's similar problems back at Project Euler
By the way no one posted the solution sum, i think it is 10539.
What makes a coding competition friendly or not?
arithma wroteWhat makes a coding competition friendly or not?
No prizes maybe?
@arithma: No real prizes, no real rules, just a bunch of geeks hacking away.

(technically the winner got a Mac Book, but honestly no one really cared about "winning".
As a matter of facts, nobody managed to get all the answers right, and a few of us stayed up late way after the deadline looking for the solutions.

For the curious here's the original post. The page went online at 9pm, which left us with 2h to answer. Feel free to try it, I'd love to discuss the solutions you come up with.

The core of the problem was about computing some large prime numbers. It's prompting me to write a small article about it. I'll update this post once I've published it.

@geek: If you want to try the challenge, avoid using Mathematica.

@NuclearVision: 10539 is correct.
My solution for B ( the second problem):
def divlist(n):
    app = []
    for i in xrange(1,n+1):
        if n%i == 0:
            app.append(i)
    return app
def isPrime(n):
    if divlist(n) == [1,n]: #I did not consider 1 as a prime, otherwise i could have added in this line 'or divlist(n)==[1]'
        return True
    else: 
        return False
def find(n):
    app2 = []
    i=0
    while True:
        i+=1
        if isPrime(i)==True:
            app2.append(i)
        if len(app2)==n:
            break
    return app2[n-1]
@rahmu your F counted 54 char, the winner's F counter 55 :D
@NuclearVision: both my solution and the ones presented by xterm lack the proper imports first. They would not qualify. BTW, the shortest one-liner was found by somebody here after the deadline. It's similar to one of xterm's solution and is 51 character long:
import math;sum(map(int,'%s'%math.factorial(1e3)))
I answered correctly to A and C, made a stupid mistake in B that I corrected a few hours after the competition was over. I cannot believe anyone got the answer to E.

What's the result you get for B?

EDIT: I ran your code. It yields the correct result but took over 11mins on my laptop to compute. Read the article I link to below to see how you can improve your solution.

@everyone: I wrote this small article on what I learned yesterday about calculating primality. I'd love to get some feedback.
I was able to improve my code, finding the a-solution prime took like 8 minutes on my netbook(1gbram, 1.6Ghz cpu), if i am not mistaken this prime is 111043.
from time import time as t
def divlist(n):
	app = []
	for k in xrange(1,int((n/2)+1)):
		if n%k==0:
		    app.append(k)
	app.append(n)
	return app
def isPrime(n):
    if divlist(n) == [1,n]: #I did not consider 1 as a prime
        return True
    else: 
        return False
def find(n):
    t1 = t()
    app2 = [2]
    i=1
    while True:
        i+=2
        if isPrime(i)==True:
            app2.append(i)
        if len(app2)==n:
            break
    t2 = t()
    return str(app2[n-1]) +" "+ str(t2-t1)
print find(10539)
What have i done?:
I simplified half calculations in the divlist function, by limiting the divisors search domain between 1,and n/2.
Because a number n have no divisors that are >n/2.
Again I simplified the calculations in find function, by adding 2 instead of one for each loop, in fact there's no two consecutive primes, if we have a prime number n, k=n+1 is not prime it is, no doubt, divisble by 2,
(Between two consecutive numbers, one is even valued), thus it is not necessary to add 1 in each loop.
2 years later
I did a very similar one in Project Euler a while ago.
import functools
import operator

i=1000
li=[]
lii=[]

for n in range(0, 1000):
    li.append(i-n)	

def product(li):
    return functools.reduce(operator.mul, li)
 
for n in str(product(li)):
    lii.append(int(n))
	
print sum(lii)
Feel free to point out my bad habits. Thanks !
Hello adnan, why did you use for loop lines 8-9, it is useless, you could do li=range(1,1001) to compute the factorial. Also python has a built in factorial function: math.factorial instead of product(li)
Also instead of importing operator you could use lambda x,y:x*y for mul, lambda comes handy often in python 2.
Also I don't think you need to import reduce (?) at least in python 2. Correct me if wrong.
Cordially.
Well I don't know why I got the beginner's habit of excessive usage of lists and loops, I will have to work that out.

Thanks for pointing out the other self-complications too, sadly I'm not aware of all the available tools in Python. I've came across people using lambda but I still don't understand how to use it, I'll read some docs / tutorials to learn it (and lots of "yield" here and there, not sure what that is yet, but the word is catchy).
Range(1,1001)=[1,...,1000] you don't wanna start with 0.
most of python tools are easy to define and use.
I had problems with lambda and yield too when I began with python but good lebgeeks helped me out.
Actually lambda is pretty easy tool in python yet so useful,
Let's say you want to reduce a list while summing its elements you would need to call reduce(function,list)
and you would need to define a function add(x,y): return x+y but this function is not so important. That's why we use lambda on the go to define less important functions inside the reduce function. ex: reduce(lambda x,y: x+y, list) instead of:
def add.... Reduce(add, list).
As for yield I also faced problems with it and got helped here :].
Let's say you want to write a function that detects even numbers from 1 to 20 and adds them to a list:
 def f():
    li=[]
    for i in xrange(1,21): #xrange is range equivalent but it is more compact because it calls its elements only
        if i%2==0:            # when needed and does not store them.
            li.append(i)
    return li
here is an equivalent example using yield function
def f2():
    for i in xrange(1,21):
        if i%2==0:
           yield i
Like you noticed, yield tells the function to initialize a generator object(like a list) and if the condition is fulfilled the yield var will add var to the generator and the function will return the generator after the loop ends, you don't need to tell the function to return the generator.
Generators are objects that can be transformed into lists easily to manipulate them and do things like summing, reducing... Doable to lists as follows : for this example listevennumbers=list(f2())
If you have any problem let me know i'd be more than happy to help :]
C#:
long a = 0, r = 0;
for (int i = 1; i < 1001; i++) r = r * i;
for (int i = 0; i < r.ToString().Length; i++) a += r.ToString()[i];