Skip to content

Quotient ​

The integer quotient of mm by nn — for Gaussian integers, m/nm/n rounded to the nearest lattice point.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageQuotient!
Quotient(m, n)⌊m/n⌋\lfloor m/n \rfloor for integers; m/nm/n rounded half-even in each part for Gaussian integers
Oscarfld(ZZ(m), ZZ(n))
Typed signatures
TypePackageApplies
(number, number, number?) -> numbernumber-theoryalways

Domain: Number theory

Details
  • For integers, ⌊m/n⌋\lfloor m/n \rfloor, so m=n Quotient(m,n)+Mod(m,n)m = n\,\mathrm{Quotient}(m, n) + \mathrm{Mod}(m, n) with the remainder taking the sign of nn.
  • For Gaussian integers the quotient rounds instead, ties to even, which is what makes Z[i]\mathbb{Z}[i] Euclidean: the remainder then has smaller norm than nn.
  • compute-engine has no Quotient; this follows Wolfram's.

Examples

25 more kept as data, checked against the oracles
Basic #
live ↗
InQuotient(17,5)\mathrm{Quotient}(17, 5)Out33

the floor, not truncation

live ↗
InQuotient(−7,2)\mathrm{Quotient}(-7, 2)Out−4-4

the remainder takes the sign of nn

live ↗
InQuotient(17,−5)\mathrm{Quotient}(17, -5)Out−4-4
Scope #

(7+5i)/(2+i)=3.8+0.6i(7 + 5i)/(2 + i) = 3.8 + 0.6i, rounded

live ↗
InQuotient(7+5i,2+i)\mathrm{Quotient}(7+5i, 2+i)Out4+i4+i

Real arguments: ⌊7.5/2⌋\lfloor 7.5/2\rfloor

live ↗
InQuotient(7.5,2)\mathrm{Quotient}(7.5, 2)Out33

Rational arguments: ⌊21/2⌋\lfloor 21/2\rfloor

live ↗
InQuotient(72,13)\mathrm{Quotient}(\frac{7}{2}, \frac{1}{3})Out1010

Exact past 2532^{53}: ⌊(25!−1)/24!⌋\lfloor (25!-1)/24!\rfloor, where a double would round up to 25

live ↗
InQuotient(25!−1,24!)\mathrm{Quotient}(25!-1, 24!)Out2424

Quotient(m, n, d) is ⌊(m−d)/n⌋\lfloor (m-d)/n\rfloor, so m−n qm-n\,q lands in [d,d+n)[d, d+n)

live ↗
InQuotient(17,5,3)\mathrm{Quotient}(17, 5, 3)Out22

Listable: threads over a list

live ↗
InQuotient([10,20,30],7)\mathrm{Quotient}(\bigl\lbrack10, 20, 30\bigr\rbrack, 7)Out[1,2,4]\bigl\lbrack1, 2, 4\bigr\rbrack
Properties #

m=n Quotient(m,n)+Mod(m,n)m=n\,\mathrm{Quotient}(m,n)+\mathrm{Mod}(m,n). See Mod

live ↗
In5Quotient(17,5)+17 mod 55\mathrm{Quotient}(17, 5)+17\bmod5Out1717
Possible issues #

2.5+2.5i2.5 + 2.5i rounds to even in each part

live ↗
InQuotient(5+5i,2)\mathrm{Quotient}(5+5i, 2)Out2+2i2+2i
About
Examples36
Checked againstWolfram Language 34 agree2 differOscar 5 agree
CrosswalkWolfram LanguageOscar

Implementation

mappedoscarpackages/oracle/src/mappings.ts
mappedwolframpackages/oracle/src/mappings.ts
mappedwolframpackages/oracle/src/mappings.ts

See also: Mod, GCD