0

For example if

X= 10 , Y= 3

2,3,5 and 1,4,6 are possible

However for Y=10 This is not possible as we know we can't represent 10 as sum of 10 distinct positive integers. Is there a more specific way to get the results?

Ankit Dwivedi
  • 95
  • 1
  • 1
  • 9
  • 1
    I'm voting to close this question as off-topic because it is a mathematics question, not a computer programming question. – Raymond Chen Oct 28 '18 at 14:25

1 Answers1

1

Any X greater than or equal to S = 1 + 2 + ... + Y = Y*(Y+1)/2 can be so represented. Indeed,

X = 1 + 2 + ... + (Y-1) + (Y + X - S)

Any X smaller than S obviously cannot be.

Igor Tandetnik
  • 50,461
  • 4
  • 56
  • 85