Prime numbers with LINQ not working int limit = 100; IEnumerable&lt;int&gt; primes = Enumerable.Range(2, limit - 2 + 1);  for (int i = 2; i*i &lt;= limit; i++) {     primes = (from item in primes where (item % i != 0) || (item == i) select item); }  foreach (int prime in primes) Console.WriteLine(prime);  Console.ReadKey();   This is my code to get prime numbers from 2 to 100. Why doesn't it work? Help, please.
Captured variable in a loop in C# I met an interesting issue about C#. I have code like below.  List&lt;Func&lt;int&gt;&gt; actions = new List&lt;Func&lt;int&gt;&gt;();  int variable = 0; while (variable &lt; 5) {     actions.Add(() =&gt; variable * 2);     ++ variable; }  foreach (var act in actions) {     Console.WriteLine(act.Invoke()); }   I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.  It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.  Is there a way to work round this limit to have each action instance have its own captured variable?
What counts as a "visual illusion" for a character that has Truesight? Creatures with Truesight, have a number of benefits, one of which is that they     automatically detect visual illusions and succeed on saving throws   against them   How do you determine if a spell creates a visual illusion? Is it as simple as "If the illusion creates something that the target can see, it's visual" or is there a more specific rule?  For some context, this came up into play in our last session where a Wizard PC cast Mental Prison on an enemy with Truesight an we weren't exactly sure how to rule it at the time and decided to research it after the session was over. Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected.  I'm not sure whether this will work or not, but intuitively I think the answer is yes. Title says it all, I don't see confirmation in  and a cursory google search seemed to say assume no and speculate about the pokemon bank. I was browsing PhD position offers in Europe on different websites and I was quite surprised to find that several offers contained sentences such as     University of X value equality and diversity. We strongly encourage women and BAME applicants for this position.    where BAME stands for Black, Asian and Minority Ethnicities; or     The research group aims to increase the number of women in scientific positions. Female candidates are therefore encouraged to apply.   Is it considered normal in the academic environment to discriminate between  candidates according to their race and/or gender for "egalitarian" reasons?   How is the choice of a candidate based on their gender and/or race considered "egalitarian"? The photon sphere is a spherical region in space where photons are forced to travel in an orbit at $r = \frac{3GM}{c^{2}}$.   Is it possible to detect these spheres?  What happens if I fall through it? What happens to a photon that tangentially hits the event horizon, wouldn't this also lead to a photon orbiting the black hole? EDIT Since neutron stars also might have a , do we know neutron stars that should have such a sphere? Motivation behind standard deviation? Suppose $x&gt;0$ and we have function $f(x)=\frac{\sin x}{x}$ how can we show $$\forall n \in \mathbb{N} :|f^{(n)}(x)|\leq \frac{1}{n+1}$$ I need a hint to show this property .Thanks in advance . I tried for $n=1 ,2$  by finding maximum of $|f'| ,|f''|$ but I get stuck to show for $n$ Using a naked black hole as a mirror? The YouTube video is a good example how the gravity of this merging binary black holes bend light around themselves. Easy way to determine the virtualization technology of a Linux machine? Can I use an nVidia Geforce 9600GT for triple-monitor? Possible Duplicate:          My work PC has (as you can guess from the title) a single Geforce 9600GT card. According to the  for this card, both DVI ports are Dual-Link DVI. Both are currently in use on Dell 19" 1280x1024 screens. I'm running Windows 7, with Aero enabled, for what that's worth.  What I'm wondering is if I can use a standard DVI splitter cable to drive a third screen from one of the ports -- specifically a Samsung 22" 1680x1050. I'm really outgrowing the two-screen setup, and am strongly considering bringing in my home monitor (which is almost never used) to bolster my usable space. If I can't, then my alternative is to replace one of these Dells with that Samsung, to give me at least a "little" more space.  (Before you ask, there's probably no chance I can get my company to spring for a second video card and third monitor. Even if I could, it would not be politically expedient, as a number of my other coworkers are already pretty jealous at my setup.) Induction proof: n lines in a plane Assume that there are $n$ infinitely long straight lines lying on a plane in such a way that no two lines are parallel, and no three lines intersect at a single point. Prove that these lines divide the plane into $\frac{n^2+n+2}{2}$ regions. (Hint: Any two non-parallel straight lines on a plane must intersect at exactly one point.)  Can someone tell me where to start here? I know to prove the base where $n=0$, but don't know how to proceed.  Any help is greatly appreciated! Does $\pi$ contain all possible number combinations? I came across the :    Which states:     $\pi$ Pi      Pi is an infinite, nonrepeating $($sic$)$ decimal - meaning that   every possible number combination exists somewhere in pi.  Converted   into ASCII text, somewhere in that infinite string of digits is the   name of every person you will ever love, the date, time and manner    of your death, and the answers to all the great questions of    the universe.   Is this true? Does it make any sense ? Why does bash say No such file or directory when the file is on the path Does anyone know whether there are only finitely many of primes of the form $6^{2n}+1$, where $n$ zero or any natural number? Map matching links and ideas? I'm using OpenStreetMap and its vectorial road network and I'd like to implement a map matcher algorithm.   Currently I'm able, for each GPS position, to retrieve the nearest road segment and calculate the projection of this position to that segment, like on this image (Red pin is the pure GPS position, in blue the mapped segment and in Green the mapped position):    However, due to the lack of accuracy of the GPS, sometimes the mapped position jumps from segment to another and can provide some inconsistent mapped position from time to time.  My current algorithm is very basic : from the pure GPS position, I get the nearest segment and decide that the mapped matched position is on this one. I know that this can be really improved.  I can imagine that taking the vehicle direction into account will improve the map matching but do you know any other approach that would enable me to improve my map matcher ?  I seek any link, and/or open source software? Why do Google search results include pages disallowed in robots.txt? I have some pages on my site that I want to keep search engines away from, so I disallowed them in my robots.txt file like this: User-Agent: * Disallow: /email  Yet I recently noticed that Google still sometimes returns links to those pages in their search results.  Why does this happen, and how can I stop it? Background: Several years ago, I made a simple web site for a club a relative of mine was involved in.  They wanted to have e-mail links on their pages, so, to try and keep those e-mail addresses from ending up on too many spam lists, instead of using direct mailto: links I made those links point to a simple redirector /  script running on my own site.  This script would return either a 301 redirect to the actual mailto: URL, or, if it detected a suspicious access pattern, a page containing lots of random fake e-mail addresses and links to more such pages.  To keep legitimate search bots away from the trap, I set up the robots.txt rule shown above, disallowing the entire space of both legit redirector links and trap pages. Just recently, however, one of the people in the club searched Google for their own name and was quite surprised when one of the results on the first page was a link to the redirector script, with a title consisting of their e-mail address followed by my name.  Of course, they immediately e-mailed me and wanted to know how to get their address out of Google's index.  I was quite surprised too, since I had no idea that Google would index such URLs at all, seemingly in violation of my robots.txt rule. I did manage to submit a removal request to Google, and it seems to have worked, but I'd like to know why and how Google is circumventing my robots.txt like that and how to make sure that none of the disallowed pages will show up in their search results. Ps. I actually found out a possible explanation and solution, which I'll post below, while preparing this question, but  in case someone else might have the same problem.  Please do feel free to post your own answers.  I'd also be interested in knowing if other search engines do this too, and whether the same solutions work for them also. Proof of properties of injective and surjective functions. I'd like to see if these proofs are correct/have them critiqued.     Let $g: A \to B$ and $f: B \to C$ be functions.  Then:   (a) If $g$ and $f$ are one-to-one, then $f \circ g$ is one-to-one.   (b) If $g$ and $f$ are onto, then $f \circ g$ is onto.   (c) If $f \circ g$ is one-to-one, then $f$ is one-to-one?   (d) If $f \circ g$ is one-to-one, then $g$ is one-to-one?   (e) If $f \circ g$ is onto, then $f$ is onto?   (f) If $f \circ g$ is onto, then $g$ is onto?     (a)  Let $a,b \in A$.  If $(f \circ g)(a)=(f \circ g)(b)$, then $f(g(a))=f(g(b))$.  Since $f$ is one-to-one, we know that $g(a)=g(b)$.  And, since $g$ is one-to-one is must be that $a=b$.  Hence $f \circ g$ is one-to-one.    (b) Since $f$ is surjective we know that for all $c \in C$ there is a $b\in B$ such that $f(b)=c$.  Since $g$ is surjective, there is a $a \in A$ such that $g(a)=b$.  Hence, for all $c \in C$ there is an $a \in A$ such that $(f \circ g)(a)=f(g(a))=f(b)=c$.    (c)  This is false.  Let $A=\{1\}$, $B=\{1,2\}$, and $C=\{1\}$. Define $g(1)=1$ and $f(1)=f(2)=1$. Then $f \circ g$ is injective, but $f$ is not injective.    (d)  This is true.  Let $a,b \in A$ where $a \neq b$.  If $(f\circ g)(a)\neq(f\circ g)(b)$, then $f(g(a))\neq f(g(b))$.  Hence $g(a) \neq g(b)$.  (e)  Since $f \circ g$ is surjective, then for every $ c \in C$ there is an $a \in A$ such that $f(g(a))=c$.   Let $b = g(a)$.  Then $b \in B$ and $f(b)=g(f(a))=c$.  Thus $f(b)=c$.  Hence $f$ is surjective.  (f)  Using the same set up as part (c), we have that $g$ is not surjective since there is nothing in $A$ such that $g$ will go to 1. Prove: If $a\mid m$ and $b\mid m$ and $\gcd(a,b)=1$ then $ab\mid m$ Prove: If $a\mid m$ and $b\mid m$ and $\gcd(a,b)=1$ then $ab\mid m$  I thought that $m=ab$ but I was given a counterexample in a comment below.  So all I really know is $m=ax$ and $m=by$ for some $x,y \in \mathbb Z$. Also, $a$ and $b$ are relatively prime since $\gcd(a,b)=1$.   One of the comments suggests to use , i.e., $aq+br=1$ for some $q,r\in\mathbb{Z}$. Any more hints?  New to this divisibility/gcd stuff. Thanks in advance! Using modified copyrighted music in non-commercial games Background: I'm making a retro style game for both fun, and an unofficial contest.   I have bought a song, song X. However, I then found notation for song X, and all the instruments. So basically, it's a program recreating song X in a sense.  I took the notation, and used another program to make it sound like a chiptune does (just for the fun of it, and it sounds good :P). However, I would like to use this in my game. It's non-commercial, but is this allowed? I would've said yes, because I'm not actually using the original, copyrighted song.  I think the main point is can I:   Use the music with no reference to the author Use the music with a reference, since it's non-profit. Not use the music at all since the melody and rhythm is copyright. I have to compute this integral $$\int_{0}^{\infty} \frac{dt}{1+t^4}$$ to solve a problem in a homework. I have tried in many ways, but I'm stuck. A search in the web reveals me that it can be do it by methods of complex analysis. But I have not taken this course yet. Thanks for any help.