<commit_before><commit_msg>add Quick Notes<commit_after>---
layout: post
title: "Quick Notes"
date: 2016-02-17 15:24:00
categories: Zzz
---

# Quick Notes

The expectation times of sampling to get a number twice from a discrete uniform distribution $$U(1,n)$$.

$$\begin{eqnarray}
E_n &=& 0 \\
E_{n-1} &=& \frac{1}{n}(1 + E_n) \\
E_{n-2} &=& \frac{2}{n}(1 + E_{n-1}) \\
E_{i} &=& \frac{n-i}{n}(1 + E_{i+1}) \\
E_{0} &=& \frac{n}{n}(1 + E_{1}) \\
\end{eqnarray}$$

$$\begin{eqnarray}
E_0 + 1 &=& \frac{\sum_{i=0}^{n} \frac{n!}{(n-i)!}n^{n-i}}{n^n} \\
  &=& e^n n^{-n}\Gamma(n+1,n)
\end{eqnarray}$$

{% highlight wolfram %}

Function[{n}, (e/n)^n * Gamma[n+1,n]][100]

{% endhighlight %}




{'fraction_non_alphanumeric': 0.28592162554426703, 'fraction_numerical': 0.05224963715529753, 'mean_word_length': 3.9285714285714284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3605981', 'n_tokens_mistral': 330, 'n_tokens_neox': 304, 'n_words': 61}