<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on Jasper</title><link>https://jasper-aa64.github.io/posts/</link><description>Recent content in Blog on Jasper</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 04 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://jasper-aa64.github.io/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Low-Latency Trading — Context Switches, Page Tables and the TLB</title><link>https://jasper-aa64.github.io/posts/low-latency-context-switch-page-table-tlb/</link><pubDate>Wed, 04 Nov 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/low-latency-context-switch-page-table-tlb/</guid><description>Threads are lighter than processes because the TLB and caches stay usable after the switch, not because the switch itself is cheaper. The TLB has no MESI: when any thread in a process changes the page tables, every core still holding that page table gets interrupted, and pinning and isolcpus cannot prevent it, so once a hot-path process is running its address space is read-only.</description></item><item><title>Trading System Notes #21: Measuring Trading-System Performance</title><link>https://jasper-aa64.github.io/posts/trading-system-latency-metrics/</link><pubDate>Tue, 03 Nov 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/trading-system-latency-metrics/</guid><description>What TTT and RTT each cover, why to report p50, p99 and p999 instead of the mean, how marks at thread boundaries separate processing from queueing, and how to use the latency table as a budget.</description></item><item><title>Trading System Notes #20: Measuring Latency with the TSC</title><link>https://jasper-aa64.github.io/posts/tsc-latency-measurement/</link><pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/tsc-latency-measurement/</guid><description>What a TSC reading means, when it is taken, which core it is taken on, how to record timestamps on the hot path, and how ticks become ns: where the frequency comes from and how to calibrate it yourself.</description></item><item><title>Trading System Notes #19: Scheduling Policies, Priority Inversion and Kernel Tuning</title><link>https://jasper-aa64.github.io/posts/scheduling-priority-inversion-kernel-tuning/</link><pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/scheduling-priority-inversion-kernel-tuning/</guid><description>Who runs first and for how long: scheduling classes and time slices, three traps of real-time priorities, two fixes for priority inversion, why HFT often skips PREEMPT_RT, and which knobs a low-latency box turns from BIOS to sysctl.</description></item><item><title>Trading System Notes #18: Thread-Safe Queues</title><link>https://jasper-aa64.github.io/posts/thread-safe-queue/</link><pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/thread-safe-queue/</guid><description>From one mutex to many producers: condition variables and lost wakeups in a blocking queue, rte_ring&amp;rsquo;s two pairs of indices and in-order publishing, Disruptor&amp;rsquo;s availability flags, and whether a full queue should block, drop, or overwrite.</description></item><item><title>Trading System Notes #17: Wait-Free</title><link>https://jasper-aa64.github.io/posts/wait-free-sticky-counter/</link><pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/wait-free-sticky-counter/</guid><description>Wait-free is not a faster lock-free: it turns a failed CAS from &amp;ldquo;try again&amp;rdquo; into &amp;ldquo;I come after you&amp;rdquo;, which bounds every thread&amp;rsquo;s steps, at the cost of more atomics and code that is harder to get right.</description></item><item><title>Low-Latency Trading — perf: How to Use It, What to Read</title><link>https://jasper-aa64.github.io/posts/low-latency-perf-profiling/</link><pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/low-latency-perf-profiling/</guid><description>stat for the totals, record and report to find the function holding 98% of the samples, annotate to see every sample land on the instruction after an add: a chain of adds, each waiting for the last, and splitting it four ways is 3.3 times faster. Without hardware counters, cpu-clock sampling still works; if the report shows only addresses, check the symbol table and the path the program runs from.</description></item><item><title>Trading System Notes #16: Spinlocks</title><link>https://jasper-aa64.github.io/posts/spinlock-implementation/</link><pubDate>Wed, 21 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/spinlock-implementation/</guid><description>Whether a spinlock is fast depends on what its waiters do: if every attempt is a read-modify-write, they drag the lock&amp;rsquo;s line back and forth. Read before you grab, put PAUSE in the loop, back off after losing, and waiting costs the holder almost nothing.</description></item><item><title>Low-Latency Trading — A Cache Case Study: Repricing 64 Options per Tick</title><link>https://jasper-aa64.github.io/posts/low-latency-cache-case-study/</link><pubDate>Tue, 20 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/low-latency-cache-case-study/</guid><description>One tick touches 140 cache lines, and most of the time goes into waiting for them. None of the four steps changes the computation; they change when data arrives, where it lands and who holds it: put the misses in flight together, ask for the next batch early, hand back lines that are dead after one read, read one line less across the handoff, and leave the lines the other core will read in L3.</description></item><item><title>Trading System Notes #12: Strength Reduction and Arithmetic Optimization</title><link>https://jasper-aa64.github.io/posts/strength-reduction-arithmetic/</link><pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/strength-reduction-arithmetic/</guid><description>The compiler only makes rewrites it can prove don&amp;rsquo;t change the result, and it does constant multiplies and divides better than you. What&amp;rsquo;s left for you is where it lacks information or where the rewrite changes the result: run-time divisors, signs, floating point. Integer prices are exact and fast.</description></item><item><title>Trading System Notes #13: Type Punning, Function Calls, and Compiler Hints</title><link>https://jasper-aa64.github.io/posts/type-punning-calls-compiler-hints/</link><pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/type-punning-calls-compiler-hints/</guid><description>How far the compiler can optimize depends on what it can see and what it dares to assume: different types are treated as non-overlapping, an invisible function body means arguments go by the calling convention, and helper macros are decisions you make for it, not all of them right.</description></item><item><title>Trading System Notes #14: Prefetching, Cache Warming, and Double Buffering</title><link>https://jasper-aa64.github.io/posts/prefetch-warmup-double-buffer/</link><pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/prefetch-warmup-double-buffer/</guid><description>There are three ways to get data into cache ahead of time, each with a precondition: prefetching needs you to know the address before the hardware does, warming has to happen on the core that reads the data, and double buffering needs a guarantee that the writer never returns to a copy a reader hasn&amp;rsquo;t finished.</description></item><item><title>Trading System Notes #15: SIMD Vectorization and Intrinsics</title><link>https://jasper-aa64.github.io/posts/simd-vectorization-intrinsics/</link><pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/simd-vectorization-intrinsics/</guid><description>One instruction computes a row of numbers only if the compiler knows how wide a register it may use, is sure nothing overlaps, and is allowed to reorder; when it can&amp;rsquo;t get all three, intrinsics let you write it yourself, at the cost of alignment, instruction-set detection and the last few digits of the result.</description></item><item><title>Trading System Notes #10: Pointer and Memory-Access Optimization</title><link>https://jasper-aa64.github.io/posts/pointer-memory-access/</link><pubDate>Mon, 12 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/pointer-memory-access/</guid><description>In a loop like a[i] = *b, the compiler re-reads *b every iteration, because writing a[i] might change it. Pointer optimization is about letting the compiler read less, and fitting linked structures into nearer caches.</description></item><item><title>Trading System Notes #11: Return Value Optimization and Pure Functions</title><link>https://jasper-aa64.github.io/posts/rvo-pure-functions/</link><pubDate>Mon, 12 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/rvo-pure-functions/</guid><description>Returning a struct by value is usually free, so there&amp;rsquo;s no need for out-parameters; what to watch are the few patterns that always move or copy. Pure-function attributes are a promise to the compiler: right, and it calls less; wrong, and it&amp;rsquo;s undefined behavior.</description></item><item><title>Trading System Notes #8: CRTP and Static Polymorphism</title><link>https://jasper-aa64.github.io/posts/crtp-static-polymorphism/</link><pubDate>Mon, 12 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/crtp-static-polymorphism/</guid><description>The base class writes the flow and the subclass fills in the details: virtual functions pick the subclass at run time, CRTP at compile time. What you save is more than one indirect jump: the call inlines completely and the object has no vptr. The price is that Base&lt;A&gt; and Base&lt;B&gt; are unrelated types and can&amp;rsquo;t share a container.</description></item><item><title>Trading System Notes #9: Loop Optimization</title><link>https://jasper-aa64.github.io/posts/loop-optimization/</link><pubDate>Mon, 12 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/loop-optimization/</guid><description>A dot-product loop reports “vectorized” at -O3, yet its four additions still wait on each other: floating-point addition isn&amp;rsquo;t associative, so the compiler won&amp;rsquo;t reorder it. What loop optimization really asks of you is to spot what blocks the compiler, and to make the changes it won&amp;rsquo;t make for you.</description></item><item><title>Low-Latency Trading — Memory Latency and Bandwidth</title><link>https://jasper-aa64.github.io/posts/low-latency-memory-latency-bandwidth/</link><pubDate>Fri, 09 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/low-latency-memory-latency-bandwidth/</guid><description>One memory access takes about 100 ns and brings back 64 B. One at a time, that&amp;rsquo;s 0.64 GB/s, yet one core reading sequentially gets 15–60 GB/s. The missing factor is the number of requests in flight. Whether the next load&amp;rsquo;s address has to wait for this load decides whether your code is latency-bound or bandwidth-bound.</description></item><item><title>Trading System Notes #7: Branch Prediction and Branch Optimization</title><link>https://jasper-aa64.github.io/posts/branch-prediction-branch-optimization/</link><pubDate>Fri, 09 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/branch-prediction-branch-optimization/</guid><description>The front end has to fetch instructions every cycle, but a branch isn&amp;rsquo;t resolved until a dozen-plus cycles later, so the CPU guesses. A right guess costs almost nothing; a wrong one throws away everything after it, about 15–20 cycles. The same if is predictable when the data has a pattern and a coin flip when it&amp;rsquo;s random, and the compiler may already have turned it into a cmov.</description></item><item><title>Low-Latency Trading — MESI Cache Coherence</title><link>https://jasper-aa64.github.io/posts/low-latency-mesi-cache-coherence/</link><pubDate>Sun, 04 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/low-latency-mesi-cache-coherence/</guid><description>MESI enforces one rule: a cache line has either one core that may write it or any number of cores that may only read it, never both. The four states are the answers to two questions — does anyone else hold this line, and have I changed it? — and every cost in the protocol comes from moving data between layers or waiting for another core to confirm. False sharing, a cached queue cursor and a producer that slows down as readers join are all the same state machine. Coherence still doesn&amp;rsquo;t make a multi-word read atomic, and it says nothing about the order of writes to different addresses; that is what fences are for.</description></item><item><title>Trading System Notes #5: An SPMC Broadcast Ring in Shared Memory</title><link>https://jasper-aa64.github.io/posts/spmc-shared-memory-broadcast-ring/</link><pubDate>Sun, 04 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/spmc-shared-memory-broadcast-ring/</guid><description>Market data has one producer and several consumers, each of which must see every message, and the producer is the hot path that may not wait for anyone. The answer is a broadcast ring: every slot carries its own sequence stamp, readers keep private cursors, and the producer overwrites the oldest slot without ever reading reader state. The price moves to the readers — overruns are silent, a re-check after reading can&amp;rsquo;t catch a half-written slot unless the writer invalidates the stamp first, and readers that catch up take the line the producer writes next, so every flat-out write costs more. Moving the ring into shared memory adds three more rules: nothing inside it may be a pointer, the first lap pays a page fault every 32 messages, and a restarted reader loses everything unless it saved its cursor.</description></item><item><title>Trading System Notes #6: Alignment, Layout, and Cache and DRAM Geometry</title><link>https://jasper-aa64.github.io/posts/alignment-layout-cache-dram-geometry/</link><pubDate>Sun, 04 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/alignment-layout-cache-dram-geometry/</guid><description>An access never pays for bytes; it pays for cache lines, and the address decides which lines, which cache set they compete for, and which DRAM channel and bank they live on. Part 1 is alignment: why a double aligned to 8 never straddles a line, why padding exists for arrays, alignas on a type versus a member, and how to get 64-byte and 2 MiB alignment on the heap. Part 2 is layout: lines per access, AoS versus SoA, and denormalization as a way to cut a dependency chain. Part 3 goes into the hardware: L1 picks a set from address bits 6–11, so data 4 KiB apart competes for 8 slots however empty the cache is (measured on an M1); a DRAM bank has one row buffer, 14 ns on a hit and 41 ns on a conflict; a column walk loses at five layers; refresh adds a P99 tail software can&amp;rsquo;t remove; and channels balance only when the hot stride is coprime with the channel count.</description></item><item><title>Trading System Notes #4: Lock-Free Queues and Micro-Batching</title><link>https://jasper-aa64.github.io/posts/lock-free-queue-logger-micro-batching/</link><pubDate>Sun, 20 Sep 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/lock-free-queue-logger-micro-batching/</guid><description>A lock-free SPSC queue works because every shared variable has exactly one writer: each side updates only its own counter and merely reads the other&amp;rsquo;s. The rest is keeping that property from being quietly undone — a shared element count both cores fight over (subtract two counters instead), a full-check that reads the other core on every call (cache the other side&amp;rsquo;s cursor, which can only be wrong in the safe direction), a mirrored mapping that removes the wrap-around seam, and a logger that pushes one character per slot (thirty slots for one log line, five as text runs). It ends with the vocabulary that keeps lock-free claims honest: SPSC is wait-free only through a fail-fast interface, finite steps are not finite time, and a bounded queue must always choose between dropping and blocking.</description></item><item><title>Trading System Notes #3: Memory Pools and Allocators</title><link>https://jasper-aa64.github.io/posts/hot-path-memory-allocators/</link><pubDate>Thu, 17 Sep 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/hot-path-memory-allocators/</guid><description>Every technique in this post does the same thing at a different layer: move an uncertain, kernel-involving operation off the hot path and force it to happen once, upfront, before it can ambush a single request. An object pool replaces malloc&amp;rsquo;s variable-cost search with an always-O(1) free list. mlockall and careful mallopt tuning stop the kernel from quietly taking pages back — and pre-faulting closes the one gap mlock alone leaves open. A hand-rolled arena allocator makes the STL itself cooperate with a custom allocator backed by bump-pointer memory. std::pmr solves the same STL-cooperation problem the standard library&amp;rsquo;s way — trading compile-time speed for runtime flexibility.</description></item><item><title>Trading System Notes #2: Memory Ordering and Cache Lines</title><link>https://jasper-aa64.github.io/posts/memory-ordering-false-sharing-dependency-chains/</link><pubDate>Tue, 15 Sep 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/memory-ordering-false-sharing-dependency-chains/</guid><description>The store buffer and the cache-coherence protocol are one piece of hardware, but they create two unrelated engineering problems. One is correctness: does a thread see the right value, in the right order — solved by memory_order and release/acquire pairing. The other is performance: how many cycles does touching shared or dependent data cost, even when every value read is already correct — solved by cache-line layout and instruction scheduling. Conflating the two is the single most common confusion in this part of systems programming.</description></item><item><title>Trading System Notes #1: CPU Isolation and NUMA</title><link>https://jasper-aa64.github.io/posts/cpu-affinity-core-isolation-numa/</link><pubDate>Wed, 09 Sep 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/cpu-affinity-core-isolation-numa/</guid><description>The enemy of a low-latency system is jitter, not the mean. The goal is to make your hot thread the only thing that will ever run on its core: pinning kills migration cost, the isolation stack evicts the tick / RCU / interrupts one layer at a time, disabling SMT and locking frequency removes the core&amp;rsquo;s own variability, and share-nothing sidesteps NUMA entirely.</description></item><item><title>AGENTS.md Practice Guide — Map, Commands, and Verification Loops for AI Coding Agents</title><link>https://jasper-aa64.github.io/posts/agents-md-practice-guide/</link><pubDate>Sat, 02 May 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/agents-md-practice-guide/</guid><description>AGENTS.md is a README for AI agents: a compact project map that exposes hard rules, build/test commands, verification loops, and deeper documentation links so agents can understand, modify, and verify code without relying on hidden tribal knowledge.</description></item><item><title>Matrix #1: Matrix Fast Power — Linear Recurrence, DP Semirings &amp; Kitamasa</title><link>https://jasper-aa64.github.io/posts/matrix-1-fast-exponentiation/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/matrix-1-fast-exponentiation/</guid><description>Matrix fast power for linear recurrences (4 patterns), 4 semiring templates (count/bool/min-plus/max-plus), matrix+segment tree for range-add Fibonacci queries, Kitamasa O(k²logn) and NTT O(k log²k logn).</description></item><item><title>Matrix #2: Gaussian Elimination — Real, Mod, Mod-2, Incremental</title><link>https://jasper-aa64.github.io/posts/matrix-2-gaussian-elimination/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/matrix-2-gaussian-elimination/</guid><description>Gauss elimination: real/mod/mod-2 templates (solve, det, inv, rank); incremental online RREF; Extended Lights Out, CF 1344F abstract GF(2) modelling, 2024 ICPC Kunming interactive tree queries.</description></item><item><title>Matrix #3: Linear Basis (XOR Basis) &amp; Simplex Method</title><link>https://jasper-aa64.github.io/posts/matrix-3-linear-basis/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/matrix-3-linear-basis/</guid><description>XOR linear basis: full template with kth, range basis, normalisation; Nowcoder median example; CF 1101G prefix-XOR rank; gym 104768 C XOR-divisibility; Simplex LP solver.</description></item><item><title>Matrix #4: Matrix Problems — Fibonacci Subarray Sums, Gaussian Elimination &amp; Expected Value</title><link>https://jasper-aa64.github.io/posts/matrix-4-problems/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/matrix-4-problems/</guid><description>Hard matrix problems: Fibonacci squared subarray sum with segment-tree 4-tuple and companion matrix; cycle-decomposition partition state space for random-swap sorting, first-step analysis, and Gaussian elimination.</description></item><item><title>Number Theory #0: Common Formulae — Legendre's Formula &amp; Divisor Convolutions</title><link>https://jasper-aa64.github.io/posts/number-theory-0-common-formulae/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-0-common-formulae/</guid><description>Legendre&amp;rsquo;s formula, divisor and multiple convolutions in O(n log n), offline-difference batch processing for H(n)=Σf(d)g(⌊n/d⌋).</description></item><item><title>Number Theory #1: Elementary Number Theory — GCD, LCM, Euler, CRT</title><link>https://jasper-aa64.github.io/posts/number-theory-1-elementary/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-1-elementary/</guid><description>GCD/LCM properties, Bézout/Frobenius, Euler&amp;rsquo;s theorem with power-tower reduction and φ-chain technique, congruence system merging via exGCD, CRT, and n! prime factorisation via Legendre&amp;rsquo;s formula.</description></item><item><title>Number Theory #1.1: Divisibility Blocking (Floor-Division Decomposition)</title><link>https://jasper-aa64.github.io/posts/number-theory-1-1-divisibility-blocking/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-1-1-divisibility-blocking/</guid><description>Divisibility blocking for O(sqrt n) floor-sum evaluation: lemma, single-variable loop, O(1) interval sum requirements, two-variable min-trick, multi-variable pseudocode, and ceiling-division blocking.</description></item><item><title>Number Theory #2-ex: Möbius Practice — LCM Sums, Divisor-Count, Omega Numbers</title><link>https://jasper-aa64.github.io/posts/number-theory-2-ex-mobius-practice/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-2-ex-mobius-practice/</guid><description>Practice problems for Möbius inversion: LCMSUM, two-variable lcm sum (O(n^3/4)), FSF&amp;rsquo;s game with offline difference, divisor-count sum d(ij), Omega Numbers with Dirichlet suffix sum.</description></item><item><title>Number Theory #2-ex: Möbius Techniques</title><link>https://jasper-aa64.github.io/posts/number-theory-2-ex-mobius-techniques/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-2-ex-mobius-techniques/</guid><description>Seven core techniques for Möbius inversion problems: loop shortening, gcd indicator expansion, coprimality reduction, Dirichlet convolution via T=dk, divisor symmetry, diagonal symmetry, and value-domain cnt[] tricks.</description></item><item><title>Number Theory #2: Multiplicative Functions, Möbius Inversion &amp; Dirichlet Convolution</title><link>https://jasper-aa64.github.io/posts/number-theory-2-multiplicative-functions/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-2-multiplicative-functions/</guid><description>Multiplicative functions, single-point and linear-sieve evaluation; Möbius function, both forms of Möbius inversion with full derivations and examples; Dirichlet convolution, key identities, Du Jiao sieve; generalized Möbius inversion on posets.</description></item><item><title>Number Theory #3: From Eratosthenes to Möbius Inclusion-Exclusion</title><link>https://jasper-aa64.github.io/posts/number-theory-3-sieve-mobius-inclusion-exclusion/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-3-sieve-mobius-inclusion-exclusion/</guid><description>Eratosthenes sieve for μ; g/f/h framework; Conclusions 1 and 2 with derivations and tables; GCD table intuition; CF 803F Coprime Subsequences with bottom-up and Möbius approaches.</description></item><item><title>Number Theory #3.1: Sieve Problems — Coin System DP via Sieve</title><link>https://jasper-aa64.github.io/posts/number-theory-3-1-sieve-problems/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-3-1-sieve-problems/</guid><description>Greedy optimality for divisibility-chain coin systems, DP over the maximum denomination, and a sieve-style transition by adding one larger coin.</description></item><item><title>Number Theory #4: Min_25 Sieve and Du Jiao Sieve</title><link>https://jasper-aa64.github.io/posts/number-theory-4-min25-du-jiao-sieve/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-4-min25-du-jiao-sieve/</guid><description>Min_25 sieve: theory, two complete examples, Lagrange interpolation for power sums. Du Jiao sieve: template, P3768, GCD sum, LCM sum.</description></item><item><title>Number Theory #4: Primality, Factorisation &amp; Residues (Miller-Rabin, Pollard Rho, Tonelli-Shanks)</title><link>https://jasper-aa64.github.io/posts/number-theory-4-primality-factorisation-residues/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0800</pubDate><guid>https://jasper-aa64.github.io/posts/number-theory-4-primality-factorisation-residues/</guid><description>Miller-Rabin primality test, Pollard Rho factorisation, Tonelli-Shanks for quadratic residues, cubic residues via F_p[t]/(t^3-a), quartic residues by double square root, and general k-th residues via primitive root + BSGS, plus N-th residues mod composite.</description></item><item><title>Combinatorics: Order Theory — Chromatic Polynomials, Chordal Graphs, Order Polynomials, Dilworth &amp; Hall</title><link>https://jasper-aa64.github.io/posts/combinatorics-order-theory/</link><pubDate>Sun, 26 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-order-theory/</guid><description>Chromatic polynomial, chordal/interval graphs, PEO product formula, order polynomials (chain/antichain/tree/DAG/divisor lattice), MacMahon formula, Dilworth, Mirsky, Hall&amp;rsquo;s marriage theorem, Erdős–Szekeres, missile interception.</description></item><item><title>Combinatorics #2-ex1: Difference (Correlation) Convolution</title><link>https://jasper-aa64.github.io/posts/combinatorics-2-ex1-difference-convolution/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-2-ex1-difference-convolution/</guid><description>Cross-correlation via ordinary convolution: reverse-A and reverse-B extraction methods, derivation, and Ring Trick II (cyclic shift score maximisation via difference convolution).</description></item><item><title>Combinatorics #2-ex2: Cyclic Convolution</title><link>https://jasper-aa64.github.io/posts/combinatorics-2-ex2-cyclic-convolution/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-2-ex2-cyclic-convolution/</guid><description>Cyclic convolution definition, FFT/NTT implementation for n=2^k, zero-padding, why n must be a power of two, and the fold-back technique for arbitrary n.</description></item><item><title>Combinatorics #2.1: FFT and Lagrange Interpolation</title><link>https://jasper-aa64.github.io/posts/combinatorics-2-1-fft-lagrange-interpolation/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-2-1-fft-lagrange-interpolation/</guid><description>Polynomial representations, FFT/DFT over complex numbers, Triple Sums, Fuzzy Search (difference convolution), FFT template, Lagrange interpolation (O(n²) and O(n) equidistant), sum of k-th powers, Assigning Prizes polynomial DP.</description></item><item><title>Combinatorics #2.2: Primitive Roots, Discrete Logarithm, NTT, Divide-and-Conquer NTT</title><link>https://jasper-aa64.github.io/posts/combinatorics-2-2-primitive-roots-ntt/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-2-2-primitive-roots-ntt/</guid><description>Order and primitive roots (Euler&amp;rsquo;s theorem, BSGS, exBSGS), discrete index as logarithm analogue, SGU 261 Discrete Roots, NTT theory and templates, divide-and-conquer NTT (product tree), Wannafly D team selection, Nowcoder 50F generating functions.</description></item><item><title>Combinatorics #3.1: Ordinary Generating Functions</title><link>https://jasper-aa64.github.io/posts/combinatorics-3-1-ordinary-generating-functions/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-3-1-ordinary-generating-functions/</guid><description>Formal power series basics, ordinary generating functions, inversion identities, generalized binomial expansions, bounded counting examples, and recurrence-to-closed-form examples such as Fibonacci and Catalan.</description></item><item><title>Combinatorics #3.2: More Operations on Formal Power Series</title><link>https://jasper-aa64.github.io/posts/combinatorics-3-2-more-operations-on-formal-power-series/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-3-2-more-operations-on-formal-power-series/</guid><description>Newton iteration for polynomial inverse and square root, derivative/integral/composition of formal power series, logarithm and exponential of series, and worked examples including CF438E and a bad-modulus complete-knapsack generating function.</description></item><item><title>Combinatorics #1.1: Permutations and Combinations</title><link>https://jasper-aa64.github.io/posts/combinatorics-1-1-permutations-combinations/</link><pubDate>Fri, 24 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-1-1-permutations-combinations/</guid><description>Hockey Stick identity, addition/multiplication principles, binomial identities, example problems: bitonic sequences, multiset permutations, multi-layer coloring DP, CCPC Subpermutation.</description></item><item><title>Combinatorics D1: Diophantine Equations</title><link>https://jasper-aa64.github.io/posts/combinatorics-d1-diophantine-equations/</link><pubDate>Fri, 24 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-d1-diophantine-equations/</guid><description>Stars and bars, bounded Diophantine equations via inclusion-exclusion, prefix-sum DP, D&amp;amp;C NTT, equal-cap formula, and a full worked example on CF 2127F.</description></item><item><title>Combinatorics #0: Common Formulae &amp; Conclusions</title><link>https://jasper-aa64.github.io/posts/combinatorics-0-common-formulae-conclusions/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-0-common-formulae-conclusions/</guid><description>A compact toolkit of geometric sums, floor-sum transformations, XOR facts, Fibonacci identities, and perfect-square patterns.</description></item><item><title>Combinatorics #0.1: 计数中常用的结论</title><link>https://jasper-aa64.github.io/posts/combinatorics-1-counting-conclusions/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-1-counting-conclusions/</guid><description>常见计数结论、Lucas 定理、不定方程解计数、平面分拆、DAG 路径计数、多项式平移、XOR 均匀性与若干竞赛常用结论。</description></item><item><title>Combinatorics #1.2: Inclusion-Exclusion, Bounded Diophantine Equations, and Derangements</title><link>https://jasper-aa64.github.io/posts/combinatorics-1-2-inclusion-exclusion-diophantine-derangements/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-1-2-inclusion-exclusion-diophantine-derangements/</guid><description>Inclusion-exclusion in set and operator form, equal-count subproblems, bounded Diophantine counting, derangements, Stirling numbers, and selected contest problems.</description></item><item><title>Combinatorics #1.2：容斥原理、不定方程、错排</title><link>https://jasper-aa64.github.io/posts/combinatorics-1-2-cn/</link><pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/combinatorics-1-2-cn/</guid><description>容斥原理的集合与算子形式、有上下界不定方程计数（前缀和DP与分治NTT）、错排公式与第二类斯特林数。</description></item></channel></rss>