-
MathType
-
WirisQuizzes
-
LearningLemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
How to generate a division with no remainder (exact division)
Reading time: 1minWhen to use this: Use this method when you want students to perform a division and ensure that the result is always an exact integer (no decimals or remainders).
What you'll achieve: You will generate two integers (dividend and divisor) such that the division always produces a whole number result.
See it in action: Watch how this logic is implemented inside LearningLemur:
Before you begin
Requirements
- Basic knowledge of how to create a LearningLemur question
- Familiarity with adding an algorithm to generate random variables
Steps
Select a divisor
div = random(2,12)This defines the divisor and avoids trivial cases like division by 1.
Select a quotient
quot = random(2,10)This defines the exact integer result students should obtain.
Compute the dividend
dividend = div * quotMultiplying the divisor and quotient yields a dividend that guarantees exact division.
Define the solution
solution = quotThis value can be used directly for grading.
Verify it worked
- Preview the question multiple times
- Divide the generated dividend by the divisor manually
- Confirm that the result is always an integer
- Ensure no decimal answers appear
Full algorithm (copy-paste version)
Use the complete version below if you want to copy the logic directly into your question algorithm:
# Select a random divisor from 2 to 12
div = random(2,12)
# Choose a random integer quotient between 2 and 10
quot = random(2,10)
# Compute dividend ensuring exact division
dividend = div * quot
# Students perform the division
solution = quotOptions and variations
- If you want larger numbers, you can increase the intervals for
divandquot, but verify readability for students - If you want to include negative results, you can allow negative values in the quotient range
- If you want to control difficulty, you can use prime divisors for easier mental calculation, or larger composite divisors for more complexity
Common errors
Unexpected decimal results
Ensure the dividend is defined as div * quot and not randomly generated
Division by zero error
Confirm the divisor interval excludes 0 (already handled in this example)
Trivial exercises (division by 1)
Adjust the divisor interval to avoid overly simple cases