[ create a new paste ] login | about

Link: http://codepad.org/tQetnwvI    [ raw code | fork ]

C, pasted on Jan 10:
1
2
3
4
5
6
7
8
9
10
11
int additive_helper(int n, int count) {
  if(n<9) {
    return count;
  } else {
    return additive_helper(sum(digit(n)), count + 1);
  }
}

int additive(int n) {
  return additive_helper(n, 0);
}


Create a new paste based on this one


Comments: