Numbers

Continuing the porting of stuff from betaveros.stash, and adding more stuff.

Mnemonic

Here’s my mnemonic table for digits, inspired by an old Martin Gardner column. I wrote from memory the first 132 digits of 2012! correctly at IMO 2012 with this table. I had remembered more, but unfortunately, if I recall correctly, I confused myself over whether I had encoded a 5 or a 2 by the S of “nose”, because this is supposed to be more of a phonetic code than a spelling one — otherwise double letters would be confusing and lots of randomly appearing digraphs would be wasted, because English is weird.

I assigned two kind of different consonants to 1 because it’s fairly important; I added W pretty late. The other two unused consonants are H and Y.

digit consonant(s) mnemonic
1 L, W l33t; 1 is pronounced Won
2 Z(, J, CH, TH) l33t
3 M tilt head sideways
4 F(, V) Four
5 S(, SH) l33t
6 G(, K) l33t
7 T(, D) l33t
8 B(, P) l33t
9 N Nine
0 R zeRo, or it’s a Round circle

Bits & Primes

2095133040 has 1600 factors, the most of any positive integer under 231 − 1. Ref: A002182: highly composite numbers, def. 1

There are 105097565 (1.05e8) primes under 231 − 1.

Miller-Rabin primality testing does not miss any composites:

  • below 231 if the first 3 primes (2, 3, 5) are used as witnesses.
  • below 232 if the first 4 primes (2, 3, 5, 7) are used as witnesses.
  • below 264 if the first 12 primes (2 to 37 inclusive) are used as witnesses.

See A014233.

To verify implementations: there are 82025 primes beneath (1 << 20) and 37871 primes between (1 << 40) and (1 << 40) + (1 << 20).

Primes in Decimal

  • 1881881
    • n − 1 factorization: 23 × 5 × 7 × 11 × 13 × 47
    • smallest primitive root: 6
  • 99990001
    • n − 1 factorization: 24 × 32 × 54 × 11 × 101
    • smallest primitive root: 13
  • 140000041
    • n − 1 factorization: 23 × 32 × 5 × 157 × 2477
    • smallest primitive root: 28
  • 987654323
    • n − 1 factorization: 2 × 701 × 704461
    • smallest primitive root: 2
  • 999299999
    • n − 1 factorization: 2 × 23 × 21723913
    • smallest primitive root: 11
  • 999992999
    • n − 1 factorization: 2 × 499996499
    • smallest primitive root: 11
  • 999999001
    • n − 1 factorization: 23 × 33 × 53 × 7 × 11 × 13 × 37
    • smallest primitive root: 17
  • 999999929
    • n − 1 factorization: 23 × 124999991
    • smallest primitive root: 3
  • 1000000007
    • n − 1 factorization: 2 × 500000003
    • smallest primitive root: 5
  • 1000000009
    • n − 1 factorization: 23 × 32 × 7 × 1092 × 167
    • smallest primitive root: 13
  • 1000000021
    • n − 1 factorization: 22 × 3 × 5 × 19 × 739 × 1187
    • smallest primitive root: 2
  • 1234567891
    • n − 1 factorization: 2 × 32 × 5 × 3607 × 3803
    • smallest primitive root: 3
  • 2000000011
    • n − 1 factorization: 2 × 3 × 5 × 66666667
    • smallest primitive root: 2

Primes in Hexadecimal

  • 0xdefaced
    • n − 1 factorization: 22 × 32 × 5 × 1298951
    • smallest primitive root: 6
  • 0xfacade5
    • n − 1 factorization: 22 × 3 × 21914579
    • smallest primitive root: 6
  • 0x37beefed
    • n − 1 factorization: 22 × 3 × 5 × 1373 × 11353
    • smallest primitive root: 6
  • 0x3c0ffee1
    • n − 1 factorization: 25 × 7 × 2113 × 2129
    • smallest primitive root: 3
  • 0x3de1f1ed
    • n − 1 factorization: 22 × 11 × 23595857
    • smallest primitive root: 3
  • 0x3efface5
    • n − 1 factorization: 22 × 32 × 37 × 47 × 16883
    • smallest primitive root: 2
  • 0x5eedbed5
    • n − 1 factorization: 22 × 7 × 53 × 199 × 5393
    • smallest primitive root: 10

Floating Point

  • Single-precision: sign 1b, exponent 8b, fraction 23+1b implied (= 6 ~ 9 decimal sigfigs)
  • Double-precision: sign 1b, exponent 11b, fraction 52+1b implied (= 15 ~ 17 decimal sigfigs)

Special cases:

  • Exponent = 0
    • fraction = 0: (±) zero
    • fraction ≠ 0: “subnormal” number with implied bit set to 0 instead
  • Exponent = (FF or 3FF, maximum value in allocated bits)
    • fraction = 0: (±) infinity
    • fraction ≠ 0: NaN (sign ignored)
      • top explicit fraction bit = 1: “quiet NaN”
      • top explicit fraction bit = 0 (and rest ≠ 0): “signaling NaN”

(note: the commenting setup here is experimental and I may not check my comments often; if you want to tell me something instead of the world, email me!)