I saw  post on how to solve $3^{123}\pmod{100}$ using Euler's Totient Theorem. How about for $3^{99}\pmod{100}$? It seems more complicated because applying Euler's Totient Theorem gets us $3^{40}\equiv 1\pmod{100}$. This means $3^{80}\equiv 1 \pmod{100}$, which isn't enough, because we still need to find $3^{19}\pmod{100}$. Now, when the terms are listed, a pattern does emerge. $$\begin{array}{|c|c|c|c|} \hline 3 &amp; 9 &amp; 27 &amp; 81 \\ \hline 43 &amp; 29 &amp; 87 &amp; 61 \\ \hline 83 &amp; 49 &amp; 47 &amp; 41\\ \hline 23 &amp; 69 &amp; 07 &amp; 21 \\ \hline 03 &amp; 89 &amp; 67 &amp; 01 \\ \hline \end{array}$$ And $3^{19}$ ends in $67$. But how can I find this in other methods, besides bashing? Is there some sort of theorem that I can use?
How do I efficiently compute $a^b\bmod c$:  When $b$ is huge, for instance $5^{844325}\bmod 21$? When $b$ is less than $c$ but it would still be a lot of work to multiply $a$ by itself $b$ times, for instance $5^{69}\bmod 101$? When $(a,c)\ne1$, for instance $6^{103}\bmod 14$?  Are there any other tricks for evaluating exponents in modular arithmetic?  This is being asked in an effort to cut down on duplicates, see  and .
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {     for (var i = 0; i &lt; a.length; i++) {         if (a[i] === obj) {             return true;         }     }     return false; }  Is there a better and more concise way to accomplish this? How do I change the computer name? When I connect to my server (ubuntu server 10.10), I get this:  name@server-name.belkin ~&gt;   How can I remove ".belkin"? How can I set default value in ActiveRecord?  I see a post from Pratik that describes an ugly, complicated chunk of code:   class Item &lt; ActiveRecord::Base     def initialize_with_defaults(attrs = nil, &amp;block)     initialize_without_defaults(attrs) do       setter = lambda { |key, value| self.send("#{key.to_s}=", value) unless         !attrs.nil? &amp;&amp; attrs.keys.map(&amp;:to_s).include?(key.to_s) }       setter.call('scheduler_type', 'hotseat')       yield self if block_given?     end   end   alias_method_chain :initialize, :defaults end   I have seen the following examples googling around:    def initialize      super     self.status = ACTIVE unless self.status   end   and    def after_initialize      return unless new_record?     self.status = ACTIVE   end   I've also seen people put it in their migration, but I'd rather see it defined in the model code.  Is there a canonical way to set default value for fields in ActiveRecord model? Inductive proof that ${2n\choose n}=\sum{n\choose i}^2.$ I would like to prove inductively that $${2n\choose n}=\sum_{i=0}^n{n\choose i}^2.$$  I know a couple of non-inductive proofs, but I can't do it this way. The inductive step eludes me. I tried naively things like $${2n+2\choose n+1}={2n+2\over n+1}{2n+1\choose n}=2\cdot {2n+1\over n+1}{2n\choose n},$$  But I don't think it can lead me anywhere. I would like the proof to be as simple as possible. Closing Reject Suggested Edit dialogue freezes review process How can I change the local origin of an object, without changing the object location in the world space.  This is the object located at position (0,0,0) in the world space    This is the same object located at position (0,1,0) in the world space, but with its local origin offset so that the object is in the same place    Is there a way to do this in a single step? How do I escape a single quote in SQL Server? How do camera body motors compare to in-lens motors for focusing? What is the difference between using a motor on the camera body and the motor built into lenses?   Aside from how both compare in terms of speed, what differences would I notice if I use a body with a motor and motor-less lens, and a lens with motor on a body that lacked one?  A comparison chart outlining the various lens motor types would be a great help as high end USM motors for Sigma lenses are faster then their regular versions. Explicit norm on $\mathcal{C}^0(\mathbb{R},\mathbb{R})$ Do you know an explicit norm on $\mathcal{C}^0(\mathbb{R},\mathbb{R})$? Using the axiom of choice, every vector space admits a norm but have you an explicit formula on  $\mathcal{C}^0(\mathbb{R},\mathbb{R})$?  A related question is: Can we proved that $\mathcal{C}^0(\mathbb{R},\mathbb{R})$ has a norm without the axiom of choice? According to the Wikipedia page for the , "Use of the comma is consistent with conventional practice" and "Use of the comma is inconsistent with conventional practice." Did the Oxford Comma come before its omission, or was the Oxford Comma traditionally omitted?  It makes logical sense that every item in a list would be separated in the same way: by a comma. If the Oxford Comma is conventionally correct, when and why did people begin to omit it? When I visit a website it sometimes puts cookies on my browser. Usually cookies keep track of browsing info from that particular site. If I don't delete those cookies and browse other websites, will the cookies be able to know which site I am browsing? Also, can any website read browsing history which is saved by browsers? Can any website know about my browsing history by help of cookies, browsing histories saved by browsers, or by any scripting language e.g. javascript? When I'm looking down the front page on , I often wish I could tell at a glance what happened to the question to bump it there. Sometimes it is obvious from looking at the number of answers, other times you have to follow a link to find out if it has been edited or if an answer has been added or updated.  I'm guessing this is just as applicable on other SE sites - this is the kind of thing I'm suggesting:    A couple of suggestions from the comments that might be good:   To reduce clutter the word 'ago' could be removed at the same time. The new text could be visible only to established users - ie users who are likely to be reviewing/editing and would benefit from seeing at a glance what kind of change has occurred. I keep hearing about tandem breakers, and how they won't work with 240V loads and how they should never be used for a multi-wire branch circuit.  Aside from those issues...  What is a tandem breaker?     (note: they can be thrown independently). General solution of expected value of E(f(X))? This is maybe a trivial question I came up while solving a few examples and understanding Markov/Chebyshev inequalities and subsequently in evaluating Chernoff bounds. Suppose $X$ is a random variable with some distribution $p$ and we need to evaluate $\mathbb{E}[f(X)]$. Here, $f(X)$ may or may not have the same distribution as $X$. In my case, if $f(X) = e^{sX}$, where $s&gt;0$. I would work out this problem by letting $Z = e^{sX}$ and   $\mathbb{E}[f(X)] = \mathbb{E}[Z] = \int_{\infty}^{\infty}z \hspace{0.2em}p(z)dz$.   Now I find the distribution of $Z$ as: $P\{ Z \leq z \} \implies P\{ e^{sX} \leq z \} \implies P\{ X \leq \frac{\log(z)}{s}\} = \int_{-\infty}^{\frac{\log(z)}{s}}x.p(x)dx $  thereby substituting this into the expectation one gets $\mathbb{E}[Z] = \int_{\infty}^{\infty}z\hspace{0.2em} \left(\int_{-\infty}^{\frac{\log(z)}{s}}x\hspace{0.2em}p(x)dx\right)^{\prime} dz$  According to the Law of Unconscious Statistician , this approximates distribution of $Z$ as $p$. I understand the backward proof through calculus, I don't follow the measure theory approach. For example I don't follow how this works if say $X \sim Gamma$. Is there a source I can read through for someone with no measure theory background? How closely can a game legally resemble another? Is there a way to make rigid body interact with softbody physics? Typesetting long division with tabular and overlining repeating part What's the difference between Normalization and Standardization? Can a random forest be used for feature selection in multiple linear regression? Since RF can handle non-linearity but can't provide coefficients, would it be wise to use random forest to gather the most important features and then plug those features into a multiple linear regression model in order to obtain their coefficients? country code TLD vs second level ccTLD I'm really worried about professionalism.  My site would be something like http://mywebsite.uy instead of http://mywebsite.com.uy.  What do you think about this practice? What should I have in mind at the moment of choosing one?