I need to be able to take a given integer and calculate which "1000 range" it belongs to. For example: for the input 13456, the output should be "13000-13999". Another example: the input is 100234; the output is "100000-100999".
One solution is this answer. However, I would like to avoid hard coding the ranges to allow it to scale automatically.