Skip to content

Instantly share code, notes, and snippets.

@espadrine
Created February 12, 2021 18:52
Show Gist options
  • Select an option

  • Save espadrine/626ba7637c5edd76fe82f83ee2efa511 to your computer and use it in GitHub Desktop.

Select an option

Save espadrine/626ba7637c5edd76fe82f83ee2efa511 to your computer and use it in GitHub Desktop.

Revisions

  1. espadrine created this gist Feb 12, 2021.
    9 changes: 9 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    You might know the birthday problem:
    “it only takes 23 people so that two have the same birthday”.

    But do you know the Slack username color problem?

    Slack gives random colors to each user in compact view.
    But there’s only 51 colors to choose from,
    so as soon as you are 9 in a channel,
    odds are that two share the same color.
    13 changes: 13 additions & 0 deletions birthday.jl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    function pcol(k, n)
    1 - factorial(big(k)) * binomial(big(n), k) / big(n)^k
    end

    function mink(n)
    k = 0
    while pcol(k, n) < 0.5
    k += 1
    end
    k
    end

    println(mink(51))
    53 changes: 53 additions & 0 deletions colors.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    [
    "235e5b",
    "2b6836",
    "385a86",
    "3c8c69",
    "3c989f",
    "43761b",
    "4bbe2e",
    "4ec0d6",
    "50a0cf",
    "53b759",
    "5870dd",
    "5a4592",
    "5b89d5",
    "619a4f",
    "674b1b",
    "684b6c",
    "73769d",
    "827327",
    "8469bc",
    "84b22f",
    "8d4b84",
    "8f4a2b",
    "902d59",
    "965d1b",
    "99a949",
    "9b3b45",
    "9d8eee",
    "9e3997",
    "9f69e7",
    "a2a5dc",
    "a63024",
    "a72f79",
    "aba727",
    "b14cbc",
    "bb86b7",
    "bc3663",
    "bd9336",
    "d1707d",
    "d55aef",
    "d58247",
    "db3150",
    "dc7dbb",
    "dd8527",
    "de5f24",
    "df3dc0",
    "e06b56",
    "e0a729",
    "e475df",
    "e7392d",
    "e96699",
    "ea2977"
    ]