I saw on  that a formula for derangements is   $\text{Round}\left[\frac{n!}{e}\right]$  However, how did they arrive at this elegant formula?  Does it have to do with $ !n=n! \sum _{k=0}^n \frac{(-1)^k}{k!}$
I understand the whole concept of Rencontres numbers but I can't understand how to prove this equation  $$D_{n,0}=\left[\frac{n!}{e}\right]$$  where $[\cdot]$ denotes the rounding function (i.e., $[x]$ is the integer nearest to $x$). This equation that I wrote comes from solving the following recursion, but I don't understand how exactly the author calculated this recursion.  $$\begin {align*}  D_{n+2,0} &amp; =(n+1)(D_{n+1,0}+D_{n,0}) \\ D_{0,0} &amp; = 1 \\ D_{1,0} &amp; = 0  \end {align*} $$
We have set up GA on several websites to gather information about traffic to the site. We know about the organic keywords that are displayed under the Acquisition section of the traffic report. But we have been asked to find a way to display "not provided" keywords typed in by the end user in our Google Analytics report.  Is it possible to accomplish this? I'm having trouble restarting a 2D game when the user presses the "New Game" button.  Structure of my game:  The game has several 'screens': Opening screen, instructions screen, main game screen, and a game-over screen.  Each screen is an instance of a class: OpeningScreen class, GameScreen class, etc.  There is a class named Main. This class has three roles.   It's the JFrame (the window) of the program. It has the main method - first class to run. It has a method that change's screens.   When the program starts, this class runs. When it first runs:   Creates a new instance of itself (it's a JFrame-type class). Creates an instance of every 'screen-class'. The constructor of each 'screen-class' takes the instance of Main as an argument: (aka: GameOverScreen gameOverScreen = new GameOver(this)). Creates a new JPanel named mainPanel, and adds it to the JFrame. Any screen to be displayed will be contained in this JPanel (The screens are also JPanel-type classes).   How the changeScreen() method works:  The signature of changeScreen() is this: changeScreen(JPanel from, JPanel to).  Whenever a screen needs to be changed, the current screen that is displayed calls this method, like so: main.changeScreen(this, main.InstructionsScreen). It removes the previous screen from mainPanel and adds the new screen to mainPanel. As said, these screens are created when the program launches.  This is the method that changes screens:   public void changeScreen(JPanel from, JPanel to){      mainPanel.remove(from);     mainPanel.add(to);      mainPanel.revalidate();     mainPanel.repaint();  }   My problem:  After a game is finished, the Game class calls the changeScreen method: main.changeScreen(this, main.GameOverScreen) .  This replaces the game screen with a game over screen. Pressing the "New Game" button in the game-over screen, calls main.changeScreen(this, main.GameScreen) .  The problem: Pressing the "New Game" button in the game-over screen, indeed displays once again the instance of the Game class. But this is the old instance, so the game is not restarted. It's already finished.  I tried to do the following changes in changeScreen():  public void changeScreen(JPanel from, JPanel to){      mainPanel.remove(from);      if(to.equals(gameScreen)){         gameScreen = null;         gameScreen = new GameScreen(this);     }     mainPanel.add(gameScreen);      mainPanel.revalidate();     mainPanel.repaint();  }   This should reset the gameScreen object. But this creates a delay of about 10 seconds when pressing the "New Game" button.  What would be a good way of restarting the game?  Thank you How to watch videos in Amazon Prime Instant Video? I want to buy a new MacBook Pro, from Apple. However I want to run Snow Leopard instead of Lion.  I did some Google searches and found a few success stories of people who got SL to run on their early-2011 MBPs. I didn't find much of any experiences of people doing the same on a late-2011 MBP though, so I'm wondering (and really hoping!) if it's possible? Geometric proof for irrationality of $\pi$ Is there a geometric proof for irrationality of $\pi$? That would be neat. Casting of objects to dynamic types at runtime Which command / configuration file controls the open file limits on OS X?  Is there a different command for OS X 10.5 / 10.6 / 10.7?  The options I explore below are ulimit, sysctl, and launchctl  "Too many open files" is apparently a common error on Leopard, perhaps other versions of OS X:        There are many (related?) ways to view the open file limits:  $ ulimit -a core file size          (blocks, -c) 0 data seg size           (kbytes, -d) unlimited file size               (blocks, -f) unlimited max locked memory       (kbytes, -l) unlimited max memory size         (kbytes, -m) unlimited open files                      (-n) 2048 pipe size            (512 bytes, -p) 1 stack size              (kbytes, -s) 8192 cpu time               (seconds, -t) unlimited max user processes              (-u) 512 virtual memory          (kbytes, -v) unlimited   $ launchctl limit cpu         unlimited      unlimited       filesize    unlimited      unlimited       data        unlimited      unlimited       stack       8388608        67104768        core        0              unlimited       rss         unlimited      unlimited       memlock     unlimited      unlimited       maxproc     1024           2048            maxfiles    2048           4096         $ sysctl -a | grep files kern.maxfiles = 32768 kern.maxfilesperproc = 16384 kern.maxfiles: 32768 kern.maxfilesperproc: 16384 kern.num_files: 2049   It has been claimed in some of the above posts that these can be modified with the following commands:  sudo launchctl limit maxfiles 16384 32768 sudo ulimit -n 32768 sudo sysctl -w kern.maxfilesperproc=16384 sudo sysctl -w kern.maxfiles=32768   However, out of the above commands, only the sysctl commands have any apparently effect (i.e. ulimit -n and launchctl limit show no change after the above commands have been entered, while sysctl -a does show the requested changes).  The corresponding locations to change these parameters for the OS are:  /etc/sysctl.conf /etc/launchd.conf   I also discovered one  which reads that ulimit only controls the current shell.  How can I adjust upwards the max files / max open files limits on macOS? Prove $X$ is compact iff for each family $\{ F_\alpha\}_{\alpha\in I}$ of closed subsets of $X$ with the FIP, we have $\cap F_\alpha\neq\varnothing$. I'm reading Intro to Topology from Mendelson.  The entire problem statement is,  Prove that $X$ is compact if and only if for each family $\lbrace F_\alpha\rbrace_{\alpha\in I}$ of closed subsets of $X$ that has the finite intersection property, we have $\bigcap_{\alpha\in I} F_\alpha\neq\varnothing$.  My attempt at the proof is as follows:  First assume that $X$ is compact. For the sake of contradiction, suppose that there exists a family $\{ F_\alpha\}_{\alpha\in I}$ of closed subsets of $X$ with FIP such that $\bigcap_{\alpha\in I} F_\alpha=\varnothing$. Since $X$ is compact if $\lbrace F_\alpha\rbrace_{\alpha\in I}$ any family of closed sets such that $\bigcap_{\alpha\in I} F_\alpha=\varnothing$, then there exists a finite set of indices $\lbrace \alpha_1,\dots,\alpha_n\rbrace$ such that $\bigcap\limits_{i=1}^n F_{\alpha_i}=\varnothing$. Yet, since $\lbrace F_\alpha\rbrace_{\alpha\in I}$ has the finite intersection property, for every finite index of $J\subset I$, $\bigcap\limits_{\alpha\in I} F_\alpha\neq\varnothing$.  Suppose now that $X$ is not compact, that is, there exists an open cover $\lbrace U_\alpha\rbrace_{\alpha\in I}$ of $X$ with no finite subcover. Consider the set $F_\alpha=C(U_\alpha).$ Then $\lbrace F_\alpha\rbrace_{\alpha\in I}$ is a collection of closed subsets of $X$ with the finite intersection property and were $\bigcap_{\alpha\in I} F_\alpha=\varnothing.$  Thanks for any feedback! What are drawbacks or disadvantages of singleton pattern? The  is a fully paid up member of the 's , but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for , and while you have to be a bit careful about multithreading issues (like any class actually), I fail to see why they are so awful.  Stack Overflow especially seems to assume that everyone agrees that Singletons are evil. Why?  Please support your answers with "facts, references, or specific expertise" When shooting in mRAW or sRAW, how does the camera generate smaller files? Most mid- and high-end DLSRs offer two or three sizes for RAW capture.  When the camera is generating the medium or small sized RAW files, how does it make them smaller?  Does it capture less information onto the sensor?  Does it capture the full amount of information and then apply some sort of in-camera compression?  Does it do something else that I'm not describing? I have a cheap Chinese made tablet from Dubai called the Crony Dubai (www.cronydubai.com). It has a micro B, mini HDMI and a USB labeled as "Host" as well as a micro SD slot. It came with a micro B to USB adapter in box, and its running Ice Cream Sandwich. Is there a way to load Ubuntu on it? Also the tablet is very buggy and crashes often, would that be due to the tablet or the OS? How do I withdraw all money from my HSA account as a non-resident? I have lived in US for 5 years, and I (still) have an HSA account with BoA. Now I am living in Europe, and there's a fat chance I'll ever go back to live in US, so I would like to withdraw the money from my HSA, pay the due taxes, of course, and just be able to use them. How exactly I go about that?  Thanks in advance. 32-bit vs. 64-bit systems Consistent, complete, and generalized description of the quantum harmonic oscillator How to select records with maximum values in two columns? Glassware with scratched/etched surfaces generate more bubbles (, ). Why these rough surfaces allow easier heterogeneous nucleation? How do I get a block with data to place myself? Can you help me with my software licensing issue? Are there alternatives to LibreOffice? My supervisor asked me to find out which distribution represents a particular situation.  I have a VoIP generator that generates calls "uniformly" distributed between callers. This means that the volume per caller distribution is "almost" uniformly distributed between a minimum and maximum. So by running a test with 10000 users and a min value equal to 30 calls per week and a max value equal to 90 calls/week i obtain that not all the users respect this limits: we have some users that generate &lt;30 calls and some other users that generate >90 calls. It is clear that the obtained distribution is not uniform.  The situation is this:    He said that i have to perform a sort of numerical process in order to find some formulas that could define this distribution. Initially, as wrote before,we wanted to obtain a uniform (min,max) distribution (the green area in the figure) but this is not the case as proved with chi-square test.  Moreover the curve in figure is not symmetric, the probability of call generation below 30 call/week and greater that 90 call/week are not identical (it is high for 90calls/week). The variability of the number of generated call increases with the increasing call generation rates.   "Actually implementation of this distribution is nothing but assigning different call rates in a range for users in domain which indicates implementation of several delta functions. As the call rates increases the variability of the generated calls also increases with the average call rate and this leads to the asymmetric behavior of the curve." [cit. from the Voipgenerator documentation]  Someone can help me?I think that now i cannot use Q-Q plot because i don't know which theoretical distribution i have to use in order to compare it with my empirical data.  Sorry if I have stressed with a similar problem a few weeks ago, but initially we thought we could change the implementation, but now we cannot. Hence i have to discover the type of the distribution i obtained and i don't know how can i do this.