# Maths behind itertools combinations with replacement

I need to find the total number of arrays using n and k inputs.. n=int(input()) k=int(input() N denotes the maximum number range of array elements K denotes the length of array I need to find all possible arrays using the inputs N and K a[1],a[2],a[3],... a[k] where every number a[i] is in range from 1 to N and moreover a[i+1] should be divisible by a[i] where 1< i <= K Sample case : n=2 k=2 output : [1,1], [1,2], [2,2] [2,1] is invalid because a[i+1] is not divisible by a[i] so total number of arrays are 3 ------------------------------------------------------------------------ without caring the condition [a+1] % a[i] = 0 I use itertools.combinations_with_replacement in my code and using formula I found out the total number of possible arrays. formula : k+(n-1)! ---------------- k! (n-1)! I used formula because when we use bug nunbers as input N and K then time complexity increases.. I need formula for condition also a[i+1] % a[i]