Sorry if this question has been asked before but I couldn’t find a good match for what I am trying to do.
I am looking for an algorithm to do the below in C# (or relevant LINQ extensions).
Given a number within a set of numbers (e.g. 56 of 1 to 245) not excluding any numbers
and a partition size (e.g. 10)
I want to find the starting number for the partition that the given number is in.
Example:
Searching for the starting page of 56.
1-10
11-20
21-30
31-40
41-50
51-60 <-- 56 is in the partition starting with 51
..
231-240
241-245
1 Answer