Skip to content

Instantly share code, notes, and snippets.

@EvgeniGordeev
Created September 26, 2024 03:56
Show Gist options
  • Save EvgeniGordeev/37eb6bb5eadb64ba5de377c803f1b75e to your computer and use it in GitHub Desktop.
Save EvgeniGordeev/37eb6bb5eadb64ba5de377c803f1b75e to your computer and use it in GitHub Desktop.
1/998001
import decimal
import textwrap
# demo division 1/998001
decimal.setcontext(decimal.Context(prec=9999))
one = decimal.Decimal(1)
denom = decimal.Decimal(998001)
res = str(one/denom)
print(textwrap.fill(res, 100))
nums = textwrap.wrap(res[4:], 3)
print(nums)
to_num = [int(i) for i in nums]
print(sorted(to_num))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment