search for: sumdigit

Displaying 1 result from an estimated 1 matches for "sumdigit".

Did you mean: sumdigits
2009 Dec 19
4
expand.grid game
Dear list, In a little numbers game, I've hit a performance snag and I'm not sure how to code this in C. The game is the following: how many 8-digit numbers have the sum of their digits equal to 17? The brute-force answer could be: maxi <- 9 # digits from 0 to 9 N <- 5 # 8 is too large test <- 17 # for example's sake sum(rowSums(do.call(expand.grid, c(list(1:maxi),