Question is : In how many ways can the letters be put into the envelopes, so that at least one letter goes to the correct address ?  Answer is 15.  All i could think of is : 4 envelop choices for each letter, so 4*4 = 16.  A little fertilizer for my withered grey-matter ?
There are n letters addressed to n eople at different addresses. The n addresses are typed on n envelopes.  A disgruntled secretary shuffles the letters and puts them in the envelopes in random order, one letter per envelope.  Find the probability that at least one letter is put in a correctly addressed envelope. [Hint: use the inclusion-exclusion formula.] What is the probability approximately, for large n ?    My attempt at a solution:  P(all correct) = $\frac{1}{n!}$  P(n-1 correct) = ${n \choose n-1} \frac{1}{n!} = \frac{1}{1!(n-1)!}$  ${n \choose n-1}$ ways of selecting n-1 correct letters.  P(n-2 correct) = ${n \choose n-2} \frac{1}{n!} = \frac{1}{2!(n-2)!}$  ...  P(n-n correct) = ${n \choose n-n} \frac{1}{n!} = \frac{1}{n!(n-n)!} = \frac{1}{n!}$  This all looks ok to me, but I tested this for a case of 4 people, (I think the theoretical value should be $\frac{9}{24}$ but obviously that is not what I got. Can someone correct my logic please? Also, with regards to the hint about inclusion/exclusion - where would that come in?  I read about derangements on Wikipedia but it did not make total sense to me (the derivation).  I would appreciate any advice whatsoever including references to other material.
Excel macro to highlight all cells that match value in current cell Style Guide: Bold, Italic, or Quotes When I Want to Emphasize Something Let’s say I have many lists of this kind on a page:   Click on the Foo button. Tick the Bar box. Click on the Save button.   How should I emphasize Foo, Bar, and Save?   Bold?   Click on the Foo button. Tick the Bar box. Click on the Save button.  Italic?   Click on the Foo button. Tick the Bar box. Click on the Save button.  Quotes?   Click on the “Foo” button. Tick the “Bar” box. Click on the “Save” button.    NOTE: I want the lists to be read as easy as possible. Determining if a file is a hard link or symbolic link? I'm creating a shell script that would take a filename/path to a file and determine if the file is a symbolic link or a hard link.   The only thing is, I don't know how to see if they are a hard link. I created 2 files, one a hard link and one a symbolic link, to use as a test file. But how would I determine if a file is a hard link or symbolic within a shell script?   Also, how would I find the destination partition of a symbolic link? So let's say I have a file that links to a different partition, how would I find the path to that original file? How can I prove that the following summation converges? $$\sum_{n=0}^\infty \sum_{k=0}^n \frac{(-1)^n}{(k+1)\times (n-k+1)}$$  I tried to prove that by proving that the following summation in in absolute value converges so the original one converges too, but that's incorrect.  Any other ideas? I have windows 10 home and from time to time I see a command line window popping up for less than a second. I want to find out which process is causing that. It's not very often that this window pops up so I need some tool that can run for a long time.  Does anyone have a good idea?  Regards Tobias how to use dom php parser Let $N$ be a normal subgroup of $G$. Let $G/N = \{gN : g \in G \}$. Show that the $(G/N, \circ, 1_{G/N})$ is a group, where:  $\circ : G/N \times G/N \rightarrow G/N$ is defined by $(gN \circ hN) = ghN$ and $1_{G/N} = 1*N$.  Thanks for your help. Anonymous Types - Are there any distingushing characteristics? Is there anything to use, to determine if a type is actually a anonymous type? For example an interface, etc?  The goal is to create something like the following...  //defined like... public static T Get&lt;T&gt;(this IAnonymous obj, string prop) {     return (T)obj.GetType().GetProperty(prop).GetValue(obj, null); } //...  //And then used like... var something = new { name = "John", age = 25 }; int age = something.Get&lt;int&gt;("age");   Or is that just the beauty of an anonymous type? Nothing to identify it self because it takes a new shape?  Note - I realize that you can write an extension method for the object class, but that seems like a little overkill, in my opinion. From a paper via Schneier on Security's  (emphasis mine):  In the case of AES-128, there is no known attack which is faster than the 2128 complexity of exhaustive search. However, AES-192 and AES-256 were recently shown to be breakable by attacks which require 2176 and 2119 time, respectively. While these complexities are much faster than exhaustive search, they are completely non-practical, and do not seem to pose any real threat to the security of AES-based systems. In this paper we describe several attacks which can break with practical complexity variants of AES-256 whose number of rounds are comparable to that of AES-128.  Is the implication here that AES-192 is stronger than AES-256? If so, in simple terms, how is that possible?  The attack exploits the fact that the key schedule for 256-bit version is pretty lousy -- something we pointed out in our 2000 paper -- but doesn't extend to AES with a 128-bit key.  Again, in simple terms, what does that mean? In practice, does this mean I should drop AES-256 in favor of its 128-bit counterpart, like Schneier recommends in the comments?  That being said, the key schedule for AES-256 is very poor. I would recommend that people use AES-128 and not AES-256. How to set up passwordless SSH access for root user I need to configure a machine so software installation can be automated remotely via SSH. Following , I was able to setup SSH keys so my user can access the machine without a password, but I still need to manually enter my password when I use sudo, which obviously an automated process shouldn't have to do.  Although my /etc/ssh/sshd_config has PermitRootLogin yes, I can't seem to be able to log in as root, presumably because it's not a "real" account with a separate password.  How do I configure SSH keys, so a process can remotely log in as root on Ubuntu? Does the everywhere differentiability of $f$ imply it is absolutely continuous on a compact interval? Suppose $f$ is differentiable everywhere on $[0,1]$. Must $f$ be absolutely continuous on $[0,1]$? I know this is true if $f'$ is integrable but I'm not sure in this more general case. Using methods from another class in the main? Can we see emission lines in stars? I read that stars show both absorption and emission lines. While how we see absorption lines is clear to me, I don't understand how (and when) we see the emission lines. Based on what I read in several of your threads such as  we should not be seeing emission lines at all, since all the emissions would come from the hotter interior but those can't reach the outside (unless I misunderstood this point), and the only emission we see is blackbody radiation. But then how do we see the few emission lines such as in the spectrum shown ? A Python module and package loading confusion Limiting OpenVPN bandwidth I'd like to give users a certain amount of traffic. Let's say user A gets 1 GB and user B get 5 GB.  I have a great script which does log all this info, however this script is called when the user disconnects (client-disconnect).  Now, my problem is the following: what if user A uses up 1 GB of data and simply never disconnects? He would be able to use thousands of GB's. Is there any way run a specific script periodically within OpenVPN (so no crontab, since OpenVPN passes environment variables). How to open a terminal from within Atom? I'm currently working with Atom, and sometimes I want to open a terminal on the directory my working file is. To do this, I usually have to open the folder in nautilus (right clicking the file in atom) and then I open a terminal on that directory from nautilus (right click).  I wonder if there is a way to open the terminal in the file directory without having to open nautilus first. Revision history & community wiki links show the same page I have to try to add a field called 'Name' to a bunch of different feature classes using python, and then access the name of the feature class to fill in the field. I have no idea how to even start this! I know I need a loop but that's all I know. Stopping users voting multiple times on a website I'm planning to add some vote up/vote down buttons to a website I run. This seems easy enough but I want to stop people voting multiple times. One solution would be to make them register before allowing them to vote but I'd prefer not to have to force them to register.   Is there are a reasonably straightforward way of doing this? Checking the IP address doesn't seem like a good solution, since it's possible that multiple users may come from the same IP address.   Cookies might be the answer, but a savvy user could delete the cookie. Any better ideas? Background image shows in front of 3D objects, not behind them. I've done a quick 3D track in blender and I'm trying to render my output, but the plate I used to track is showing up over my 3d objects.  I want to render the objects in the scene with an alpha channel and comp them over the plate I tracked. My renders however, are covered by the aforementioned plate.  Un-checking "Background Images" in the camera properties (only removes it from the viewport) isn't doing it for my render outputs.  Working on some production tests and am not really proficient with the software yet, my apologies in advance.