ordered factorization including 1 as a factor


An ordered factorization of a positive integer is the factorization of the number with the factors in order, for example, 8 = 2* 4, then the pairs (2,4) and (4,2) are considered different. How many different 4-element pairs of ordered factorization are there in 100 (factors can include 1 and 100)?
e.g. 100 = 25 * 2 * 2 * 1 = 2 * 2 * 5 * 5 = 1 * 1 * 1 * 100, so pairs like (1,2,2,25),  (2,2,5,5) and (1,1,1,100) are among the required pairs.

Solution #1: Write a program to iterate thru all factors of 100 to get the result. There are 100 pairs:
 

cnt = 0
t = [1,2,4,5,10,20,25,50,100]
for i in t:
    for j in t:
        for k in t:
            for s in t:
                if i*j*k*s == 100:
                    cnt += 1
                    print("{} {} {} {}".format(i,j,k,s))
print("total: {}".format(cnt))

Solution #2: Use recurrence relation including factors 1 and 100

Let G(n,k) be the pair numbers of the given integer n including factors 1 and n, k be the number of elements in each pair, then G(n, k) = Sigma[G(d, k-1)] , 1<k<n, where d iterates through all the factors of n including the factor 1 and n.  G(n,1) = 1, G(1,n) = 1

By this recurrence relations, we can find the number of required ordered factorization pairs:

G(100,4) = G(1,3) +  G(2,3) + G(4,3) + G(5,3) + G(10,3) + G(20,3) + G(25,3) + G(50,3) + G(100,3)
G(1,3) = 1
G(2,3) = G(1,2) + G(2,2) = 1 + G(1,1) + G(2,1) = 1 + 1 + 1 = 3
G(4,3) = G(1,2) + G(2,2) + G(4,2) = 1 + G(1,1) + G(2,1) + G(1,1) + G(2,1) + G(4,1) = 6
G(5,3) = G(1,2) + G(5,2) = 1 + 2 = 3
G(10,3) = G(1,2) + G(2,2) + G(5,2) + G(10,2) = 1 + 2 + 2 + 4 = 9
G(20,3) = G(1,2) + G(2,2) + G(4,2) + G(5,2) + G(10,2) + G(20,2) = 1 + 2 + 3 + 2 + 4 + 6 = 18
G(25,3) = G(1,2) + G(5,2) + G(25,2) = 1 + 2 + 3 = 6
G(50,3) = G(1,2) + G(2,2) + G(5,2) + G(10,2) + G(25,2) + G(50,2) = 1 + 2 + 2 + 4 + 3 + 6 = 18
G(100,3) = G(1,2) + G(2,2) + G(4,2) + G(5,2) + G(10,2) + G(20,2) + G(25,2) + G(50,2) + G(100, 2) = 1 + 2 + 3 + 2 + 4 + 6 + 3 + 6 + 9 = 36
G(100,4) = 1 + 3 + 6 + 3 + 9 + 18 + 6 + 18 + 36 = 100

Solution #3: Use recurrence relation excluding factors 1 and 100

The #2 solution above is quite a tedious process because once we include 1 and n as factors, the number of pairs increased quickly. Now we use a recurrence relation excluding factors 1 and n.


Let H(n) be the pair numbers without factors 1 and n, k be the number of elements in each pair, then H(n, k) = Sigma[H(d, k-1)] , 1<k<n, where d iterates through all the proper factors of n excluding the factor 1 and n.

But, wait, in the problem we are allowed to use factors 1 and n. How can we calculate the pairs in this case which is definitely not H(n,k)? We can apply Dirichlet generating function (d.g.f) to help us:
In the d.g.f of Zeta[s]^k (Zeta[s] is the Riemann Zeta function), the coefficient of 1/n^s is the number of k-elment ordered factorization pairs with 1 and n allowed (also the result of k times Dirichlet convolutions of the constant arithmetic fuctions with value at n). In the d.g.f of (Zeta-1)^k, the coefficient of 1/n^s is the number of k-elment ordered factorization pairs with 1 and n NOT allowed (1<k<n). In the later case, coefficient of 1/n^s is H(n, k). So we can use H(n,k) to tackle the problem.

Zeta[s]^4 = [x + 1]^4 = 1 + 4 x + 6 x^2 + 4 x^3 + x^4  (let x=Zeta[s]-1)
the coefficient of x^4 d.g.f's term 1/100^s: H(100,4) = H(2,3) + H(4,3) + H(5,3) + H(10,3) + H(20,3) + H(25,3) + H(50,3) = 6  (ie. the permutations of 2*2*5*5)
the coefficient of x^3 d.g.f's term 1/100^s: H(100,3) = H(2,2) + H(4,2) + H(5,2) + H(10,2) + H(20,2) + H(25,2) + H(50,2) = 12 (ie. the permutations of 4*5*5, 2*10*5, 2*2*25)
the coefficient of x^2 d.g.f's term 1/100^s: H(100,2) = 7 (ie. the permutations of 2*50, 4*25, 5*20, 10*10)
the coefficient of x d.g.f's term 1/100^s: 1  (the definition of Zeta function, or the single element n as a factor if we allow k=1, but don't use the recurrence relation when k=1)

So the number of different 4-element pairs of ordered factorization in 100 with 1 and 100 as allowed factors is the coefficient of Zeta[s]^4 d.g.f's term 1/100^s, ie. 4*1 + 6*7 + 4*12 + 6 = 100.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值