In this article ❧ Procurement decisions routinely arrive in fractional units — partial cases, split shipments, mixed-number quantities — and comparing two such orders requires more than intuition. The arithmetic is simple in principle, but only if the fractions share a common denominator and mixed numbers have been properly unpacked before the comparison begins. This article walks through the full chain: business problem transformation, step-by-step fraction arithmetic with a practical LCD shortcut, two Python implementations (pure and standard-library), a mathematical background note, and a reusable XML skill that packages the entire workflow.
The Business Problem
Two purchasing managers are restocking inventory for an upcoming product launch. The operations manager placed orders for 7/8 of a case of wireless earbuds and 3/4 of a case of phone chargers. The marketing manager placed a single order for 1½ cases of branded accessories. Each case holds 16 units. Which manager ordered more inventory in total, and by how many units?
- a) The marketing manager, 10 units
- b) The operations manager, 2 units
- c) The operations manager, 10 units
Click to Reveal the Answer
Correct Answer: b) The operations manager, 2 units ✅
Math Structure Preserved
This problem exercises addition of unlike fractions (7/8 + 3/4, using LCD = 8), mixed-number conversion (1½ expressed as an improper fraction), and unit conversion by multiplication (each fractional case total multiplied by 16).
Why This Math Matters for Procurement
Purchasing and inventory decisions rarely arrive in whole numbers. Suppliers quote partial cases, contracts specify fractional quantities, and reorder points are calculated from usage rates that produce fractions. A purchasing manager who cannot add unlike fractions accurately will miscount total inventory ordered, triggering either stockouts or excess carrying costs. In this scenario, comparing two managers' orders requires converting mixed fractional quantities to a common unit before any comparison is meaningful — exactly the kind of calculation that appears in procurement dashboards, warehouse management systems, and supply chain audits.
The LCD shortcut — reusing the larger denominator when one denominator divides evenly into the other — is not just a classroom trick. In practice it eliminates one arithmetic step from every such comparison, and across hundreds of SKUs and purchase orders that saving compounds into measurable time gains for operations teams.
Python Version — Option 1: Pure Python
The following script mirrors the arithmetic exactly: it finds the LCD using
math.gcd, adds the fractions, converts the mixed number, scales both
totals to units, and prints a plain-language comparison. Every step is explicit,
making the code readable as a teaching tool as well as a working calculator.
def compare_inventory_orders(num1, den1, num2, den2, whole, num3, den3, units_per_case):
from math import gcd
def add_fractions(n1, d1, n2, d2):
common = d1 * d2 // gcd(d1, d2)
total_num = n1 * (common // d1) + n2 * (common // d2)
return total_num, common
ops_num, ops_den = add_fractions(num1, den1, num2, den2)
mkt_num = whole * den3 + num3
mkt_den = den3
ops_units = ops_num * units_per_case // ops_den
mkt_units = mkt_num * units_per_case // mkt_den
return ops_units, mkt_units
print("=== Inventory Order Comparison ===")
print("Enter the operations manager's two fractional case orders.")
num1 = int(input(" Order 1 numerator: "))
den1 = int(input(" Order 1 denominator: "))
num2 = int(input(" Order 2 numerator: "))
den2 = int(input(" Order 2 denominator: "))
print("Enter the marketing manager's order as a mixed number.")
whole = int(input(" Whole part: "))
num3 = int(input(" Fraction numerator: "))
den3 = int(input(" Fraction denominator: "))
units_per_case = int(input("Units per case: "))
ops, mkt = compare_inventory_orders(num1, den1, num2, den2, whole, num3, den3, units_per_case)
diff = abs(ops - mkt)
winner = "Operations manager" if ops > mkt else "Marketing manager"
print(f"\nOperations manager total: {ops} units")
print(f"Marketing manager total: {mkt} units")
print(f"Winner: {winner} ordered more — difference: {diff} units")
Paste this block into a Python interactive session in Windows Terminal, enter each value when prompted, and the script returns both managers' unit totals plus the winner and margin — reusable for any case size or fractional quantity.
Python Version — Option 2: fractions.Fraction
fractions.Fraction from the Python standard library handles all
denominator logic internally and guarantees exact arithmetic — no manual LCD
calculation, no risk of integer rounding errors. This version is preferable when
inputs may include larger or less predictable denominators, or when the code
will be maintained by analysts unfamiliar with manual fraction reduction.
from fractions import Fraction
def compare_inventory_orders(order1, order2, mixed_order, units_per_case):
ops_total = order1 + order2
ops_units = ops_total * units_per_case
mkt_units = mixed_order * units_per_case
return int(ops_units), int(mkt_units)
print("=== Inventory Order Comparison ===")
print("Enter the operations manager's two fractional case orders.")
num1 = int(input(" Order 1 — numerator: "))
den1 = int(input(" Order 1 — denominator: "))
num2 = int(input(" Order 2 — numerator: "))
den2 = int(input(" Order 2 — denominator: "))
print("Enter the marketing manager's order as a mixed number.")
whole = int(input(" Whole part: "))
num3 = int(input(" Fraction — numerator: "))
den3 = int(input(" Fraction — denominator: "))
units_per_case = int(input("Units per case: "))
order1 = Fraction(num1, den1)
order2 = Fraction(num2, den2)
mixed_order = whole + Fraction(num3, den3)
ops, mkt = compare_inventory_orders(order1, order2, mixed_order, units_per_case)
diff = abs(ops - mkt)
winner = "Operations manager" if ops > mkt else "Marketing manager"
print(f"\nOperations manager total: {ops} units")
print(f"Marketing manager total: {mkt} units")
print(f"Winner: {winner} ordered more — difference: {diff} units")
Both options produce identical output for this problem. Option 2 is the recommended choice for production use due to its built-in exactness and simpler function body.
Mathematical Background
This problem combines two foundational arithmetic skills. The first is addition of unlike fractions: fractions can only be added when they share a common denominator. A practical shortcut worth internalizing is that when one denominator is already a multiple of the other — as 8 is a multiple of 4 — you can simply reuse the larger denominator as the common denominator, converting only the fraction with the smaller one (3/4 → 6/8). No separate LCD calculation is needed, and no new number is introduced at all. This is what makes the shortcut a transferable insight rather than a one-off trick: any time you spot the divisibility relationship, you can skip straight to conversion.
The second skill is reading mixed numbers flexibly. The quantity 1½ is not a single fixed form. You can think of it as "1 and ½" — the natural language anchor and the best place to start before any formal manipulation. From there it becomes 3/2 as an improper fraction, 6/4 when scaled by 2, and 12/8 when scaled by 4. All four representations name exactly the same quantity. Moving fluidly between them — and choosing the form that shares the denominator already in play (12/8 here) — eliminates an extra conversion step and keeps the arithmetic compact.
A useful conceptual fact: the requirement that fractions share a denominator before addition reflects that you cannot combine quantities measured in different-sized parts. Adding 7 eighths to 6 eighths is no different from adding 7 apples to 6 apples — the unit must match first.
The Reusable XML Skill: inventory-order-comparator
The skill document below packages the entire workflow — inputs, arithmetic stages, output format, and example trigger prompts — into a structured XML file that can be loaded into a Claude skill library and invoked by non-technical users without knowledge of the underlying Python.
<?xml version="1.0" encoding="UTF-8"?>
<skill>
<metadata>
<name>inventory-order-comparator</name>
<description>
Compares two managers' fractional inventory orders, converts totals to
individual units, and identifies which manager ordered more and by how much.
Trigger this skill whenever the user wants to compare fractional or mixed-number
quantities, convert case-based orders to unit counts, or determine a procurement
winner from partial-case inputs — even if they don't use technical language.
</description>
</metadata>
<dependencies>
<dependency>
<name>math.gcd</name>
<source>Python standard library</source>
<role>Computes the greatest common divisor to find the least common
denominator when adding unlike fractions — Option 1 only.</role>
</dependency>
<dependency>
<name>fractions.Fraction</name>
<source>Python standard library</source>
<role>Handles exact fraction arithmetic without manual denominator
logic — Option 2 only. Eliminates floating-point rounding errors.</role>
</dependency>
</dependencies>
<inputs>
<input id="1">
<label>Operations manager — Order 1</label>
<format>Two integers: numerator and denominator (e.g., 7 and 8)</format>
</input>
<input id="2">
<label>Operations manager — Order 2</label>
<format>Two integers: numerator and denominator (e.g., 3 and 4)</format>
</input>
<input id="3">
<label>Marketing manager — Mixed-number order</label>
<format>Three integers: whole part, numerator, denominator (e.g., 1, 1, 2)</format>
</input>
<input id="4">
<label>Units per case</label>
<format>One integer (e.g., 16)</format>
</input>
</inputs>
<steps>
<step id="1">
<title>Receive Inputs</title>
<instruction>
Prompt the user for each input in order: Order 1 numerator and denominator,
Order 2 numerator and denominator, the marketing manager's whole part and
fraction numerator and denominator, and the number of units per case.
Store all values as integers. Display a short heading that names the
business scenario before prompting begins.
</instruction>
</step>
<step id="2">
<title>Add the Operations Manager's Two Fractional Orders</title>
<instruction>
Find the least common denominator (LCD) of the two order fractions.
Check whether one denominator divides evenly into the other — if so,
the larger denominator is already the LCD and no new number is needed.
Convert both fractions to the LCD, then add their numerators.
The result is the operations manager's total order expressed as a
single fraction.
</instruction>
</step>
<step id="3">
<title>Convert the Marketing Manager's Mixed Number</title>
<instruction>
Express the mixed number as an improper fraction: multiply the whole
part by the denominator and add the numerator. The result is the
marketing manager's total order as a single fraction over the original
denominator.
</instruction>
</step>
<step id="4">
<title>Convert Both Totals to Units</title>
<instruction>
Multiply each fractional total by the number of units per case.
Perform the multiplication as integer arithmetic (numerator times
units per case, then divide by the denominator) to avoid any
floating-point error. The result for each manager is a whole number
of units.
</instruction>
</step>
<step id="5">
<title>Compare and Report</title>
<instruction>
Subtract the smaller unit total from the larger one to find the
difference. Identify the manager with the higher total as the winner.
Print both totals, identify the winner by role name, and state the
difference in units. If totals are equal, report a tie instead.
</instruction>
</step>
</steps>
<output>
<format>Printed to terminal — three lines</format>
<line id="1">Operations manager total: [N] units</line>
<line id="2">Marketing manager total: [N] units</line>
<line id="3">Winner: [Role] ordered more — difference: [N] units</line>
</output>
<example_trigger_prompts>
<prompt>"Compare how much inventory each manager ordered and tell me who ordered more."</prompt>
<prompt>"I have two partial-case orders from different teams — which one is larger?"</prompt>
<prompt>"Convert these fractional case quantities to units and find the difference."</prompt>
<prompt>"One manager ordered 7/8 and 3/4 of a case, the other ordered 1½ — who wins?"</prompt>
<prompt>"Run the inventory order comparison for 16 units per case."</prompt>
</example_trigger_prompts>
<quality_checks>
<check>No Python code appears anywhere in this document.</check>
<check>Every step reads as a natural-language instruction, not a code comment.</check>
<check>Fraction addition logic preserves the LCD shortcut noted in the math breakdown.</check>
<check>Mixed-number conversion is explicit and complete.</check>
<check>Inputs and outputs are clearly named, typed, and described.</check>
<check>The description would trigger this skill from a non-technical user prompt.</check>
</quality_checks>
</skill>