$\binom{p^a-1}{k}\equiv(-1)^k\pmod{p}$
Combinations of sets raised to the power of a prime modulus: $\binom{p^{\alpha}-1}k \equiv (-1)^k \pmod p$
Exists a dedicated non-O(n²) Algorithm for avoiding to have overlapping elements? I am generating positions in a random fashion.  In the game world, instantiated elements have a radius, and shouldn't overlap.  The problem is that they will overlap because I use a usual random number generator combined with other fanciness. I can't use other random number generation algorithms where I can guarantee that the elements will never overlap.  A way to solve this is to use a spatial data structure and search for the nearest neighbors in that tree. When I insert an element into that tree, I update it accordingly.  This solution would do the work and it would be fast but my question is:  Is there a dedicated algorithm without that Tree implementation complexity which is faster than O(n²)? Lewis Carroll's Pillow Problem via Bayes' Theorem In Pillow Problems and a Tangled Tale Lewis Carroll presents the following problem:     A bag contains a counter, known to be either white or black. A white counter is put in, the bag is shaken, and a counter is drawn out, which proves to be white. What is now the chance of drawing a white counter?   One can easily reason that in the end, the bag must be in one of three states:   Black remains, new white taken New white remains, original white taken Original white remains, new white taken   In two of those states, a white counter remains to be drawn. Therefore, the chance is 2/3.  How can one arrive to this answer using Bayes' theorem? It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root.  Upon running sudo -i, sudo will create an environmental variable called SUDO_USER, which contains the original user's username.  Is there a way to log ALL commands within syslog with something akin to the following syntax:  ${TIME/DATE STAMP}: [${REAL_USER}|${SUDO_USER}]: ${CMD}   An example entry would be:  Sat Jan 19 22:28:46 CST 2013: [root|ksoviero]: yum install random-pkg   Obviously it doesn't have to be exactly the above syntax, it just has to include a minimum of the real user (eg. root), the sudo user (eg. ksoviero), and the full command that was run (eg. yum install random-pkg).  I've already tried snoopy, but it did not include the SUDO_USER variable. Is there a prime which is the form of $10^n + 1$ except $2, 11, 101$? Is there a prime which is the form of $10^n + 1$ except $2, 11, 101$?  I confirm there isn't such prime for $n &lt; 64$. How many days a year is a U.S. citizen allowed to stay in Morocco? I arrived in Morocco in October of 2014 and renewed my visa by traveling to Spain by ship for a day and getting my passport stamped again in January of 2015. My question is, am I allowed to leave the country and repeat this process this year by traveling again to another country, other than my own in order to return to Morocco for another 90 days? And if so, how many times a year is this allowed? I have read 180 days on some websites but there is not any clear answers anywhere about this that I can find. Extended sound of thunder Custom counter steps twice when invoked from caption using caption package How can I find $f(0)$, $f'(0)$, and $f'(x)$ given that  $f(x+y)=f(x)+f(y)+x^2y+xy^2$  and  $\lim_{x\to0}\frac{f(x)}{x}=1$. Is it possible to include the tag-wiki associations in the Data Explorer? To do this would require two additional columns in the postTags table that associate a tag wiki excerpt and a tag wiki to their tag.  The tag wiki data is already available in the posts table. But there is no way to associate this data with its tags. The SEDE schema lacks the required columns to link the tag excerpt and the tag wiki to the tags table.  Additionally, the postTypes table only lists three posts types. It makes no mention of tag-wiki and tag excerpt posts. Perhaps the postypes table can be updated to reflect the additional post types? Suppose $Y_1, \ldots, Y_n$ is a random sample from a normal distribution with mean $\mu$ and variance $\sigma^2$. Let $S^2$ be the sample variance, which is unbiased for $\sigma^2$.  GOAL: Show that $S = \sqrt{S^2}$ is a biased estimator of $\sigma$.  I realize that $(n-1)S^2/ \sigma ^2$ is chi-square with $(n-1)$ degrees of freedom.  I am given that $$E(S) = E\left[\frac{\sigma}{\sqrt{n-1}} \left[\frac{(n-1)S^2}{\sigma^2}\right]^{1/2}\right] = \frac{\sigma}{\sqrt{n-1}} \int_0^\infty v^{1/2} \frac{1}{\Gamma[(n-1)/2] 2^{(n-1)/2}} v^{(n-1)/2} e^{-v/2} \, dv$$  Can anyone help me understand why they have $v^{1/2}$ and $v^{(n-1)/2}$ (combining them $v^{n/2}$ as I think it should be $v^{1/2}$ and $v^{\frac{(n-1)}{2}-1}$ (combining both terms give $v^{(n-2)/2}$ since the pdf for chi-square distribution is $$ f(v) = \frac{v^{(x/2)-1} e^{-v/2}}{2^{x/2}\Gamma(x/2)},$$ where $x$ is degree of freedom?  Could anyone please tell me which one is the correct answer with explanation?  Thank you Academic rank equivalence between the UK and the US systems I wrote a bash script as below:  #!/bin/bash echo "Enter a file name" read filename import -window root $HOME/Desktop/$filename.png   I expected this script to take a screen shot and save the image with the given filename on my desktop.  Problem:  My Ubuntu terminal is giving error:     import: Command Not Found How to do a generalized linear model with multiple dependent variables in R? How do I calculate a time delta in my Google Spreadsheets? I've got a Google Spreadsheet that looks roughly like this:   Date        | Start time  | End time    | Minutes  ------------+-------------+-------------+-----------  1/11/2012   | 11:39       | 12:41       | ?!  ------------+-------------+-------------+-----------              |             |             |    Right now if I fill in the number of minutes between the two times of day by hand. Is there a straight-forward way to calculate a time delta and have the spreadsheet do it for me? What is the connection between special and general relativity? What is the connection between  and ? As I understand general relativity does not need the assumption on speed of light constant. It is about the relation between mass and spacetime and gravity. Can general relativity be valid without special relativity? Tokenizing strings in C I have been trying to tokenize a string using SPACE as delimiter but it doesn't work. Does any one have suggestion on why it doesn't work?  Edit: tokenizing using:  strtok(string, " ");   The code is like the following  pch = strtok (str," "); while (pch != NULL) {   printf ("%s\n",pch);   pch = strtok (NULL, " "); } If $E[X|Y]=Y$ almost surely and $E[Y|X]=X$ almost surely then $X=Y$ almost surely Find the general solution of $xy''-(1+x)y'+y=x^2$ knowing that the homogeneous equation has the following solution: $e^{ax}$, where $a$ is a parameter you have to find.  I have found that $a=1$ or $a=1/x$. If parsing the output of ls is dangerous because it can break on some funky characters (spaces, \n, ... ), what's the best way to know the number of files in a directory?  I usualy rely on find to avoid this parsing, but similarly, find mydir | wc -l will break for the same reasons.  I'm working on Solaris right now, but I'm looking for a answer as portable across different unices and different shells as possible. Sylvester's theorem states that the product of $k$ consecutive integers $&gt;k$ has a prime factor $p&gt;k$. Erdős gave a short proof for it, but I can't find Erdős's proof online. Can anyone give a sketch of the proof? Thanks.