You are not logged in.
@john it's 10539, I solved it with python a year ago, in python variables are not declared I even remember printing the 1000!, it does not overflow as easily as C and its derivatives.
edit: John I studied your code and I think it's rather summing strings than integers.
I'm not sure but here is my hypotheses:
1000! In bigint is equal to a six digits number (due to overflow); you made a string out of this number then added it to a.
So if my hypotheses is true, if you do bigint r; then print r it should be something similar to 133xxx (the solution you have which I don't remember ).
Last edited by NuclearVision (April 27 2014)
in php...
array_sum(str_split(gmp_strval(gmp_fact(1000))));
@Johnaudi
You are summing the ascii value of the digits and not the digit itself.
Change
a += r.ToString()[i];
to
a = a + r.ToString()[i] - 48;
48 is the ascci value of 0, the others are 49,50,etc...
@ra8 hello friend!
Don't strings sum up in c#?
@ra8 hello friend!
Don't strings sum up in c#?
Those are characters that he's adding up, not strings.
check http://ideone.com/hLUqOb
Ok cool, thanks for helping us! now I know c# is really different from c++.