Memory-mapped file offset translation 2026-10-14
Let be the memory page size, the aligned starting file offset, the mapping length and its base virtual address. A valid displacement with corresponds to file offsetHere is the relative memory page index, the floor function selects its integer part, and Euclidean division gives the within-page displacement . The backing page begins at . This identifies file contents; the page table separately selects a resident page frame and enforces permissions.
Take , and bytes in a file of at least 12288 bytes. A has a shared file mapping at . B has a shared file mapping at and a private file mapping at . These bases are illustrative chosen results, not requested fixed addresses. All three mappings cover the same two backing pages: file offsets 4096–8191 and 8192–12287. Displacement selects relative page 1, within-page displacement 37 and file offset . Thus A's
0x10001025, B's shared 0x20001025 and B's private 0x30001025 initially identify the same byte. The adjacent displacement 4134 identifies file offset 8230. Different virtual addresses can reach the same backing contents.Two operating-system processes map two backing pages at different virtual addresses; displacement 4133 identifies file offset 8229
. Details. To access a requested file offset that is not aligned, choose and displacement . Mapping enough bytes to cover that displacement plus the requested length makes the desired data start inside the aligned mapping. Do not pass the unaligned directly as the Linux kernel
mmap offset. For example, uses and displacement 37; that one-page start differs from our two-page mapping's . Order as the exact period of modular exponentiation Created 2026-09-24 Updated 2026-10-14
Let be coprime integers with , and let be their multiplicative order. For integers ,Negative exponents mean powers of the modular inverse of . Thus periodic modular exponentiation has smallest positive period , and are distinct congruence classes.[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. pp. 156–157, Theorem 6.29; multiplicative notation on p. 153
This lets a huge modular exponentiation reuse a short list: reduce its exponent modulo the multiplicative order, then look up the corresponding power. For example, gives , while gives . When the multiplicative order is unknown, Euler's theorem permits reduction modulo Euler's totient function, though that period may be longer. Repeated squaring remains useful when computing either the unreduced or the reduced power.
For a proof outline, multiply by the modular inverse of , leaving . Apply Euclidean division to write with . Then ; minimality of the multiplicative order forces . The reverse implication follows from . The coprime integers hypothesis enables cancellation: modulo eight, , but this repetition supplies no multiplicative order for two.
Paging 2026-10-13
Paging divides an address space into fixed-size memory pages and main computer memory into equally sized page frames. Here assume byte addressing, one memory page size bytes, and an unsigned virtual address . Its virtual page number and offset areThe brackets denote the floor function, and gives the remainder in Euclidean division. If the page table maps to physical frame number and permits the access, the physical address isThe low bits are unchanged; the other bits select the memory page or page frame. A bit shift and bit mask can extract these fields. [ref]
https://pages.cs.wisc.edu/~remzi/OSTEP/vm-paging.pdf. Arpaci-Dusseau and Arpaci-Dusseau, OSTEP chapter 18: Paging, Introduction, sections 18.1–18.2
For a 16-bit virtual address and bytes, take in hexadecimal. Then and . A mapping to givesThus the eight high bits choose a mapping; the eight low bits choose the same position in the resulting page frame. The 256-byte size is for illustration, not a claim about an actual architecture's supported memory page sizes.
Translating 0x1234 through an illustrative page table, with a separate offset and access check
. Details. The useful freedom is that adjacent memory pages can occupy unrelated page frames. In the diagram, virtual pages
0x12 and 0x13 occupy page frames 0x07 and 0x02; virtual addresses 0x12ff and 0x1300 are consecutive, but translate to physical addresses 0x07ff and 0x0200. Uniform units simplify placement and page replacement, at the cost of page table storage and unused bytes within partly filled memory pages. For example, placing 300 bytes in exclusive 256-byte page frames requires two page frames, leaving bytes unused. Past exam of the mathematics course of the University of Cambridge 2001 ia Paper 4 7E b Solution Created 2026-09-24 Updated 2026-10-14
Let be the multiplicative order of modulo . Use Euclidean division to write , . Since ,If , minimality of forces , so divides . Conversely, immediately gives . For negative integers , powers are interpreted using the multiplicative inverse and the same argument applies.
Past exam of the mathematics course of the University of Cambridge 2002 ia Paper 4 8B Solution Created 2026-09-24 Updated 2026-10-14
For , Euler's theorem allows , since are coprime integers. At every congruence holds and one may take . Let be the multiplicative order of modulo . Write a nonnegative exponent with using the Euclidean division. Then , so implies by minimality of . Thus . Negative exponents, if included, give the same conclusion using the inverse residue of .
A prime divisor of a Fermat number is odd, and satisfies . Therefore , so its multiplicative order divides . It does not divide , since modulo the odd prime. Every divisor of is a power of two, henceBy Fermat's little theorem and the divisibility just proved, , giving .
Past exam of the mathematics course of the University of Cambridge 2011 ia Paper 4 5E a Solution Created 2026-09-24 Updated 2026-10-14
The greatest common divisor is the largest positive integer dividing both and . To prove Bezout identity without assuming unique factorization, let be the least positive member ofThis set has positive members, for example , so well-ordering principle supplies . Divide by using Euclidean division: , . The remainder is another integer linear combination of . Minimality forces , so . The same argument gives . Every common divisor divides every integer linear combination, hence divides . Therefore is the greatest common divisor, andThis argument also proves that every common divisor divides the greatest common divisor.
The positive integers with the stated product-divisibility property areThe case is immediate. If is prime and , its only possible common positive divisor with is one. By Bezout identity, . Multiplying by shows that implies . This proves Euclid lemma directly. Conversely, if is not prime, it has a divisor with . Put ; then . Although , neither nor is divisible by , disproving the property for a composite .
Finally, suppose for four distinct primes. Then , so Euclid lemma gives or . A prime has no positive divisor other than one and itself, so this would mean or , a contradiction. Products of these two disjoint pairs cannot be equal. No form of the fundamental theorem of arithmetic was used: the required prime-divisibility fact was proved from Bezout identity.
Past exam of the mathematics course of the University of Cambridge 2013 ia Paper 4 1E Solution Created 2026-09-24 Updated 2026-10-07
The greatest common divisor is the largest positive integer dividing both and . To prove Bézout's identity without assuming a factorization theorem, consider the nonempty set of positive integer linear combinationsIt contains , so the well-ordering principle gives a least element . By Euclidean division, write with . Thenis another integer linear combination. If , it contradicts minimality, so and . Applying the same argument to gives . Conversely, every common divisor divides every integer linear combination and therefore divides . In particular every positive common divisor is at most . Thus andThis also proves the requested divisibility implication for any integer : if and , then .
For the scaling identity for greatest common divisors, put with . Since divides and , . On the other hand, multiplying Bézout's identity by expresses as , so . Positivity gives . Therefore without using prime factorization,
Past exam of the mathematics course of the University of Cambridge 2013 ib Paper 2 2G Solution Created 2026-09-24 Updated 2026-10-07
Let be a Euclidean domain and a nonzero ideal. Choose minimizing the Euclidean size. For any , Euclidean division gives , where either or has smaller size than . But , so minimality forces . Consequently . The zero ideal is , proving that every Euclidean domain is a principal ideal domain.
A commutative ring is Noetherian if every ideal is finitely generated; equivalently, every ascending chain of ideals stabilizes. To see the equivalence, the union of an ascending chain is an ideal. Finitely many generators for that union already belong to one member of the chain, after which the chain is constant. Conversely, an ideal which is not finitely generated permits successive choices outside the ideals generated by previous choices, producing a strictly ascending chain.
Every principal ideal domain is therefore Noetherian. The given Euclidean domain property of the Gaussian integers yields
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 21 5 Solution Created 2026-10-03 Updated 2026-10-07
The idele group is the multiplicative restricted productIts restricted product topology has basic open sets , where is finite and contains every infinite place, and is open in . In particular, the restriction to almost all local unit groups is part of the topology, not merely the unrestricted product topology.
The diagonal map is injective and well-defined by finite support of the principal ideal's valuations; its image consists of principal ideles. To prove discreteness of principal ideles, take the neighbourhood of which requires at every finite place and in the ordinary real or complex modulus at every infinite place. A diagonal element in it is a global unit, so . If , the nonzero integer has absolute value at least one, but the archimedean bounds make its absolute value less than . This contradiction proves is a discrete subgroup of .
For a modulus of a number field, write for its finite ideal part together with any selected real places. Let be the group of fractional ideals coprime to the finite part. Let consist of principal ideals with locally at each finite place in the modulus, and at each selected real place. The ray class group isEquivalently it is the quotient , with the corresponding principal-unit factors at finite places and positive multiplicative factors at selected real places. The question now assumes that no infinite places occur.
Put . Global units map to by reduction. To map to the ray class group, choose, by the Chinese remainder theorem, an integral having the prescribed unit residues at all , and send the tuple to the ray class of . A different choice changes the ratio by an element congruent to one at every such place, so the map is well-defined and multiplicative.
The forgetful map to the ordinary ideal class group is surjective: weak approximation for number fields multiplies an ideal by a principal ideal so that all its valuations in vanish. Its kernel consists exactly of classes represented by principal ideals coprime to , and their generators supply the local unit residues. Finally, a residue tuple maps to the identity ray class precisely when its chosen differs from a congruence-one generator by a global unit. Thus the ray class exact sequence isThe leftmost arrow need not be injective, explaining the absence of an initial zero.
For , the ring of integers of Q of square root two is . Its absolute field norm is a Euclidean function. Indeed, for , choose nearest integers ; writing , , both bounded by , gives . Applying this to a quotient proves Euclidean division, hence the ring is a principal ideal domain and . This is norm-Euclideanity of the integers adjoined square root two.
Write and . Their ideal norms are and , respectively; and the residue field at is , with because . The finite local quotient product for the requested modulus isThe first factor consists of and .
The given fundamental unit and generate the global units. Their images areThe first image has order six; its cube is and its square is , generating the first factor and the order-three subgroup of the second. The second image supplies the missing order-two element of . Thus the global unit map is surjective onto all local unit residues. By the exact sequence, or the unit-surjectivity criterion for a trivial finite ray class group,There is no positivity condition here: the modulus has no infinite part, so using the unit is legitimate and essential in the surjectivity calculation.
Past exam of the mathematics course of the University of Cambridge 2015 ia Paper 4 6E i Solution Created 2026-09-24 Updated 2026-10-06
Suppose two base-p expansions represent the same nonnegative integer. Pad the shorter one by trailing zero digits so that both have the same length. Reducing modulo shows that their first digits satisfy . Since both digits lie between and , they are equal as integers.
Subtract that common digit and divide by . The remaining equality is an equality of two base-p expansions with one fewer digit. Repeating this argument shows that every pair of corresponding digits agrees. Equivalently, repeated Euclidean division recovers the digits as remainders. The digits are unique up to padding by zeroes. The finite nonnegative-digit representation presupposes ; a negative integer has no such expansion.
At any division step , an integer divides both exactly when it divides both : one direction uses , and the other uses . HenceStarting with , , the Euclidean division producesThe nonzero remainders form a strictly decreasing sequence of positive integers. Such a sequence must terminate, since there are only finitely many positive integers below . Suppose is the last nonzero remainder, so . The unchanged greatest common divisor at each step givesThe final equality holds because the positive common divisors of and are precisely the positive divisors of . This proves both termination and correctness of the Euclidean algorithm.
The printed numerical example reverses the digits and contradicts both definitions. With the stated last-digit definition, gives , . Use those definitions throughout.
Put and . The exponential distribution givesThe Euclidean division has unique remainder and quotient . Thus the joint probability mass function isand zero otherwise. This is decimal digit decomposition of a geometric random variable. Following the erroneous example instead would require different definitions and would not answer the stated question.
Multiplication, followed by induction and inversion for negative powers, givesIf , apply Euclidean division to write with . Choose , so . This is one step of the Euclidean algorithm implemented by a determinant-one row operation.
After the reduction in part (b), multiply by . The new bottom-left entry is , whose absolute value is strictly smaller than the previous :Repeated Euclidean division must terminate because the nonnegative integers decrease strictly until zero. Thus a word in and their inverses gives a matrix with bottom-left entry zero. Its determinant is one, so the diagonal entries are equal and are either both or both :Since , this final matrix belongs to . So does , proving
Positional notation Created 2026-09-29 Updated 2026-10-14
In positional notation, a numeral digit contributes its value multiplied by a weight determined by its position. Fix an integer radix . A finite string of numeral digits , with , represents the nonnegative integerThe rightmost position has weight ; each move left multiplies the weight by . This weight is the place value. For a nonzero integer, the canonical string has . Zero is written with the single numeral digit . Leading zeros are permitted in a fixed-width display but omitted in the canonical form: . A negative integer is written with a separate minus sign and the positional notation for its absolute value; the minus sign is not a numeral digit.[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. §3.3, pp. 55–56: base-B digit vectors, separate sign and nonzero highest digit
For example,The zero is essential inside this string: , not . It records that the tens position contributes nothing while keeping the hundreds and units in their proper positions. The same integer has binary representation
Repeated Euclidean division constructs the representation exactly. Set . At each step writeKeep the remainder and continue with the integer quotient . A positive quotient strictly decreases, so eventually it is zero. Substituting the successive equations back into the first gives : the numeral digits are obtained from right to left. The remainder modulo uniquely fixes , and then the quotient uniquely fixes the remaining string by the same reasoning. This proves existence and uniqueness once leading zeros are excluded. The needed unique quotient and remainder are precisely the conclusion of the Euclidean division theorem.[ref]
This finite expansion concerns nonnegative integers. Extending positional notation to fractional positions uses weights to the right of a point; an arbitrary real number need not have a finite digit string. In particular, the decimal representation represents , while the base-two string represents . The radix is part of the interpretation.
The benefit is compact arithmetic: positions can encode every nonnegative integer below . To see the upper endpoint, fill all positions with ; the finite geometric series gives . Carrying in addition exchanges units of one place value for one unit of the next. Thus a short string stores a large count and also supplies an algorithm for computing with it.
Remainder 2026-10-14
Residue class Created 2026-09-24 Updated 2026-10-14
For a positive integer modulus , the residue class of an integer is the equivalence classIt contains all integers in the same position of the repeating cycle. For example,The residue class is this whole infinite collection; its canonical representative is the least nonnegative residue. Euclidean division gives exactly one such representative in , so there are exactly residue classes. When , there is just one, .
Define addition and multiplication of residue classes byThese definitions must give the same answer whichever integers represent the classes. If and modulo , thenBoth differences are divisible by , proving that the operations are well-defined. For example, and , since . Replacing nine by gives the same answers with smaller intermediate integers.
With these operations the residue classes form the finite commutative ring , a quotient ring. It need not be a field: although neither factor is the zero class. These zero divisors explain why division requires a unit modulo n. Reducing after each multiplication is especially useful in modular exponentiation, where the unreduced powers can become enormous.
Turán graph Created 2026-09-29 Updated 2026-10-14
The Turán graph is a complete multipartite graph with independent sets of sizes differing by at most one, with every cross edge present. Empty parts are allowed when .[ref]
Graph Theory by Reinhard Diestel. third electronic edition (2005), §7.1, printed p. 165, definition of Turán graphs and convention for empty partition sets
In this example, the independent sets are , and . Count the edges between each pair of parts:Any four vertices put at least two in the same independent set, by the pigeonhole principle, so they cannot form . Conversely, every choice of one vertex from each part is a triangle in a graph, giving triangles in a graph. Clique exclusion here does not mean triangle-free.
For the exact count, Euclidean division writes , where uses the floor function and is the remainder, with . There are parts of size and of size . For any part sizes summing to , count cross edges by expanding the square:ThereforeFor , we have , giving . The Quadratic Turan edge bound gives instead: the exact correction subtracts .
Balancing is an integer optimization with a simple reason. If two part sizes satisfy , moving one vertex from the larger part to the smaller decreases their contribution to the sum of squares byso it increases the edge count by . For eight vertices, parts give edges; moving one vertex produces and edges. The most symmetric permitted sizes pack the most cross edges, which explains the sharp construction in Turán's theorem.
Two-level address translation 2026-10-14
Choose an original teaching model with 16-bit virtual addresses, 16-bit physical addresses, and 256-byte memory pages and page frames. The eight high bits identify a virtual memory page; divide these into two four-bit indices. The eight low bits are the offset within the memory page. Thus each page table has 16 entries: the root selects a lower-level page table, and that table selects a data page frame. Every page table entry is four bytes, including its reference and flags. These are chosen model parameters, not a hardware entry encoding.
For a virtual address , extract the root index , lower-level index , and offset by Euclidean division:Here is the floor function and denotes the remainder in Euclidean division. Each index ranges from 0 to 15, and ranges from 0 to 255. In hexadecimal, virtual address
0x1234 splits into , , and ; its binary numeral system representation is 0001 | 0010 | 00110100.Fix the requested operation to be a one-byte user read. Assume both table nodes and the data page frame are resident, table reads are allowed, and no mapping changes during the page table walk. The model requires presence at both levels and takes the set intersection of the two entries' read, write, execute, and user-access permissions. This is an explicit memory protection rule for this model; Sv39 page tables use different rules. The root's physical address is
0x8000; the relevant entries are:| Record | Physical address of record | Reference held in the page table entry | Presence and permissions |
|---|---|---|---|
| Root entry 1 | 0x8000 + 1*4 = 0x8004 | Lower-level table at 0x9000 | Present; user; read/write; no execute |
| Lower-level entry 2 | 0x9000 + 2*4 = 0x9008 | Data page frame 0x07, base 0x0700 | Present; user; read-only; no execute |
The first lookup obtains a table reference, not the final data physical address. The second lookup obtains page frame number 7. Both entries permit a user read, so the original offset is added to the data page frame base:The page table walk therefore reads records at
0x8004 and 0x9008, then the requested read accesses data at 0x0734. All three are distinct physical addresses. These are two dependent table lookups followed by one data access, not a claim of three accesses to main computer memory: a memory cache can satisfy table lookups, and cached intermediate translations can skip them.Under the same memory protection rule, a user write at
0x1234 fails because lower-level entry 2 denies writes, even though root entry 1 allows them. Clearing either entry's presence flag also prevents the access. An absent root entry stops the page table walk before any lower-level lookup. A page fault then requires the operating system to determine whether a permitted mapping needs storage or the access is invalid; absence alone does not establish demand paging eligibility.With an empty translation lookaside buffer, the permitted read causes a TLB miss and this successful page table walk, with no page fault. If the resulting mapping and permissions are cached for the current address space, a later read at
0x1235 can use a TLB hit to reach 0x0735. A later write can cause a protection page fault on a TLB hit because the cached mapping remains read-only. Assume cached permissions are current; changing them requires the architecture's prescribed invalidation. A TLB miss describes a missing cached translation, while a page fault describes an access that cannot proceed under the translation or protection rules. [ref]Page Tables by The kernel development community. MMU, TLB, and Page Faults: translation caches, page walks, and faults for missing or forbidden mappings




