How do you find reminder of $m^{x}$ divided by $n$ using Euler's and Fermat's little theorem? Can anyone show me step-by-step how to apply  and ?  Example: What is the remainder of $59^{28}$ divided by $7$?  The following is the way I know how to do these types of problems:  $59^{28} = (56+3)^{28}$... since $7|56$ then we are left with  $3^{28} = 3^{2*2*7} = 3^{4*7} = 81^{7} = (77+4)^{7}$... since $7|77$ then we are left with  $4^{7} = 4^3*4^{4} = 64*4^{4} = (63+1)*4^{4}$... since $7|63$ then we are left with  $1*4^{4} = 4^4 = 4^3*4 = 64*4 = (63+1)*4$... since $7|63$ then we are left with 4  Since we are left with just 4, we can just do: $4\mod{7} = 4$   So the remainder is 4!
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 .
How come the PHP private class var is not private? Could the universe's antimatter be hiding in black holes? As far as we know almost all the mass in the universe is matter, not antimatter. There are three scenarios:   The universe started off with more matter than antimatter and the small amount of antimatter has mostly been converted to energy via collisions with matter The universe started off with equal amounts of matter and antimatter and some unknown process caused the situation we see today The universe started off with less matter than antimatter and somehow the ratio reversed (I've never heard this discussed as it seems so unlikely)   We reason that mass is matter because if there were large amounts of antimatter they should produce antimatter galaxies, which would give off huge amounts of energy when they interact with matter galaxies. This has never been observed so we conclude that all galaxies, therefore all mass in the universe is matter.  As I understand it there are two main types of black holes, stellar remnants (the collapsed remnants of dead stars with more than two solar masses) and super-massive black holes at the centre of many galaxies, including one thought to be at the centre of our own galaxy.  Stellar black holes are obviously originally composed of matter, for the same reason that all galaxies are composed of matter.  We don't know how super-massive black holes formed. Is there enough mass in them to contain all the antimatter in the universe if matter and antimatter were originally created in equal quantities? I realise this shifts the unknown mechanism from "why was more matter created than antimatter" to "why is antimatter more likely to form super-massive black holes" but is this hypothetical scenario possible? If $x$ is a positive rational but not an integer, is $x^x$ irrational? What is the best way to go about calling a function given a string with the function's name in a Python program.  For example, let's say that I have a module foo, and I have a string whose content is "bar". What is the best way to call foo.bar()?  I need to get the return value of the function, which is why I don't just use eval. I figured out how to do it by using eval to define a temp function that returns the result of that function call, but I'm hoping that there is a more elegant way to do this. I am using the below script to move two days back when script runs at starting two days of the year and also check first and second days of every month and move two days back. if [$month=&quot;01&quot;] &amp;&amp; [$day=&quot;01&quot;]; then         date=&quot;$last_month/$yes_day/$last_year&quot;         fulldate=&quot;$last_month/$yes_day/$last_year&quot; else         if [$month=&quot;01&quot;] &amp;&amp; [$day=&quot;02&quot;]; then                 date=&quot;$last_month/$yes_day/$last_year&quot;                 fulldate=&quot;$last_month/$yes_day/$last_year&quot;         else                 if [ $day = &quot;01&quot; ]; then                         date=&quot;$last_month/$yes_day/$year&quot;                         fulldate=&quot;$year$last_month$yes_day&quot;                 else                         if [ $day = &quot;02&quot; ]; then                                 date=&quot;$last_month/$yes_day/$year&quot;                                 fulldate=&quot;$year$last_month$yes_day&quot;                         else                                 date=&quot;$month/$yes_day/$year&quot;                                 fulldate=&quot;$year$month$yes_day&quot;                         fi                 fi         fi fi  But my bad am getting the below error message Etime_script.sh: line 19: [06=01]: command not found Etime_script.sh: line 24: [06=01]: command not found Lightning component scripts loading issues since Spring 17 update Microsoft Office alternative for Windows? Is there something similar to Office for Windows but free? I am student living on a budget, Office is not an option at the moment. How can I go back to the original interface layout? I don't know what the hell I did I just want to get back to modelling What is the average & max temperature of an airplane cargo hold? I want to take some chocolates to offer in my luggage. Chocolates are a bit sensitive to heat, though. What is the average temperature inside a cargo hold? 'Average by' itself can be misleading. What is the max temperature there?  I don't know much about airplane mechanics but I assume they have some cooling systems like any other engine. Such systems, depending on where they are placed, might influence temperature in the cargo hold. I also fear temperatures in the ground while exterior temperatures are higher, and luggage is being put inside. What are max temperatures near the airplane in such situation? java.lang.OutOfMemoryError: PermGen space Exception I would like to place a lower limit under two consecutive \sums, somewhere in between. So I have \sum_{j=1}^{\infty}\sum_{k=1}^{\infty} and would like to place j&gt;k in the lower limit between the two sums. I believe the multiple integral operator has this kind of functionality. I keep getting asked to do wedding photography - what is a fair price to ask? This may sound like a silly post...but, I need some "outside" opinion from people who know what they are doing.  I took up amateur photography as a hobby a couple of years ago...most of it being portrait photography of my children.  As I have posted my pictures on facebook, a plethora of people have loved my "work" and have been contacting me about my "photography" business.  I have been very up-front and honest with every one of them about only being an amateur, and never professionally trained.  That being said, people still hound me to take their pictures.  I am comfortable with my ability to take portrait style pictures....and I have even started charging $60 for a two hour shoot with the rights to the cd of prints.  I do not do my own printing.    Now, I have done three weddings for family members just over this last summer....and only as a wedding gift to them (in other words, I have not charged.)  But now, I am having others, who are not family members, wanting to "hire" me for their weddings.  Again....I have tried to tell them I don't do professional photography, only to be met with all of them still wanting to hire me.    My question is...what is a fair price to ask of these people?  They obviously still want me to work for them, knowing that I have no credentials.....but I have no idea how or what to charge for.  Can anyone give me some ideas? Is there a way to substitute aliases such that it is appended or prepended to an existing command in the shell?   For example, defining the alias:  alias execloc='/home/user/'   Prepending this to a command in the bash terminal:  cd exeloc/temp/somefolder   Can something like this be done, or is there a way to do it? Cannot see files in my external HDD For whatever reason, we do no longer need to be root (or using sudo) to run /sbin/shutdown, /sbin/reboot etc.  This seems to be because those executables are now symlinks to /bin/systemctl which handles everything as normal user.  However, what if I want shutdown and reboot to require root authentication again? How can I achieve this? A logic puzzle involving a balance. Possible Duplicate:          You have 12 balls and you know that they all weigh the same except for 1 which is heavier or lighter than all the others (you don't know which though). How can you make sure you know which ball is the heaviest/lightest in only 3 weighings?  The way I approached it was to split up the 12 balls into three sets of 4 and weigh two of the sets. If the sets balanced the scale, then I know the ball I am looking for must be in the set of 4 balls not weighed, else, I disregard said set and arbitrarily choose the heaviest set of 4 (as opposed to choosing the lightest set). I split the heaviest set of 4 balls into 2 and weigh that... etc.  Repeating this process until all 3 tries have been "used up", even if everything just so happened to be in your favor (the arbitrary choice you have in choosing the heaviest or lightest set happens to be the correct choice) in the end you still end up having to choose between 2 balls. A 50% chance is good, but I am wondering, is there a way to make sure 100%? I am registered on about 80 SE sites, am an "avid user"(>200 rep) on about 30, and a modest user (103-199 rep) on about 20 more.  Once when I tried to ask a question on Open Data (my "new user" site), the "systemwide" 40 minute rate limit kicked in. So I asked on meta , given that my previous post on the site was days ago. So a mod commented by telling me about the systemwide post rule and asking me if I had just come from another site. I said, yes, History (my best site, 40K rep.)  I can see why I would be rate limited on Open Data. I can understand that I would be rate limited if I had come from say, Open Source, another site where I'm a new user. But did the system "rate limit" me as a new user on one site, based on my activity on History, an "established" site?  Also, about the one day new user rate limit after a question is downvoted: Suppose a question on the previous site receives two upvotes and one downvote (net of one upvote). Is that a different situation than receiving one down downvote and no upvotes? Or does the downvote count in both cases, including the one where there were offsetting upvotes? How about if the downvoted question on the previous site was deleted?  I don't have this problem when going from one "established" (greater than 125 rep) site to another. I understand why a person would be "rate limited" going from one new site to another; SE wants people to ask questions 40 minutes apart on their new sites. In my case, I was blocked when I left an "established" site (my best) to go to a new site, which is almost the same as going to a new site de novo.  Why would this be? Or can't the system tell that my "first" site was an established site? Would I have been similarly rate limited if I went first to the "new" site, and 39 minutes later to the established site? Or does the rate limit apply only when the "destination" site is the new site?  Put another way, there are four permutations of established and new sites: 1) established to established 2) new to new 3) established to new and 4) new to established. The block doesn't apply in the first case, does apply in the second case, and apparently applies in the third. What about the fourth? And why? Because it is not "uniform" across sites in the four cases.   Edit: Unlike the other question, this one is not about the general rule. It is about the "special case" described in the paragraph above. In many courses, say Linear Algebra, Group Theory, Topology, instructors often say that knowing that certaing objects are isomorphic, sometimes makes life easier because we can work with more friendly objects.  Is there any example of using isomorphism concept to solve a non trivial concrete problem?   I must say, I'm not looking on important or famous isomorphic objects, but on non trivial application of the concept of isomorphism used in order to solve another kind of problem. Nodejs Nginx error: (13: Permission denied) while connecting to upstream I'm trying to run multiple Nodejs applications on Nginx server running on CentOS 7. I noticed that when I run a Nodejs app on some ports I get an 502 Bad Gateway error in the browser so I checked the error logs:  [notice] 12806#0: signal process started [crit] 12807#0: *13 connect() to 127.0.0.1:7777 failed (13: Permission denied) while connecting to upstream, client: **.**.99.58, server: myapp.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:7777/", host: "myapp.com" [crit] 12807#0: *13 connect() to [::1]:7777 failed (13: Permission denied) while connecting to upstream, client: **.**.99.58, server: myapp.com, request: "GET / HTTP/1.1", upstream: "http://[::1]:7777/", host: "myapp.com"   when I change the app to listen to 8008 for example everything is working fine. I checked permissions and if the process is running as root and everything seems ok. I played with the timeouts as well but no result. Can anyone help? How can I tell if an AC adapter is compatible with my laptop? Possible Duplicate:        How can I tell if an AC adapter is compatible with my laptop?  For example, does the voltage output have to bee the same, or just close?  What power measurements matter?