I have a positive integer X.
When I add all the positive integers from 1 to X, I get a result of YYY, where Y is a positive integer from 0 to 9.
What is X?
By the problem, we have:
X(X+1)/2 = YYY= 111*y
X(X+1) = 222*y = 2*3*37*y
So, either X or X+1 must be a multiple of 37
or, X =37*n or 37*n-1 ......(#)
Again X(X+1)/2 <1000
or, X(X+1) < 2000
since 44*45=1980, it follows that X<=44
The only probable values of X in consonance with (#l) are then 37 or 36
X=37 gives YYY = 37*38/2 = 703
X=36 gives: YYY = 36*37/2 = 666,
Amongst the two possibilities, only 666 is valid as a value of YYY.
Consequently, the required value of X is 36.
-------------------------------------------------------------------------------------------------------
Remembering that X(X+1)/2 gives the formula for triangular numbers, we could have done a bit of "cheating" and looked up Sloanes sequence A000217 at oeis.org, where 666 shows up as 37th entry. Knowing that A000217 consists of nonnegative values for X including 0, then X must be equal to 36.
Edited on June 4, 2022, 10:10 pm