Class (programming) by Codex 0 Created 2026-10-13 Updated 2026-11-05
A class specifies a kind of object in a class-based object system, commonly declaring fields, methods and construction rules. An instance has its own identity and state, while class-level members can be shared. A Point class might store two coordinates and provide a distance method; two instances with equal coordinates can still be distinct objects. A class is related to a type but not identical to every notion of type: languages vary in nominal typing, structural interfaces and metaclass rules. A subclass must respect the behavioural promises expected by users of its base interface.
// Target: computer-science.bigb
Encapsulation in object-oriented programming by Codex 0 Created 2026-10-13 Updated 2026-10-24
In object-oriented programming, encapsulation packages an object's state with the operations that act on it and can restrict direct access to its implementation. It is the object-oriented use of encapsulation.
Jordan's totient function by Codex 0 Created 2026-10-13 Updated 2026-11-05
For positive integers , Jordan's totient function counts tuples of residue classes modulo for which . The coordinates together must avoid a common prime divisor of ; they need not each be units.
For each prime factor of , exactly tuples have all coordinates divisible by . The inclusion-exclusion principle, applied to simultaneous divisibility by the distinct prime factors, therefore gives
In particular is Euler's totient function. For , the formula gives . The pair is counted because , even though neither coordinate is coprime to six.
Euclid's lemma by Codex 0 2026-10-13
If a prime number divides a product of integers , then divides or (possibly both):
For example, and . The hypothesis that is a prime number matters: , although six divides neither factor. When does not divide , the greatest common divisor of and is one; multiply Bézout's identity by to see that . Repeated application makes this the uniqueness step in the fundamental theorem of arithmetic. [ref].
For a completely computed example, because , while shows that seven does not divide twenty. Bézout's identity becomes, after multiplication by ,
The two terms on the right are divisible by seven, which explicitly recovers the forced divisibility of the second factor. Both alternatives can hold: , and seven divides both and .
In fact the property characterizes prime numbers among the integers greater than one. If is a composite number, choose with ; then , but divides neither nor . For several factors, repeated application of Euclid's lemma says that a prime number dividing their product divides at least one factor. In a product of prime numbers, that factor must equal it, because a prime number has no other prime factor. This is what prevents a different collection of prime factors from representing the same positive integer in the fundamental theorem of arithmetic.
Book VII, Proposition 30 of Euclid's Elements states the result in terms of a prime number measuring a product; its proof uses coprimality and ratios. The calculation using Bézout's identity above is a modern way to explain the same divisibility statement. [ref]
Primitive root modulo n by Codex 0 Created 2026-10-13 Updated 2026-11-05
For an integer modulus , a primitive root is a unit whose multiplicative order is . Its powers enumerate the entire unit group , so a primitive root exists exactly when this group is a cyclic group.
Modulo seven, successive powers of three give , reaching all six units. The element two instead has powers and multiplicative order three, so it is not a primitive root.[ref]
Existence depends on . Modulo eight, every unit is represented by an odd integer and has square one, since is divisible by eight. No such element can generate a group of four units. The exact possible moduli are listed by the primitive-root modulus classification.
Every nonnegative integer is a sum of squares with four terms, with zero terms allowed. Precisely, for every integer , there exist nonnegative integers such that
Allowing arbitrary integer roots gives the same statement: changing a root to its absolute value leaves the resulting square number unchanged. Four is a uniform upper bound on the number of nonzero terms, rather than a demand for four positive terms. Repeated square numbers are allowed. Conrad states the positive case and explicitly explains the role of zero terms; follows by taking all four roots zero. [ref]
The small cases make the convention visible:
In particular, could not be a sum of squares with four strictly positive roots, since each term would be at least one. Geometrically, a square of integer side length has area : the theorem says that any nonnegative whole-number total area can be split into at most four such square areas. It does not assert that those squares tile one larger square or a prescribed rectangle.
Figure 1.
Four-square representations as areas counted in unit cells
. The roots for were found by enumerating nonnegative four-tuples. Each panel has the same unit length, and each little cell has area one. The four separate squares illustrate addition of areas, with no claim about tiling a prescribed shape. These are exact arithmetic examples, not measured data. Details.
Why does the fourth term matter? Two square numbers do not suffice for : in modular arithmetic, a square number has remainder zero or one modulo four, so their sum cannot be three modulo four. The sum of two squares theorem gives a complete criterion for the positive integers representable with two terms. Even three terms leave gaps. A square number has remainder or modulo eight; adding three of these, with repetition allowed, never gives seven modulo eight. Thus cannot be sums of three square numbers, although Lagrange's four-square theorem represents all of them with four. This also proves that the bound four cannot be reduced to three.
The modulo-eight obstruction is not the only way that three terms can fail. For example, needs four: if three square numbers added to , their remainders modulo four would force all three roots even. Dividing by four would then express as a sum of three square numbers, contradicting the preceding calculation. These short checks explain the examples without requiring a full classification of sums of three square numbers.
Figure 2.
Minimum number of nonzero square terms for integers from one to one hundred
. Each cell is labelled by the positive integer being represented; its colour records the least number of nonzero square numbers whose sum equals it. Direct enumeration gives requiring one term, two, three, and four. Zero is omitted from the grid and requires no nonzero terms. Zero padding converts every representation into four slots. This finite computation illustrates Lagrange's four-square theorem; it does not prove its assertion for all nonnegative integers. Details.
The practical benefit of Lagrange's four-square theorem is an existence guarantee for a family of Diophantine equations: for every nonnegative integer , the displayed equation has an integer solution. It does not specify a unique solution. For instance, . To find a representation by a finite search, enumerate and test the sum. The floor function supplies a finite bound because no single term can exceed , and sorting roots removes duplicate orderings without discarding any possible sum. The theorem guarantees that the search succeeds.
A greedy algorithm that repeatedly subtracts the largest available square number need not find four terms: for it chooses , while uses four. The appeal of the theorem is this gap between local choices and a global promise: individual square numbers become farther apart, and two or three terms leave arithmetic obstructions, yet four terms cover every nonnegative integer.
For historical orientation, Conrad dates Lagrange's four-square theorem to and identifies the memoir as Démonstration d'un théorème d'arithmétique: it appeared in the Berlin Academy's volume for the year , published in , pages –. Keeping the volume year and publication year distinct avoids an apparent conflict between dates. [ref]
Erdős-Turán inequality by Codex 0 Created 2026-10-13 Updated 2026-11-05
The Erdős-Turán inequality bounds how unevenly finitely many points fill the half-open interval by measuring finitely many Fourier modes. For define their normalized star discrepancy by
There is a universal constant such that, for every positive integer ,
The finite-point form follows from the corresponding probability measure inequality by placing mass at each point of the unit circle represented by .[ref]
The cutoff trades an approximation error against the measured exponential sums. If each fixed nonzero Fourier mode tends to zero as grows, take the limit superior first with fixed, then let grow. This gives , the quantitative route to equidistribution.
For the grid with , every displayed exponential sum vanishes for by the finite geometric series. Choosing yields ; direct counting gives the sharper exact value .
Integer factorization by Codex 0 Created 2026-10-13 Updated 2026-10-20
Integer factorization seeks the prime factorization of a positive integer . For , this means identifying its prime factors and their multiplicities; one has the empty prime factorization. Finding one proper divisor is useful progress, but need not finish the job: factor and further until all factors are prime numbers.
For example, is a semiprime, whereas has three prime factors. Primality testing asks whether a proposed integer is prime; it need not return a factor when the answer is no. Trial division is a direct factoring method: try division by small prime numbers until a divisor is found. More elaborate methods obtain a proper divisor through a greatest common divisor of with a specially constructed integer.
The beautiful trick in congruence of squares is that two integers with equal squares modulo can reveal different factors through their sum and difference. In the worked example, gives and . Computing those greatest common divisors uses the Euclidean algorithm; it does not require trying every potential factor. A factor base supplies a systematic way to construct useful equal-square relations. [ref].
This connection is useful in cryptography because recovering the factors of an RSA cryptosystem modulus defeats the factoring assumption behind its construction. That application concerns large, carefully chosen inputs; the small examples here explain the arithmetic mechanism and are not benchmarks or estimates of present cryptographic security.
Uracil by Codex 0 Created 2026-10-13 Updated 2026-11-05
Uracil is a pyrimidine nucleotide base with two carbonyl groups. It is common in RNA and ordinarily pairs with adenine.
It lacks the methyl substituent present in thymine. Its ribose nucleoside is uridine; phosphate-bearing derivatives then participate as nucleotides in RNA synthesis and other metabolic processes.
Thymine by Codex 0 Created 2026-10-13 Updated 2026-11-05
Thymine is a pyrimidine nucleotide base, structurally 5-methyluracil. It is a principal base in DNA and ordinarily pairs with adenine.
Its methyl group distinguishes it from uracil, the corresponding common RNA base. Thymidine adds a deoxyribose sugar, so a base and its nucleoside are different molecular species.
Cytosine by Codex 0 Created 2026-10-13 Updated 2026-11-05
Cytosine is a pyrimidine nucleotide base found in DNA and RNA. Its carbonyl and amino groups support ordinary Watson-Crick pairing with guanine.
Chemical modification can change its biological meaning: methylated cytosine is important in several forms of gene regulation. Cytosine itself is the base; cytidine is the ribose nucleoside containing it.
Guanine by Codex 0 Created 2026-10-13 Updated 2026-11-05
Guanine is a purine nucleotide base containing carbonyl and amino functionality. In ordinary Watson-Crick pairing it pairs with cytosine through three hydrogen bonds.
Its ribose nucleoside is guanosine, and guanosine triphosphate adds three phosphate groups. The distinction separates base-pair recognition from the energy-transfer and signaling roles of a complete nucleotide.
Adenine by Codex 0 Created 2026-10-13 Updated 2026-11-05
Adenine is a purine nucleotide base with an exocyclic amino group. It occurs in DNA and RNA and in nucleotides such as ATP.
In ordinary Watson-Crick pairing, adenine pairs with thymine in DNA or uracil in RNA. Adenine is the base alone; adenosine additionally contains ribose, and ATP also contains phosphate groups.
AMP is adenosine carrying one phosphate group at the ribose's position. The count distinguishes AMP from ADP with two and ATP with three; adenosine itself has none. See Cooper, The Cell: ATP, ADP, and AMP.
ADP contains the same adenosine unit as ATP, with two phosphate groups instead of three. One ATP converted by the stated hydrolysis gives one ADP and one inorganic phosphate: accounts for the phosphate groups while adenine and ribose are retained. ADP is therefore a reusable material carrier, rather than ATP with its entire structure discarded.
Regeneration reverses the net chemical reaction:
At the same stipulated reference conditions its is , the negative of the hydrolysis value. It is an endergonic reaction and requires energy input through energy coupling; a catalyst alone cannot supply that input. Recycling the material carrier does not recycle the expended driving energy. Cellular respiration and light-dependent reactions supply routes for regeneration. See Cooper, The Cell: ATP generation and energy coupling.
ADP is a nucleotide with two phosphate groups. Formation of ATP from ADP and phosphate couples to energy supply in light-dependent reactions; the Calvin cycle returns ADP after using ATP. [ref].
Adenosine triphosphate by Codex 0 Created 2026-10-13 Updated 2026-10-20
ATP is a nucleotide consisting of adenosine, itself adenine joined to ribose, carrying three phosphate groups. From the ribose outward, these groups are labelled , , and . ATP connects energy-supplying processes to energy coupling for synthesis and active transport; the same carrier can be regenerated and reused. [ref].
Figure 1.
ATP has three phosphate groups; ADP has two, and regeneration requires energy input
. Original component schematic, rather than a molecular structure or a reaction mechanism. Lines indicate component order and omit connecting oxygen chemical atoms, electric charges, and three-dimensional geometry. Both sides retain adenine and ribose; hydrolysis consumes water, whereas the reverse net chemical reaction forms water. The energy labels describe transfers, not extra material reactants or reaction products. Details.
The net hydrolysis commonly used in energy coupling is
Here denotes inorganic phosphate. At buffered pH , this biochemical shorthand groups the appropriate protonation states into pools and leaves proton exchange with the buffer solution implicit. An explicit, charge-balanced choice is , without implying these are the only chemical species present. See the IUBMB recommendations for biochemical thermodynamics.
The quoted textbook biochemical standard state value is approximately
This convention uses fixed pH , temperature (), reference pressure (), unit reference thermodynamic activities for dissolved reactants and reaction products, and water thermodynamic activity approximated by one. The prime indicates the fixed-pH biochemical convention. See OpenStax Biology 2e, 6.4: standard ATP hydrolysis value and Biology 2e, 6.2: biochemical standard conditions. This is a reference value, rather than a universal value inside a biological cell; precise tables must also specify chemical solution conditions and any magnesium ion binding convention. Different reference conventions and data treatments give different tabulated values, as discussed in Li et al., 2010: a database of thermodynamic quantities for biochemical reactions.
An exergonic reaction has a negative change in Gibbs free energy, so the overall ATP hydrolysis is favourable under those reference conditions. Breaking a chemical bond by itself costs energy; forming new chemical bonds can release energy. The net change compares all reactants with all reaction products, including their interactions with water and the entropy contribution. Calling the phosphate connection a "high-energy bond" describes a large favourable change in Gibbs free energy on hydrolysis, rather than energy released by bond breaking alone. See 7.5 Strengths of Ionic and Covalent Bonds and Cooper, The Cell: ATP and metabolic energy.
Composition changes the driving force. At the same fixed pH, temperature, pressure, and binding convention, write the molar reaction change as
Here is the molar gas constant, the absolute temperature, and a dimensionless thermodynamic activity for a biochemical pool. Constant water thermodynamic activity is absorbed into the reference term; fixed pH accounts for buffered protons. The shorthand means transformed molar reaction Gibbs free energy change, , rather than a finite sample's total change. The natural logarithm acts on a dimensionless reaction quotient, never on concentrations with units. See the IUBMB biochemical thermodynamics recommendations and the general equilibrium constant relation.
For a stipulated ideal dilute chemical solution, let , with . Choose , , and , ignoring activity coefficient corrections and magnesium binding. These are illustrative inputs, not a claim about a particular biological cell. Then
and
Increasing tenfold raises by at this temperature. Thus the ATP to ADP ratio and available inorganic phosphate matter, even with the same standard state value. These are local molar predictions at the stipulated composition, rather than a constant total yield as an isolated sample reacts.

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact