Skip to content

Instantly share code, notes, and snippets.

@bhuber
Created August 24, 2012 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhuber/3445093 to your computer and use it in GitHub Desktop.
Save bhuber/3445093 to your computer and use it in GitHub Desktop.
pyler 26
def repeat(n):
rems = [0] * n
rem = 1
num = rem
result = ''
while True:
num *= 10
rems[rem] = 1
quot = num / n
if quot > 0:
result += str(quot)
rem = num % n
if rem == 0 or rems[rem] == 1:
break
num = rem
else:
result += '0'
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment