def non_increasing(n_digit=100):
# a decreasing number can be obtained by reversing an increasing number
# to consider possible tailing zeros of a decreasing number, I dissect
# leading part of the coded binary strings into several cases:
# 0, 10, 110, 1110, 11110, ...
r = 8
ori = n_digit + 8
m = 1
total = 0
while ori >= 9:
cur = factorial(ori) / factorial(r) / factorial(ori-r)
total += (cur*m)
m += 1
ori -= 1
return total
评论列表
文章目录