Address translation Created 2026-10-13 Updated 2026-10-14
Converting a virtual address to a physical address using the current address space's mapping, with access checks. In paging, the memory page number changes while the offset within it stays fixed.
Address translation answers where an access would go; memory protection answers whether that access may proceed. Neither answer is the stored value. Reading the requested bytes is a subsequent logical operation, served by a memory cache or main computer memory. The operating system establishes the mapping context used by the memory management unit.[ref]
Mechanism: Address Translation. Operating Systems: Three Easy Pieces, chapter 15, Mechanism: Address Translation, printed pp. 1–2: hardware mechanism and operating-system control
Consider an original toy model with unsigned 12-bit virtual addresses, byte addressing, and 64-byte memory pages and page frames. Assume single-byte reads, one memory page size, no concurrent mapping changes, and resident readable mappings for virtual page 4 in both address spaces. The virtual address has six page-number bits and six offset bits, rather than a split between hexadecimal digits. By Euclidean division,Process A maps virtual page 4 to page frame 13; process B maps it to page frame 9. Thus the identical virtual address denotesThese are addresses, not the bytes read there. If the example's contents at those physical addresses are respectively 7 and 99, the two reads return 7 and 99. The mapping calculation alone cannot determine either value.
A translation lookaside buffer can cache these mappings and permissions. In a tagged version of this model, its lookup key includes the address space identifier as well as virtual page 4. An untagged version must remove conflicting cached mappings when changing the address space. Which tags and invalidation operations are available depends on the architecture; a context switch need not universally clear the whole translation lookaside buffer.[ref]
Paging: Faster Translations (TLBs). Operating Systems: Three Easy Pieces, chapter 19, Paging: Faster Translations (TLBs), section 19.5, printed pp. 9–10: flushing and address-space identifiers
The arithmetic explains the beauty of paging: a mapping can move an entire memory page without changing its internal positions. Indeed, for two offsets in the same mapped memory page,For process A, virtual page 4 spans
0x100–0x13F and maps to 0x340–0x37F. Crossing from 0x13F to 0x140 selects virtual page 5 and requires its own mapping and memory protection checks. A multi-byte access crossing that boundary cannot be justified by checking only its first byte. Base-p expansion 2026-10-06
For an integer base , a nonnegative integer has a finite positional representation with digits . Repeated Euclidean division gives the digits uniquely; appending zero high-place digits has no effect. The base need not be prime for uniqueness, but a prime base is useful in Lucas theorem and modular binomial coefficients.
Binary numeral system Created 2026-09-29 Updated 2026-10-20
The binary numeral system is positional notation with radix two. Each binary digit is zero or one, and its place value is a power of two. A one includes that weight in the sum; a zero skips it. The binary representation therefore selects and represents the integer .
To obtain those binary digits from , repeatedly use Euclidean division by two:The remainders, in the order produced, are . Read them in reverse order to get . The final zero is the quotient that stops the conversion, not an additional leading binary digit. Starting with zero itself needs the special single-digit representation .
A useful independent check reads the binary digits from left to right. Start with and, for each binary digit , replace by . For , the intermediate values are . This reconstructs the integer without reversing a list and explains why appending a zero on the right doubles the value.
Binary is well suited to computation because each binary digit has just two possibilities. A stored bit can encode either possibility; groups of bits encode larger integers. Practical integer arithmetic can use a radix that is itself a power of two, grouping several binary digits into each stored numeral digit.[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. §3.3, p. 56: choice of a power-of-two base for stored integer digits
A displayed negative integer, such as , uses a separate sign. A computer's particular signed storage convention is an additional encoding choice, so the displayed sign should not be confused with an extra binary place. Cache line Created 2026-10-13 Updated 2026-10-24
A fixed-sized, aligned block of consecutive bytes transferred and tracked as a unit by a data memory cache. Here cache line and cache block name that unit of data, including its identity in backing computer memory; a resident slot holds a copy. Reading one element can bring neighbouring elements into the same cache line, exploiting spatial locality.
For a nonnegative integer physical address and a cache line size bytes, Euclidean division gives the backing cache block number and offset :Here the brackets denote the floor function and gives the remainder. Cache line contains bytes at physical addresses through . With , read address 52 selects cache block 3, spanning addresses 48–63, and offset 4. Addresses 48 and 52 therefore request the same cache line; addresses 15 and 16 request different cache lines despite being adjacent.
For a cache line size , the low bits give the offset. In a fully associative cache, all remaining bits identify the backing cache block as its cache tag; there are no address bits selecting a particular cache slot. An eight-bit illustration gives : four bits
0011 for cache block 3 and four bits 0100 for offset 4 in the binary numeral system. The eight-bit width is illustrative; the trace does not assume an actual eight-bit machine. [ref]Distinguish this identity from a cache slot, which can hold different cache blocks over time. After read nine in the memory cache example, cache slot 0 contains cache line 3 and cache slot 1 contains cache line 0. Their cache tags identify 3 and 0; neither cache line number is its slot number. Some texts use “cache line” for the storage entry itself; this article reserves cache slot for that role.
Ceiling count for fixed-size batches 2026-10-14
Suppose is a nonnegative integer count of items and each batch holds at most items, where is a positive integer. The smallest sufficient number of batches isIndeed, exactly when the integer is at least . If , no batches are needed. If is a multiple of , no partly filled batch is needed.
For items with capacity per batch, . Five batches can be full and the sixth holds two items, leaving unused places. This is a different question from the five complete groups counted by .
Writing the Euclidean division , , gives the equivalent rule when , and when . This explains the ceiling function's jump: one extra item beyond a complete multiple demands a whole additional batch. For exact integer arithmetic, the identity avoids a fractional intermediate value; an implementation still needs an integer representation large enough to hold .
Ceiling function Created 2026-10-14 Updated 2026-10-20
The ceiling function gives the least integer large enough to meet a real lower bound. For a real number ,Thus , , and . The operation rounds upward in the total order on the real numbers, which can move a negative input towards zero. Its difference from the input obeys . Python's
math.ceil implements this least-integer definition. [ref]https://docs.python.org/3.14/library/math.html#math.ceil. Python 3.14 math.ceil documentation: the least integer at least x
.The ceiling count for fixed-size batches is a direct application. Suppose each box holds at most items, with positive integer , and there are items. The smallest number of boxes with enough capacity is : a candidate count must satisfy . For , , six boxes are needed, leaving unused places. Exactly 100 items need only five boxes, and zero items need zero boxes. Adding one to the floor function result unconditionally would therefore overcount at exact multiples of .
The ceiling function retains the endpoint on the left and counts enough whole containers
. Left: open and filled endpoints distinguish the half-open intervals where , including negative inputs. Right: the original capacity example uses 20 items per box; 101 items need six boxes, while an exact multiple of 20 needs no extra box. The right-hand inputs are integer item counts. Details.For nonnegative integer and positive integer , Euclidean division gives the exact identityWrite , . The count is when the remainder is zero and otherwise, and the right-hand side encodes these two cases. This argument specifies the domain of the identity; arbitrary negative denominators require their own sign conventions.
The ceiling function is a nondecreasing function, constant on each of the half-open intervals , and has a discontinuity of a function at every integer. It is tied to the floor function by . Adding an integer shifts its output by the same amount: . At an integer the floor and ceiling agree; at every other input they differ by one. These statements refer to exact real numbers; an input already perturbed by floating-point arithmetic can land on the other side of a threshold.
The same argument works for any integer base . Suppose has geometric distribution , , with . Its Euclidean division gives and . Their joint probability mass function isThe factors are normalized probability mass functions, so the final digit and quotient are independent. The quotient again has geometric distribution, with success probability . If is the integer part of an exponential random variable of rate , take .
Divisibility Created 2026-09-24 Updated 2026-10-18
For integers , divides when multiplication by some integer takes to :Then is a divisor of , and is an integer multiple of . The notation means that no such integer exists. For , this is equivalent to saying that the quotient is an integer, or that Euclidean division by leaves remainder zero.
For example, because , whereas because . Signs do not change divisibility: because , and because . In general, changing the sign of either input preserves the relation.
The definition here permits zero as either input. Every integer divides zero, since . In particular, ; however, whenever , since is always zero. This is a statement about multiplication, and assigns no meaning to division by zero: remains undefined.
Two useful properties come directly from the defining multiplication. Divisibility is a reflexive relation, since , and a transitive relation: if and , then . Moreover, a shared divisor divides every integer linear combination:Indeed, writing and gives . For example, and imply . This small observation explains why the Euclidean algorithm preserves common divisors, and why Bézout's identity can certify a greatest common divisor.
On the positive integers, divisibility is a partial order: if and , then . The restriction matters, since and although . The prime factorization viewpoint makes this order concrete: exactly when every prime valuation of is at most the corresponding prime valuation of . Thus one relation connects equal grouping, prime factorization, and modular arithmetic.
Book VII, definitions 3 and 5 of Euclid's Elements describe the corresponding positive-number relation through one number measuring another and through integer multiples. The sign and zero conventions above belong to the present integer formulation, rather than to those ancient definitions. [ref]
https://geometor.github.io/euclid/heath/VII/index.html. Euclid, Elements VII, definitions 3 and 5, T. L. Heath translation
Division (mathematics) 2026-10-13
For real numbers and , division asks for the unique number satisfying . Equivalently, uses the multiplicative inverse of . This description separates the role of the denominator from the result: the quotient undoes a specified multiplication.
For example, is the number whose double is three, so it is exactly . A second interpretation asks how many portions of size fit into an amount ; the answer is one and a half portions. Equal sharing and measuring with a specified portion size lead to the same quotient, although the units assigned to the result can differ.
In the natural numbers, exact division need not be possible. Euclidean division instead keeps a remainder: , with . Thus seventeen objects form three complete groups of five with two left over. As a rational number, the same quotient is . The remainder and the fractional part describe the same unfinished group in different ways.
Division by zero cannot retain the unique-solution rule. For , the equation has no solution; for , every real number solves , so there is no unique quotient. This explains both failures through multiplication, rather than assigning a value that would contradict ordinary arithmetic. [ref]
https://openstax.org/books/prealgebra-2e/pages/3-4-multiply-and-divide-integers. OpenStax, Prealgebra 2e, multiplication and division conventions
Floor and ceiling functions 2026-10-14
The floor function and ceiling function turn a real number into directed integer bounds. They answer two different questions: which integer is the largest one that does not exceed , and which is the smallest one that is not less than ?Both outputs are integers. These are exact mathematical operations; they need not choose the closest integer, and they do not refer to roundoff error in floating-point arithmetic.
For example,The fractional part is . The negative example matters: discarding the digits after the decimal point would give , which is truncation toward zero, rather than the floor function's value . At an integer, the floor function and ceiling function agree and the fractional part vanishes.
The usefulness is a bridge from continuous quantities to discrete decisions. An integer count in a closed interval uses both bounds. A ceiling count for fixed-size batches counts how many containers or pages are needed; a floor function counts how many complete groups fit. In Euclidean division, the same bounds specify the quotient, while the fractional part records the scaled remainder. A small amount of notation removes many cases that would otherwise have to be stated separately.
The reflection identityfollows by reflecting the ordered integers across zero: the largest one below becomes the smallest one above . For every integer , translation gives and . These formulas turn upper bounds into lower bounds and move examples between neighboring intervals.
For a historical example of the notation in use, Kenneth E. Iverson's 1962 conference paper A Programming Language lists the floor function, ceiling function and residue operation alongside the ordinary arithmetic operations. It states the two defining inequalities above, then extends operations component by component to vectors and matrices. This shows their role as tools for describing algorithms, rather than merely conventions for writing decimal numbers. [ref]
https://www.jsoftware.com/papers/AFIPS196205a.htm. Iverson, A Programming Language, AFIPS Spring Joint Computer Conference, May 1962, Basic Operations; transcription with typography changes documented at the end
Floor division 2026-10-20
The operation returning for . It rounds the exact quotient toward negative infinity; for nonnegative integers and positive , it is the quotient in Euclidean division.
Floor function Created 2026-09-24 Updated 2026-10-20
The floor is the greatest integer not exceeding the real number . Equivalently, exactly when , for an integer . The floor function is constant on each such half-open interval and has a discontinuity of a function at each integer.
Fractional part Created 2026-09-24 Updated 2026-10-20
The fractional part of a real number isIt is the amount left after removing the lower enclosing integer, even for negative inputs. Thus . It is not the signed string of digits obtained by truncation toward zero.
Translation by an integer leaves the fractional part unchanged: . It is therefore a periodic function with period one, increasing from zero toward one on each unit interval, then returning to zero at the next integer. In Euclidean division with , ; for , this is .
The notation is useful for following repeated motion modulo an integer. In normality and equidistribution under integer multiplication, the values shift the digits of a positional notation; the fractional part discards the leading integer portion without losing the remaining digits. Its braces must be distinguished by context from the braces denoting a set.
Generalized pigeonhole principle Created 2026-10-14 Updated 2026-10-24
For objects assigned to boxes, let be the number in box . The generalized pigeonhole principle statesThe ceiling function rounds up because box counts are integers. An equivalent threshold formulation says: for a positive integer , if , some box contains at least objects. For , putting objects in each box shows why the strict inequality matters. [ref]
https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-spring-2015/mit6_042js15_textbook.pdf#page=583. Lehman, Leighton and Meyer, Mathematics for Computer Science, section 14.8.1, rule 14.8.2
Computed examples. For and , . Counts attain this bound. For and , , and the balanced counts sum to and have largest count exactly . The threshold version agrees: . In contrast, seven boxes each containing three hold only objects.
Two balanced arrangements attain the generalized pigeonhole principle bounds: thirteen objects in twelve boxes force two, and twenty-three in seven force four
. Details. The bound is sharp for every and . Use Euclidean division to write with integers and . Place objects in each of boxes and objects in each remaining box. The largest count is if , and if , exactly . This balanced arrangement makes the guarantee best possible even though other arrangements can be much more crowded.
Proof outline. If every count were at most , the total would be at most . This contradicts . Taking proves the displayed bound for ; for every count is zero.
Integer Created 2026-09-24 Updated 2026-10-18
An integer is a whole number, positive, negative, or zero. The set of all integers isThe positive integers are ; the negative integers are their opposites . Zero is neither positive nor negative. The nonnegative integers include zero and all the positive integers. On a number line, consecutive integers are one unit apart, negative integers lie to the left of zero, and positive integers lie to its right. [ref]
3.1 Introduction to Integers. Prealgebra 2e, §3.1: Locate Positive and Negative Numbers on the Number Line; Opposite Notation; Integers
The integers let counting describe changes in both directions. If a counter starts at and increases by five, it reaches : . Decreasing that result by four gives . In addition on the number line, the sign of the added integer chooses the direction and its absolute value gives the distance. The additive inverse reverses the change made by .
The integers have closure under a binary operation for addition, subtraction and multiplication: whenever , the results , and are still integers. Together these operations give the integers their ring structure.[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. §7.1, p. 166, Definition 7.1; p. 167, Example 7.1: the integers with their usual addition and multiplication
For instance, , , and . General division has no such closure: is a rational number but not an integer. Some divisions are exact, such as ; division by zero is undefined. Euclidean division instead produces an integer quotient and a remainder, so retains the information that ordinary division puts into the fraction .An integer is the value, whereas its written numeral is an encoding. The decimal representation and the binary representation name the same integer. Changing positional notation changes how that value is displayed and how calculations are organized; it does not change the value itself.
Integer arithmetic 2026-10-13
Integer arithmetic computes with integers. Addition, subtraction and multiplication preserve integer values; division can instead return a quotient and remainder through Euclidean division. For example, gives five complete groups and a remainder of two. The ceiling count for fixed-size batches requires six groups to hold all 102 items.
Mathematical integers have no fixed size bound. A computer representation may have one, so an exact arithmetic formula still requires sufficient space for its inputs and intermediate values. The floor function and ceiling function define mathematical bounds independently of a chosen representation.
Karatsuba carry handling 2026-10-13
The blocks in the Karatsuba three-product identity are integers, not single digits: can need positions and can exceed . Concatenating the displayed blocks therefore fails. Accumulate their shifted values with ordinary addition, normalizing each digit position by Euclidean division: a coefficient becomes the digit , with carry passed to the next position. Subtraction likewise propagates borrows. Although for these nonnegative integers, intermediate digitwise subtraction can still borrow.
In the four-digit Karatsuba worked multiplication, grouping by base gives unnormalized coefficients , written from high to low. Normalize from the right: ; ; . The final groups are , yielding . The zero group must retain its two positions.
Since , their sums are less than and can need digits. Allocate that extra digit before the third recursive product; discarding it can change the answer. The GMP manual describes this sum growth and uses a difference-based form to avoid it.[ref]
Karatsuba Multiplication. GNU MP 6.3.0 manual, §15.1.2 Karatsuba Multiplication: sum-based middle product can exceed k limbs; absolute differences and their signs
Karatsuba operand splitting 2026-10-13
Fix an integer base . Let have at most digits in positional notation, treating zero as one digit. For , set using the ceiling function, and . Euclidean division giveswhere and . The floor function selects the high block; the remainder selects the low block. Both operands must use the same , including when their actual digit lengths differ.
For odd , the low block has digit positions and the high block has . Leading zero padding aligns a shorter operand without changing its integer value. Padding to a power-of-two length is optional: the split itself works for every . If power-of-two padding is used, the padded length is less than twice the original length, so it changes only a constant factor in the asymptotic analysis.
Least nonnegative residue 2026-10-14
The least nonnegative residue of an integer modulo a positive integer modulus is the unique representative of its congruence class in . Euclidean division gives . For example, , so ; the integer congruence does not assert equality of those two integers.
Legendre's formula Created 2026-10-14 Updated 2026-10-18
For a nonnegative integer and a prime number , the Legendre formula computes the prime exponent in a factorial without forming that huge product:Here is the floor function. The sum is finite: every term with is zero. When , all terms vanish, agreeing with and . The prime number hypothesis matters: a composite number does not give the same P-adic valuation or additive prime exponent. For example, the floor sum with is one, whereas divides .
Why count multiples repeatedly? Each multiple of in contributes one factor of ; each multiple of contributes another; and so on. A factor with P-adic valuation occurs in exactly the first counts. Adding those contributions proves the formula.[ref]
Number Theory for Mathematical Contests by David Anthony Santos. David A. Santos, Number Theory for Mathematical Contests, revision 31 October 2007, §8.3, Theorem 245, printed pp. 89–90: factorial valuation and digit form
For the original example ,The five multiples each contribute a second factor of three. The factor contributes a third, so it appears in all three rows. Equivalently, among there are eleven factors of P-adic valuation one, four of valuation two, and one of valuation three: . Thus divides , while does not.
Nested multiples count the factors of three in
. Each colored cell contributes one to the P-adic valuation. Multiples of nine occur in two rows, and occurs in three. Summing by rows gives ; summing by columns gives . Factors not divisible by three contribute zero and are omitted. Details.Repeated Euclidean division provides a practical evaluation: replace by , starting from , and add each new quotient until it is zero. This uses only the successive quotients for the example. The same calculation handles divisibility of binomial coefficients, where the P-adic valuations of the denominator factorials are subtracted.






