You are viewing a single comment's thread. Return to all comments →
BigInteger mult = new BigInteger("1"); BigInteger sum = new BigInteger("0"); for (int i = 2; i <= num; i++) { mult = mult.multiply(new BigInteger(String.valueOf(i))); } String sMult = String.valueOf(mult); for (int i = 0; i < sMult.length(); i++) { String arg = String.valueOf(sMult.charAt(i)); sum = sum.add(new BigInteger(arg)); } System.out.println(sum);
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #20: Factorial digit sum
You are viewing a single comment's thread. Return to all comments →
java