brain

tamnd's digital brain — notes, problems, research

43815 notes

Memory Model Basics

Memory is where a program keeps its data while it runs.

zigbook
Error Sets

An error set is a group of possible error names.

zigbook
Labels and Block Expressions

Zig has blocks.

zigbook
The `return` Keyword

Functions often need to produce results.

zigbook
Reserved Keywords

A keyword is a word that has special meaning in Zig.

zigbook
Why Zig Has No Exceptions

Most programming languages need a way to handle failure.

zigbook
`for` Loops

A while loop repeats while a condition is true.

zigbook
`while` Loops

Programs often need to repeat work.

zigbook
Naming Conventions

Names are part of the program.

zigbook
Parameter Syntax

Function parameters are the inputs of a function.

zigbook
The Structure of a Function

Functions are reusable blocks of code.

zigbook
`switch`

An if statement is good for general conditions:

zigbook
Comments and Documentation

Comments are notes for humans who read the code.

zigbook
Strings and UTF-8

A string is text.

zigbook
Zero Values and Initialization

Initialization means giving a value to something when it is created.

zigbook
Undefined Values

In Zig, undefined means “this value has not been initialized.”

zigbook
Type Inference

Type inference means Zig can figure out a type from the value you write.

zigbook
Booleans and Comparisons

A boolean is a value that can be only one of two things:

zigbook
Floating Point Numbers

Floating point numbers are numbers with fractional parts.

zigbook
Integer Types and Overflow

Integers are whole numbers.

zigbook
Primitive Types

Every value in a Zig program has a type.

zigbook
Reading Zig Error Messages

Sooner or later, every Zig beginner meets the compiler.

zigbook
Editors, LSP, and Debuggers

You can write Zig code in any text editor.

zigbook
Project Structure

So far, we have used single-file programs.

zigbook
Zig Compiler as a Toolchain

When beginners hear the word “compiler,” they often think of one job:

zigbook
Understanding `zig build-exe`

In the previous section, we used this command:

zigbook
Your First Zig Program

Now we will write and run a complete Zig program.

zigbook
Zig Release Channels and Versioning

Before writing larger Zig programs, you need to understand an important fact:

zigbook
Installing Zig

Before we write more Zig code, we need the Zig compiler.

zigbook
Why Zig Exists

Zig exists because low-level programming is still important, but the old tools have painful tradeoffs.

zigbook
`if` Expressions

Programs need to make choices.

zigbook
Variables and Constants

A program stores values so it can use them later. In Zig, you store values with two main keywords:

zigbook
What Is Zig

Zig is a programming language for writing programs that are fast, clear, and close to the machine.

zigbook
What Is Zig

Zig is a programming language for writing fast, small, reliable programs.

zigbook
What Is Zig

Zig is a programming language for writing fast, small, reliable programs.

zigbook
Appendix A.1 Sets and Functions

A set is a collection of objects called elements.

number-theorybook
Future Directions in Number Theory

Modern number theory continues to evolve rapidly.

number-theorybook
The Langlands Program

The Langlands program is one of the largest and most influential research programs in modern mathematics.

number-theorybook
The Birch and Swinnerton-Dyer Conjecture

An elliptic curve over $\mathbb{Q}$ may be written in Weierstrass form

number-theorybook
The Riemann Hypothesis

The Riemann zeta function is one of the central objects in mathematics.

number-theorybook
Fermat's Last Theorem

Fermat's Last Theorem states that there are no positive integers

number-theorybook
Open Problems in Number Theory

Number theory contains some of the oldest and deepest unsolved problems in mathematics.

number-theorybook
Arithmetic Statistics

Arithmetic statistics studies the distribution of arithmetic objects inside large families.

number-theorybook
Probabilistic Models for Primes

Prime numbers are deterministic objects, but many aspects of their distribution resemble random behavior.

number-theorybook
Random Matrices and Zeta Zeros

The Riemann zeta function is defined for $\operatorname{Re}s>1$ by

number-theorybook
Parity Problem

Sieve methods are extremely effective for estimating how many integers avoid small prime factors. They have produced major results about:

number-theorybook
Chen's Theorem

The Twin Prime Conjecture states that infinitely many primes satisfy

number-theorybook
Probabilistic Algorithms

A probabilistic algorithm uses random choices during its execution. In number theory, this is often a practical advantage rather than a weakness.

number-theorybook
Bombieri-Vinogradov Theorem

The Prime Number Theorem for arithmetic progressions states that for

number-theorybook
Geometric Langlands Theory

The classical Langlands program relates:

number-theorybook
Hints for Selected Problems

Write the two integers as

number-theorybook
Brun-Titchmarsh Theorem

One of the central problems of analytic number theory is understanding how primes distribute among residue classes.

number-theorybook
Probabilistic Primality

A primality test determines whether an integer is prime.

number-theorybook
Shimura Varieties

Modular curves parameterize elliptic curves and connect modular forms with arithmetic geometry.

number-theorybook
Trace Formulas

Fourier analysis decomposes functions into harmonic frequencies.

number-theorybook
Large Sieve

Classical sieve methods estimate how many integers survive congruence restrictions. The large sieve approaches these problems from a different direction.

number-theorybook
Frobenius Automorphisms

One of the deepest ideas in algebraic number theory is that prime numbers possess hidden symmetry inside field extensions.

number-theorybook
Decomposition and Inertia Groups

Let

number-theorybook
Selberg Sieve

Brun's sieve introduced the idea of estimating sifted sets through truncated inclusion-exclusion. However, Brun's method often produced bounds that were technically difficult...

number-theorybook
Smooth Numbers

A positive integer is called $y$-smooth if all of its prime factors are at most $y$.

number-theorybook
Automorphic $L$-Functions

The Riemann zeta function

number-theorybook
Brun Sieve

Sieve methods are techniques for counting integers that remain after removing residue classes modulo primes.

number-theorybook
Ramification of Primes

In the ordinary integers, every nonzero integer factors uniquely into prime numbers.

number-theorybook
Random Integers

Number theory often studies exact statements about individual integers. For example, one may ask whether a given integer is prime, squarefree, smooth, or representable as a...

number-theorybook
Functoriality

The Langlands program predicts that many different arithmetic objects are connected by systematic transfers.

number-theorybook
Schnirelmann Density

In additive number theory, ordinary asymptotic density is often too weak to control additive behavior.

number-theorybook
Local Fields

Classical number theory studies arithmetic globally over fields such as

number-theorybook
Zero-Knowledge Proofs

A zero-knowledge proof allows one party to convince another that a statement is true without revealing why it is true.

number-theorybook
Galois Representations

Galois groups encode the symmetries of algebraic equations and field extensions.

number-theorybook
Additive Bases

A central question in additive number theory asks whether every integer can be represented as a sum of elements from a fixed set.

number-theorybook
$p$-Adic Numbers

The real numbers arise by completing the rational numbers using the ordinary absolute value. The $p$-adic numbers arise by completing the rational numbers using the $p$-adic...

number-theorybook
Post-Quantum Cryptography

Modern public-key cryptography relies heavily on two computational assumptions:

number-theorybook
The Langlands Program

The Langlands program is one of the most ambitious and influential theories in modern mathematics.

number-theorybook
Exponential Sums

Exponential sums are among the central tools of analytic number theory.

number-theorybook
Valuations and Absolute Values

In ordinary analysis, the absolute value

number-theorybook
Dedekind Domains

Ordinary integers satisfy several remarkable properties simultaneously:

number-theorybook
Suggested Projects and Explorations

Study empirical properties of prime numbers through computation.

number-theorybook
Lattice Cryptography

Lattice cryptography is a family of cryptographic systems based on the presumed hardness of computational problems on high-dimensional lattices.

number-theorybook
Circle Method

Many problems in additive number theory ask whether an integer can be represented in the form

number-theorybook
Automorphic Representations

Classical modular form theory begins with analytic functions satisfying symmetry conditions.

number-theorybook
Principal Ideals

Let $R$ be a commutative ring. An ideal $I\subseteq R$ is called principal if there exists an element $\alpha\in R$ such that

number-theorybook
Waring's Problem

Waring's problem asks whether every sufficiently large positive integer can be written as a sum of a bounded number of fixed powers.

number-theorybook
Pairing-Based Cryptography

Pairing-based cryptography uses special maps defined on elliptic curve groups. A pairing is a function

number-theorybook
Automorphic Forms

Modular forms are functions on the upper half-plane satisfying symmetry conditions under the modular group

number-theorybook
Discriminants

The discriminant is one of the most important invariants of a number field. It measures how the arithmetic of the field differs from ordinary rational arithmetic.

number-theorybook
Goldbach Problems

Goldbach-type problems ask whether integers can be represented as sums of primes. They are among the oldest and most famous problems in additive number theory.

number-theorybook
Elliptic Curve Cryptography

Elliptic curve cryptography is a public-key cryptographic framework based on the arithmetic of elliptic curves over finite fields.

number-theorybook
The Modularity Theorem

For centuries, elliptic curves and modular forms were studied as separate objects.

number-theorybook
Units and Dirichlet Unit Theorem

Let $K$ be a number field and let

number-theorybook
Class Groups

In ordinary integers, every ideal is generated by a single element:

number-theorybook
Sumsets

Additive number theory studies arithmetic structure through addition of integers and subsets of integers.

number-theorybook
Diffie-Hellman Key Exchange

Secure communication requires two parties to share secret information. In classical symmetric cryptography, both parties must already possess the same secret key before...

number-theorybook
Elliptic Curves and Modularity

An elliptic curve is simultaneously:

number-theorybook
Problem Sets

1. Prove that the sum of two even integers is even.

number-theorybook
Generalized Riemann Hypothesis

The classical Riemann Hypothesis concerns the zeros of the Riemann zeta function

number-theorybook
Ideals and Prime Ideals

In ordinary integers, every number factors uniquely into primes. In many rings of algebraic integers, this property fails.

number-theorybook
Unique Factorization Failure

One of the central properties of the ordinary integers is unique factorization.

number-theorybook
Norm and Trace

Let $K$ be a number field of degree

number-theorybook
RSA Cryptosystem

Classical cryptography uses a shared secret key. Both sender and receiver must know the same secret information in advance.

number-theorybook
Modular Curves

The modular group acts on the upper half-plane by fractional linear transformations:

number-theorybook