- #1
Grep
- 298
- 3
I'm not sure at all how best to approach this problem. Basically, the application is for practicing mental arithmetic. Most of the features are pretty easy, with the exception of division, which is the topic here.
I accept a minimum and maximum for the first and last numbers in the division. I haven't gotten to decimal points and fixed point yet. There will be a checkbox for "Integer results only", which would be my default until I implement fixed point. And that adds a wrinkle in for which I've not found a graceful answer.
Keep in mind the configuration values for the problem generation are open to change, so if that makes it much easier, that's a possibility. Possibly, not providing min/max for both values in the division might make it easier.
Given the allowed ranges for the first and last values of the division, I need to first make sure those values work. It's quite possible to enter values which means there are no possible integer results. For example, firstMin=3, firstMax=5, lastMin=3, lastMax=5. Clearly, nothing between 5 and 3 is divisible by any number between 5 and 3.
Beyond that, I'm not sure what the best way is to generate these numbers. Roots with integer results were so much easier. I can't think of a way without checking divisibility of the first number by every possible second number. Not sure it's even possible.
Any thoughts? Opinions greatly appreciated! I'd like to move on to implementing fixed point, state saving and graphs.
I accept a minimum and maximum for the first and last numbers in the division. I haven't gotten to decimal points and fixed point yet. There will be a checkbox for "Integer results only", which would be my default until I implement fixed point. And that adds a wrinkle in for which I've not found a graceful answer.
Keep in mind the configuration values for the problem generation are open to change, so if that makes it much easier, that's a possibility. Possibly, not providing min/max for both values in the division might make it easier.
Given the allowed ranges for the first and last values of the division, I need to first make sure those values work. It's quite possible to enter values which means there are no possible integer results. For example, firstMin=3, firstMax=5, lastMin=3, lastMax=5. Clearly, nothing between 5 and 3 is divisible by any number between 5 and 3.
Beyond that, I'm not sure what the best way is to generate these numbers. Roots with integer results were so much easier. I can't think of a way without checking divisibility of the first number by every possible second number. Not sure it's even possible.
Any thoughts? Opinions greatly appreciated! I'd like to move on to implementing fixed point, state saving and graphs.