• bjorney@lemmy.ca
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    11 months ago

    Yeah but then ALL even numbers would be slow to compute because you would have to chain through every odd before you know that 2 is even.

    Depends on the expected distribution of input values

    • coloredgrayscale
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      Heuristic: keep it until 512, afterwards powers of 2, and numbers like 1000, 2000,…, 10000, 20000,… (regex: [0-9]000+)