Let A = $a_1a_2 \cdots a_n$ and let $c_i$ be inverse of $(\frac{A}{a_i})$(mod $a_i$). Now, let k = $\sum_{i=1}^n\frac{A}{a_i} \cdot c_i \cdot b_i$ (mod A). Using this, answer the following: Find the smallest natural n such that it leaves remainder 0,1,2,3 respectively divided by 2,3,5,7 respectively. Answer: We ignore the divisibility by 2 for now, and use Chinese Remainder Theorem on the numbers. We get n = 3$\cdot$5$\cdot$3 + 3$\cdot$7$\cdot$2 + 5$\cdot$7$\cdot$2 (mod 105) $\equiv$ 157 $\equiv$ 52 (mod 105) and we also have 2|52 so that 52 is the answer. Approach: First take 3$\cdot$5 as take 7 equal to $a_1$ now want to find the inverse of this mod 7 which is just 1 and wanted the congruence mod 7 as 3 (want it congruent to 3 mod 7) and have $\frac{A}{a_i}$ which is 3$\cdot$5 into its inverse $c_i$ which is 1 and then $\cdot$ $b_i$ equal to 3 so have 3$\cdot$5$\cdot$3 + now check for 5, 3$\cdot$7 is already congruent to 1 mod 5 so don't have to add any inverse here to make this 1 and want the congruence to be 2 so + 3$\cdot$7$\cdot$2, and 5$\cdot$7 is congruent to 2 mod 3 and want to find its inverse which is 2 so + 5$\cdot$7$\cdot$2 Question: I don't really know how to get the whole n = 3$\cdot$5$\cdot$3 + 3$\cdot$7$\cdot$2 + 5$\cdot$7$\cdot$2 (mod 105) reasonably by using the definition for k. Could someone please help explain how exactly to come up with it
I understand there is a method for solving simultaneous modular equations. For example; $$x = 2 \mod{3}$$ $$x = 3 \mod{5}$$ $$x = 2 \mod{7}$$ We find numbers equal to the product of every given modulo except one of them - giving $5 \cdot 7$, $3 \cdot 7$ and $3 \cdot 5$. We then find the multiplicative inverses of these numbers with modulo equal to the number missing from the product. The numbers found are then 2, 1 and 1 in this case. The value of x is then given by: $$x = 2 \cdot (5 \cdot 7) \cdot 2 + 3 \cdot (3 \cdot 7) \cdot 1 + 2 \cdot (3 \cdot 5) \cdot 1 = 233 = 23 \mod{3\cdot5\cdot7}$$  But I do not understand how this method correctly gives the value of $x$. I understand that the Chinese remainder theorem proves that there is a unique value of $0\le x \lt 3\cdot5\cdot7 \mod{3\cdot5\cdot7}$ but can someone please explain why this method finds this value of x?
Compare nullable types in Linq to Sql I have a Category entity which has a Nullable ParentId field. When the method below is executing and the categoryId is null, the result seems null however there are categories which has null ParentId value.  What is the problem in here, what am I missing?  public IEnumerable&lt;ICategory&gt; GetSubCategories(long? categoryId) {     var subCategories = this.Repository.Categories.Where(c =&gt; c.ParentId == categoryId)         .ToList().Cast&lt;ICategory&gt;();      return subCategories; }   By the way, when I change the condition to (c.ParentId == null),  result seems normal. How do I make a 3 dimensional character out of flat picture? I have a cartoon character (a lion) that is part of my business logo that I want to put into Blender and animate it somehow. Is there any way I can take a flat picture (JPEG) and transform it into a 3D image and then animate it in Blender? After installing Telegram Desktop on Ubuntu 16.04 by these commands:  sudo add-apt-repository ppa:atareao/telegram sudo apt-get update sudo apt-get install telegram   I get this error:  $ telegram telegram: Panic - Unable to find your tty (pts/2) in /var/run/utmp How to open a PDF file from terminal? I used to work on the Mac terminal before and I used:   open file2open.pdf   and the PDF file would be opened on preview or whatever my default viewer was. When I use it in the terminal in Ubuntu I get this error message:   Couldn't get a file descriptor referring to the console How do I get help for "echo" or other bash commands? man echo works. but out of curiosity, does echo have something similar to a --help flag/parameter? Upgrading straight handlebars to drop handlebars Why was Peeves in Hogwarts? Peeves was a poltergeist. It generally irritated people and rather then helping them as well as making fun of them.   Why was Peeves in the school? What is/was the job or work assigned to Peeves? Change files with Editor that need sudo permissions I want to change files with KomodoEdit that need sudo permissions. I can't start KomodoEdit with sudo, though (for whatever reason). Can I somehow grant Komodo permission to edit those files (in particular I am talking about apache2 files and /etc/hosts)? It is true that $P(X&gt;t+s|X&gt;t)=P(X&gt;s)$ for certain values $t$ and $s$.  However, how can I show that this still holds if:   $T$ is a continuous random variable. That is $P(X&gt;T+s|X&gt;T)=P(X&gt;s)$ Both $T$ and $S$ are continuous RVs: $P(X&gt;T+S|X&gt;T)=P(X&gt;S)$   All the random variables are independent. How to put small numbers outside the pie slices without making a mess I'm new to LaTeX and need some help with my figures. I would like to to put small numbers outside the pie slices without making a mess. Having found this thread , I tried it out, but didn't get all the way through with it. Right now, my pie looks like this:    I used the following code:  \usepackage{tikz,stackengine} \makeatletter  \tikzstyle{chart}= [legend label/.style={font={\scriptsize},anchor=west,align=left}, legend box/.style={rectangle, draw, minimum size=5pt}, axis/.style={black,thin,-&gt;}, axis label/.style={anchor=east,font={\tiny}}]  \tikzstyle{bar chart}=[ chart, bar width/.code={     \pgfmathparse{##1/2}     \global\let\bar@w\pgfmathresult}, bar/.style={thin, draw=black}, bar label/.style={font={\bf\small},anchor=north}, bar value/.style={font={\footnotesize}}, bar width=.75,]  \tikzstyle{pie chart}= [chart, slice/.style={line cap=round, line join=round, thin, draw=black}, pie title/.style={font={}}, slice type/.style 2 args={     ##1/.style={fill=##2},     values of ##1/.style={}}]  \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground}  \newcommand{\pye}[3][]{     \begin{scope}[#1]         \pgfmathsetmacro{\curA}{90}         \pgfmathsetmacro{\r}{1}         \def\c{(0,0)}         \node[pie title] at (270:1.3) {#2};         \foreach \v/\s in{#3}{             \pgfmathsetmacro{\deltaA}{\v/100*360}             \pgfmathsetmacro{\nextA}{\curA + \deltaA}             \pgfmathsetmacro{\midA}{(\curA+\nextA)/2}             \path[slice,\s] \c             -- +(\curA:\r)             arc (\curA:\nextA:\r)             -- cycle;             \pgfmathsetmacro{\d}{max((\deltaA * -(.5/50) + 1) , .5)} %%%              %\pgfmathprintnumberto{#3}{\fnum}  %\ifthenelse{\lengthtest{#3 pt &lt; 10pt}} %{\path (O) -- ++ (\midangle:\radius) %node[inner sep=0,align=left,anchor=west,rotate=\midangle](nums#3)    {~~\fnum};} %{\path (O) -- ++(\midangle:\innerpos)  %node {\scalefont{#3}\beforenumber\fnum\afternumber};}           %%%                         \begin{pgfonlayer}{foreground}                 \path \c -- node[pos=\d,pie values,values of \s]{$\v\%$} +    (\midA:\r);             \end{pgfonlayer}             \global\let\curA\nextA}     \end{scope}}  \newcommand{\legend}[2][]{     \begin{scope}[#1]         \path         \foreach \n/\s in {#2}         {++(0,-5pt) node[\s,legend box] {} +(2pt,0) node[legend label]     {\n}};     \end{scope}}      \begin{document}         \begin{center}      \begin{figure}[H]     \centering \begin{tikzpicture} [pie chart, slice type={A}{black!0}, slice type={B}{black!10}, slice type={C}{black!20}, slice type={D}{black!30}, slice type={E}{black!40}, slice type={F}{black!50}, slice type={G}{black!60}, slice type={H}{black!70}, pie values/.style={font={\small}}, scale=2]  \pye{1994}{6.1/A, 2.9/B, 0.2/C, 54.3/D, 25.2/E, 1.4/F, 6.7/G, 3.2/H} \pye[xshift=2.2cm,values of coltello/.style={pos=1.1}]% {2005}{6.8/A, 3.0/B, 0.5/C, 52.3/D, 25.6/E, 1.8/F, 7.1/G, 2.8/H} \pye[xshift=4.4cm,values of caffe/.style={pos=1.1}]% {2015}{7.2/A, 3.1/B, 0.6/C, 50.6/D, 26.5/E, 2.3/F, 7.5/G, 2.2/H}  \legend[shift={(0cm,-1.5cm)}]{{A}/A, {B}/B}  \legend[shift={(1.4cm,-1.5cm)}]{{C}/C, {D}/D}  \legend[shift={(2.8cm,-1.5cm)}]{{E}/E, {F}/F} \legend[shift={(4.2cm,-1.5cm)}]{{G}/G, {H}/H} \end{tikzpicture} \end{figure}  \end{document}   This looks quite the way I want it to, only the small numbers should be placed outside the pies.  Thanks in advance :) Cheat-proof online die roller? I am looking for an online die roller that works similarly to the following:   The GM provides a string identifier to the player. E.g., "gandalf attacks balrog #12"   The player enters the id on the roller site, which checks it for uniqueness vs the DB, then generates the results, lined to that id.   The GM can check the results by id.     An alternative implementation would be for the GM to request a range of pre-generated ids from the site and hand them out to the players for rolls. E.g., "please roll 5d8 with id #314159265"  Is there anything similar?  Notes and Clarifications:  As Thales Sarczuk inferred, this is indeed for "play by forum/email" games.  The idea is to have "verifiable" rolls, preventing "roll until you you get a good result" scenarios. However, it will be used on forums that are not gaming-specific so using plugins is not an option.  Thank you! Setting ArcGIS Desktop license to lower level for testing whether Python script still runs? I have a Python script that will need to be given to a client.   We are currently evaluating what license level the client will need in order to run the script for their software acquisition purposes.   We all have ArcGIS 10.1 Advanced license in our company.   I checked all the tools and extensions used in the script against the web help and found that they should work on the Standard license level.   Is there a way I can test the script against the Standard license level, when we have no Standard license level in or company (only the higher Advanced level)? Why can't Discovery's Data Core be separated from the ship? Remove HTML Tags from an NSString on the iPhone There are a couple of different ways to remove HTML tags from an NSString in Cocoa.   is to render the string into an NSAttributedString and then grab the rendered text.   is to use NSXMLDocument's -objectByApplyingXSLTString method to apply an XSLT transform that does it.  Unfortunately, the iPhone doesn't support NSAttributedString or NSXMLDocument. There are too many edge cases and malformed HTML documents for me to feel comfortable using regex or NSScanner. Does anyone have a solution to this?  One suggestion has been to simply look for opening and closing tag characters, this method won't work except for very trivial cases.   For example these cases (from the Perl Cookbook chapter on the same subject) would break this method:  &lt;IMG SRC = "foo.gif" ALT = "A &gt; B"&gt;  &lt;!-- &lt;A comment&gt; --&gt;  &lt;script&gt;if (a&lt;b &amp;&amp; a&gt;c)&lt;/script&gt;  &lt;![INCLUDE CDATA [ &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; ]]&gt; Applescript run from menu bar? These badges were only recently added to StackExchange. I would like to know if there is any way I can find out how many more questions I should ask to get these badges.   For e.g. like the counters for the review-related badges: Getting below error message while issuing :  sudo apt-get update  Get:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease [95.8 kB] Ign:2 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 InRelease                                                                                                             Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                          Hit:4 http://ppa.launchpad.net/canonical-x/vulkan/ubuntu xenial InRelease                                                                                                 Hit:5 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 Release                                                                             Hit:6 http://us.archive.ubuntu.com/ubuntu xenial-security InRelease                                                   Ign:7 http://dl.google.com/linux/talkplugin/deb stable InRelease                                                      Hit:8 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease                                                    Ign:9 http://linux.dropbox.com/ubuntu wily InRelease                                            Hit:10 http://ppa.launchpad.net/numix/ppa/ubuntu xenial InRelease                               Get:12 http://dl.google.com/linux/chrome/deb stable Release [782 B]       Hit:13 http://dl.google.com/linux/talkplugin/deb stable Release                   Ign:14 https://apt.dockerproject.org/repo ubuntu-wily InRelease           Hit:15 https://apt.dockerproject.org/repo ubuntu-wily Release             Get:16 http://dl.google.com/linux/chrome/deb stable Release.gpg [181 B]   Hit:17 http://linux.dropbox.com/ubuntu wily Release                                   Get:20 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,191 B] Fetched 98.0 kB in 0s (118 kB/s)                                  Reading package lists... Done N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://dl.google.com/linux/chrome/deb stable InRelease' doesn't support architecture 'i386'   This cuts across various releases of ubuntu Javascript for multiple elements Using Residue Theorem find $\displaystyle \int_0^{2\pi} \frac{1}{a^2\cos^2 t+b^2 \sin^2 t} dt \;; a,b&gt;0$.   My Try:  So, I am going to use the ellipse $\Gamma = \{a\cos t+i b \sin t: 0\leq t\leq 2\pi\}$.   On $\Gamma$, $z=a\cos t+i b \sin t$, so $|z|^2=z\bar{z}=a^2\cos^2 t+b^2 \sin^2 t$.   Now, $dz=-a\sin t+i b \cos t dt$.   Hence, the integral becomes $\displaystyle \int_\Gamma \frac{dz}{z(iab+(\sin t \cos t)(b^2-a^2))}$. I know that $\displaystyle \int_\Gamma \frac{dz}{z}=2\pi i$. Now, how do I get rid of $\sin t \cos t$ part? I am stuck here. Can somebody please explain how? I am trying to prove that the set of irrational numbers $\mathbb{R} \setminus \mathbb{Q}$ is not an $F_{\sigma}$ set. Here's my attempt:  Assume that indeed $\mathbb{R} \setminus \mathbb{Q}$ is an $F_{\sigma}$ set. Then we may write it as a countable union of closed subsets $C_i$: $$ \mathbb{R} \setminus \mathbb{Q} = \bigcup_{i=1}^{\infty}  \ C_i $$ But $\text{int} ( \mathbb{R} \setminus \mathbb{Q}) = \emptyset$, so in fact each $C_i$ has empty interior as well. But then each $C_i$ is nowhere dense, hence $ \mathbb{R} \setminus \mathbb{Q} = \bigcup_{i=1}^{\infty}  \ C_i$ is thin. But we know $\mathbb{R} \setminus \mathbb{Q}$ is thick, a contradiction.  This seems a bit too simple. I looked this up online, and although I haven't found the solution anywhere, many times there is a hint: Use Baire's Theorem. Have I skipped an important step I should explain further or is Baire's Theorem used implicitly in my proof? Or is my proof wrong? Thanks.  EDIT: Thin and thick might not be the most standard terms so:  Thin = meager = 1st Baire category