Julia, 69 bytes
a,b=int(split(readline()));println(sum(setdiff(primes(b),primes(a))))
This reads a space-delimited pair of integers from STDIN and prints the result to STDOUT. The only thing I've really golfed here is whitespace; otherwise this is probably how I would go about it in a non-golfing context.
Ungolfed + explanation:
# Read a line from STDIN, split it into an array on the space, convert
# the elements to integers, and assign the first element to a and the
# second to b
a, b = int(split(readline()))
# Get the primes between a and b inclusive. primes(x) returns the primes
# <= x, so the set difference of primes(b) and primes(a) will get us only
# those between a and b
d = setdiff(primes(b), primes(a))
# Print the sum to STDOUT
println(sum(d))
Just realized how old this challenge is.
@st0le So seperated by spaces would be something like
2 3 5
and that would be ranges2 3
and3 5
? – jamylak – 2012-07-30T08:51:08.877@jamylak, you can assume the numbers will always appear in pairs. – st0le – 2012-07-30T09:47:17.327
@st0le Ahh ok I will change my solution – jamylak – 2012-07-30T09:48:13.020
The upper limit is too big to allow many interesting solutions (if they have to complete in reasonable time, at least). – hallvabo – 2011-01-28T09:13:34.800
@hallvabo You find inefficient solutions interesting? – Matthew Read – 2011-01-28T09:25:00.323
@hallvabo, That's ok. I don't think anyone minds an ineffcient solution. If other's object, i'll be more than happy to lower the limit – st0le – 2011-01-28T09:38:57.260
Just made and ran a not very optimised or concise version of the program in C#, using 1 to 10^8. Assuming my algorithm's correct, it ran in under 1m30s, and didn't overflow from a long. Seems like a fine upper limit to me! – Nellius – 2011-01-28T12:08:15.037
A quick easy check: sum of primes between 1 and 100 = 1060. – Nellius – 2011-01-28T12:50:26.253
@Matthew Read, You find inefficient solutions interesting? - you didn't specify effectiveness, so either specify, or decrease upper limit, or we will decrease it in our solutions. – Nakilon – 2011-01-28T17:39:34.140