You are viewing a single comment's thread. Return to all comments →
C#
public static int superDigit(string n, int k) { long sum = 0; if (k > 1 || n.Length > 1) { for (int j = 0; j < n.Length; j++) { sum += Convert.ToInt32((n[j]).ToString()); } return superDigit((sum * k).ToString(), 1); } else { return (Convert.ToInt32(n) * k); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
C#