def cube_root(x):
"""Required because the usual x ^ 1/3 does not work with big integers."""
decimal.getcontext().prec = 2 * len(str(x))
power = decimal.Decimal(1) / decimal.Decimal(3)
x = decimal.Decimal(str(x))
root = x ** power
integer_root = root.quantize(decimal.Decimal('1.'), rounding=decimal.ROUND_DOWN)
return int(integer_root)
# Taken from Hal Finney's summary at https://www.ietf.org/mail-archive/web/openpgp/current/msg00999.html,
评论列表
文章目录