Skip to content

Instantly share code, notes, and snippets.

@alacret
Created August 13, 2019 02:29
Show Gist options
  • Save alacret/11a90bab336a735757da05c7228d3846 to your computer and use it in GitHub Desktop.
Save alacret/11a90bab336a735757da05c7228d3846 to your computer and use it in GitHub Desktop.
def persistence(n):
i = 0
if len(str(n)) == 1:
return i
while len(str(n)) > 1:
i += 1
str_n = str(n)
list_n = list(str_n)
n = 1
for el in list_n:
n = n * int(el)
return i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment