Does anyone have a good solution for dividing evenly into prime numbers?
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 range and minimum range 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 ther difference were 97 (also a prime number)? Then we would only have 3 numbers for that entire range. But I want more than 3 labels for larger prime numbers. Another option is to simply use doubles 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. I'm just not sure if that would look very pretty.
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???
Re: Does anyone have a good solution for dividing evenly into prime numbers?
Duplicate of Does anyone have a good solution for dividing evenly into prime numbers?. Thread closed.
Please do not create the same thread more than once.
|All times are GMT +5.5. The time now is 02:22.|