• · math #
    The second power of a number is called its square. Similarly, the eighth power of a number is called its zenzizenzizenzic; for instance the zenzizenzizenzic of 22 is 28=2562^8 = 256. (Wikipedia)
  • · math #

    Pick two pairs of numbers at random. The probability that the pair with the larger sum also has the larger product is 11/12.

    Formally, given N∈NN \in \mathbb{N}, choose integers a,b,c,da,b,c,d uniformly at random from [1,N][1,N]. Then P[ad>bc∣a+d>b+c]→11/12P[ad>bc \mid a+d>b+c] \to 11/12 as N→∞N \to \infty. (John D. Cook’s blog)

  • · programming #

    A peculiar interaction between blanket trait implementations and type inference in Rust:

    trait Foo {
      fn abs(&self) -> i64 { 42 }
    }
    impl<T> Foo for T {}
    
    fn main() {
        let x = 5;
        println!("{}", x.abs()); // outputs 42
        let _: i64 = x;
        println!("{}", x.abs()); // outputs 5
    }
    

    (r/rust comment)

  • · math #

    Given a number x1>0x_1>0, consider the sequence defined recursively by

    xn+1=(1+1xn)n.x_{n+1} = \left(1+ \frac{1}{x_n}\right)^n.

    It turns out that there exists a unique starting value x1=αx_1 = \alpha such that the displayed sequence diverges to ∞\infty; this value α=1.187…\alpha=1.187\dots is called the Foias constant. (Wikipedia)

  • · math #
    The average number of moves in the Tower of Hanoi game with nn disks connecting a randomly chosen initial state to a randomly chosen terminal state with a shortest number of moves is asymptotically equal to (466/885)⋅2n(466/885)\cdot 2^n. (MathOverflow)
  • · math #
    A new old polynomial-time primality test: OpenAI’s recent proof of the quasi-Riemann hypothesis implies that Miller’s primality test (a deterministic variant of the famous Miller-Rabin test) runs in polynomial time. Note that Miller’s test was invented way back in 1976 (in particular, well before the AKS algorithm), but the polynomial runtime bound was only conditional until now. (MathOverflow)
  • · programming #

    In Go, type inference of type parameters doesn’t see through parentheses.

    func id[T any](x T) T { return x }
    var _ func(int) int = id    // infers T=int
    var _ func(int) int = (id)  // type error
    

    (I found the example above in this GitHub issue.)

  • · math #

    A fun construction of the reals: define a function f:Z→Zf : \mathbb{Z}\to\mathbb{Z} to be an almost homomorphism if the set {f(a+b)−f(a)−f(b):a,b∈Z}\{f(a+b)-f(a)-f(b) :a,b \in \mathbb{Z}\} is finite. (This set is exactly {0}\{0\} when ff is a homomorphism, hence the name.) Let S⊆ZZS \subseteq \mathbb{Z}^\mathbb{Z} be the set of almost homomorphisms, and let B⊆SB \subseteq S be the set of bounded functions.

    Then the quotient S/BS/B, equipped with pointwise addition and composition as multiplication, is isomorphic to the real numbers. (“The Eudoxus Real Numbers”)

  • · math #
    A positive integer nn is a Fibonacci number if and only if either 5n2+45n^2 + 4 or 5n2−45n^2 - 4 is a perfect square. (See the section “Fibonacci is a Square” in this 1972 issue of the Fibonacci Quarterly.)
  • · math #
    Graham’s rearrangement conjecture states that for any subset of Z/pZ∖{0}\mathbb{Z}/p\mathbb{Z} \setminus \{0\}, there exists a way to order the subset such that the partial sums are all distinct mod pp. This conjecture was recently proved for sufficiently large primes. (Quanta)
  • · math #
    A cute proof that the harmonic series diverges: recall the inequality ex≥1+xe^x \ge 1+x; setting x=1/kx=1/k one gets e1/k≥k+1ke^{1/k} \ge \frac{k+1}{k}. Now take the product over k=1,2,…,nk = 1, 2, \dots, n and telescope to obtain eHn≥n+1e^{H_n} \ge n+1. It follows that Hn≥log⁡(n+1)H_n \ge \log(n+1), which diverges as claimed. (Math Stack Exchange)
  • · programming #
    Jules Jacobs’ website has a bunch of interesting notes on math and CS. I’ve enjoyed reading every single one I’ve clicked on so far.
  • · math #
    Let P∈C[z]P \in \mathbb{C}[z] be a complex polynomial. Then the roots of P′P' all lie in the convex hull of the roots of PP. (Gauss-Lucas theorem)
  • · programming #
    For some time I’ve been looking for a blog post I once read about incidental duplication. LLM-assisted search helped me finally locate it on the Google Testing Blog, which contains many more nice tips. Highly recommend!
  • · programming #
  • · math #

    The Fibonacci sequence was originally used to model the growth of (idealized) rabbit populations (Wikipedia):

    A newly born breeding pair of rabbits are put in a field; each breeding pair mates at the age of one month, and at the end of their second month they always produce another pair of rabbits. How many pairs of rabbits are there after a year?

  • · programming #
    Crit is a local UI for reviewing LLM-generated output. At a glance it looks more polished (less slop) than other tools of its kind, so I’m giving it a try.
  • · programming #
    A reflection on the role of code review in the age of LLMs: “Do You Still Read the Code?”
  • · math #
    A lovely post on what constitutes mathematics: “No Country for Mediocre Mathematicians”
  • · programming #
  • · math #
    Assuming the Riemann hypothesis, the Möbius function behaves like a random walk. (Math Stack Exchange)
  • · programming #
    Mole frees up disk space on MacOS automatically. (From Ellie Huxtable’s blog)
  • · math #
    n!=⌊nn2/(nnn)⌋n! \textstyle=\left\lfloor n^{n^2}\big/\binom{n^n}n\right\rfloor (MathOverflow)
  • math #

    There exists a complex sequence (an)n(a_n)_n such that ∑n≥0ank\sum_{n \ge 0} a_n^k converges if and only if kk is prime.

    More generally, for any fixed subset A⊆Z+A \subseteq \mathbb{Z}^+, there exists a complex sequence (an)n(a_n)_n such that ∑n≥0ank\sum_{n \ge 0} a_n^k converges if and only if k∈Ak \in A. (Math Stack Exchange)

  • math #

    If a(b+1)(ab+1)a(b+1)(ab+1) is a perfect square, then (b+1)(b+1) divides a(ab+1)a(ab+1).

    (I originally posed this as a conjecture on Math Stack Exchange based on computational evidence, and user Mastrem provided a proof using a clever descent argument.)

  • programming #
    In C++, all literal expressions (e.g., 42, true, nullptr) are prvalues, with the sole exception of string literals (e.g. "hello world"), which are lvalues. (cppreference)
  • math #
    A quartic polynomial ff can be expressed as the composition of two quadratic polynomials gg and hh (such that f(x)=g(h(x))f(x) = g(h(x))) if and only if two of the roots of ff have the same sum as the other two. (Math Stack Exchange)
  • programming #

    In Go, the following is not an error:

    type A struct { Field string }
    type B struct { Field int }
    type C struct { A; B }
    

    even though C embeds A and B, both of which declare a field called Field.

  • math #

    If f:Z∞→Zf : \mathbb{Z}^\infty \to \mathbb{Z} is an additive function that vanishes on all sequences of the form (1,0,0,… )(1, 0, 0, \dots), (0,1,0,… )(0, 1, 0, \dots), (0,0,1,… )(0, 0, 1, \dots), and so on, then ff is the zero function. (Math Stack Exchange)

    If this seems obvious, note that the statement is false for f:Z∞→Qf : \mathbb{Z}^\infty \to \mathbb{Q} under AC.

  • programming #
    It’s well known that heapsort has worst-case runtime Θ(nlog⁡n)\Theta(n \log n). But the best-case runtime for heapsort is also Θ(nlog⁡n)\Theta(n \log n) (assuming distinct keys), and this was only proved several decades after heapsort’s invention. (“On the Best Case of Heapsort”)
  • math #