tnecsed's blog

By tnecsed, history, 3 years ago, In English

Hello everyone ! Currently, I am interested in counting the number of ways in which a number n can be written as the sum of k distinct numbers in increasing order such that every number is a natural number in the range {1,2,…,ℓ}. (ℓ<=n<=1e9, k<=5)

For example, with n=23 and ℓ=9 we have for the following values of k:

n=23,ℓ=9,k=7: There are zero ways as the smallest summation possible is 28.

n=23,ℓ=9,k=6: There are two ways, namely 1+2+3+4+5+8 and 1+2+3+4+6+7 n=23,ℓ=9,k=5: There are several ways, but I have difficulty counting them by hand

n=23,ℓ=9,k=4: There are several ways, but I have difficulty counting them by hand

n=23,ℓ=9,k=3: There is only one way, namely 6+8+9 n=23,ℓ=9,k=2: There are zero ways as the largest possible summation totals 17 if n>1000000 , I don't know how to solve this problem, so I would like to get your opinion . tks <3

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Nice task, where did you find it?