<jupyter_start><jupyter_text>Recursive Digit Sum![image](https://user-images.githubusercontent.com/50367487/86590552-c8b7a900-bfca-11ea-8a07-3b25157195ac.png)<jupyter_code>#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the superDigit function below.
def recursive(s):

    if len(s) == 1:
        return s

    ans = sum(int(i) for i in s)

    return recursive(str(ans))

# Complete the superDigit function below.
def superDigit(n, k):

    ans = sum(int(i) for i in n)

    val = recursive(str(ans * k))

    return val

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    nk = input().split()

    n = nk[0]

    k = int(nk[1])

    result = superDigit(n, k)

    fptr.write(str(result) + '\n')

    fptr.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14180024660912455, 'fraction_numerical': 0.04808877928483354, 'mean_word_length': 3.4615384615384617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '524756', 'license': 'MIT', 'n_tokens_mistral': 349, 'n_tokens_neox': 311, 'n_words': 70, 'path': 'Interview Preparation Kit/13. Recursion and Backtracking/Recursive Digit Sum.ipynb', 'repo_name': 'Nam-SH/HackerRank', 'size': '811'}