I'm writing a program in ASP.NET/C# that reads data from a database and then graphs it. But one of the biggest problems is when the difference between the maximum number and minimum number is a prime number. The difference is the actual range of data that will be displayed on the graph.

If you have a max of 10 and a min of 2 then the difference is 8. So you can divide evenly: [2, 4, 6, 8]

But if you have a max of 10 and a min of 3 the difference is 7, a prime number.

The ONLY even way to do it is to take the min, the middle, and the max [3, 6.5, 10]. Which is okay for smaller numbers but what if the difference were 97 (also a prime number)? Then we would only have 3 numbers for that entire range. But I want more than 3 numbers for larger prime numbers.

Another option is to simply use floating point numbers and round somewhere right of the decimal point. But what if you are dealing with years? Then your digits right of the decimal point would be days and months instead of number. I'm just not sure if that would look very pretty. Imagine a range of 2002-2100 that had lables like 12/2009, 3/2020, 5/2051, etc. At that point the months are kind of irrelevent but they are still required in order to produce an accurate graph. What would be nicer is if there were a way to use only years.

One option that ALMOST works is if the difference between the middle number and the start or end number is odd. Then you can set that as the center and keep repeating that on each side until you have as many columns as you can fit. Unfortunately that only works with odd numbers.

So I am stuck just using a min, mid, and max column when trying to divide a prime number. Does anyone know of a better way of evenly dividing a prime number???