Question:  Find the number of series of length-$n$ over $\{0,1,2,3,4\}$ where the difference between any two consecutive members is $1$ or $-1$  Below are my workings. I'm stuck because I don't understand how I can make the recursion.  Let $a_n$ be the number of $n$-length series. Let $a_n^k$ be the number of $n$-length series such that the first element is $k$. We have that $a_n=a_n^0+a_n^1+a_n^2+a_n^3+a_n^4$ If the series starts with $0$, then the next element must be $1$, and we have that $a_n^0=a_{n-1}^1$ If the series starts with $1$, then the next element must be $2$ or $0$, and we have that $a_n^1=a^2_{n-1}+a^0_{n-1}$ If the series starts with $2$, then the next element must be $3$ or $1$, and we have that $a_n^2=a^3_{n-1}+a^1_{n-1}$  There is an similar answer to this but not in the same way that my college requires.
How do I find a recursion formula to solve the following question:  In how many sequences of length $n$, with elements from $\{{0,1,2,3,4}\}$, the difference between every 2 adjacent elements is $1$ or $-1$?  I've been trying to solve the problem for the last 5 hours maybe, I'm sure that I'm missing something..   This is a problem in combinatorics, and the solution must be by finding a recursion formula for the problem.   best solution I've come so far is that if we say that $a_n$ is the solution to the question, so let's count how many sequences of size $n-1$ there are that meet the requirement, and we complete the first element to make it a sequence of $n$ elements. so for $n-1$ there $a_{n-1}$ sequences, and for each sequence we have $2$ options to choose the first element (one option is to take a plus $1$ number from the number that start the $n-1$ sequence, and the other option to to take a minus $1$ number from the number that start the $n-1$ sequence), only problem as you figured out is that if the $n-1$ sequnce starts with $0$ or $4$ there is only $1$ option left for the first element in the sequnce.. so $a_n=2a_{n-1}$ won't work.  I think that the solution may involve using $2$ or maybe $3$ recursion formulas.  Hope I was clear enough.
How do I upgrade an iPhone 4 from iOS 7.1.2 to iOS 8 or 9 I have an iPhone 4 and I need to upgrade from 7.1.2 to iOS 8 or 9. I would like to ask how I can get iOS 8. Picking a $\delta$ for a convenient $\varepsilon$? I'm studying some proofs in a book from the library  and  unlike my own book, it doesn't prove by showing that a certain expression is striclty less than $\varepsilon$ (given an  appropiate $\delta$ and $\vert x-a\vert &lt; \delta$, etc). Instead, it shows that it's less than some expression involving $\varepsilon$.   E.g. Given $\varepsilon &gt; 0$, we can pick a $\delta &gt; 0$ so $|f(x) - g(a)| &lt;  \text{insert stuff} &lt; k \cdot \varepsilon$ when $|x-a| &lt; \delta$, and thus $f(x) - g(a) \to 0 $ when $x \rightarrow a$.  How does this make sense formally? (Intuitively, I am convinced.)  I don't have much experience with $\varepsilon$-$\delta$ -proofs, so I might be missing something obvious. Can QGIS preserve layers when exporting to PDF? Removing duplicate strings from an array? Java is the key here. I need to be able to delete files but users expect to be able to "undelete" from the recycle bin.  As far as I can tell this isn't possible.  Anyone know otherwise? How do electric currents make light? In an incandescent light bulb, electrons flow through wires to the bulb, where is passes through a filament, and the filament lights up.  Does this work because of several high energy electrons losing some of their energy to disturb the electromagnetic field, creating photons? The electrons just leave the filament afterward and are replaced by more high-energy electrons from the negative terminal. Or does it work differently?  As a secondary question, is there a type of light bulb that directly converts electron flow to photons? Difference between (function(){})(); and function(){}(); Possible Duplicate:          This is something I haven't quite figured out yet, but I have been using function(){}() just because my VIM syntax highlight screws up if I add the parenthesis, although I've seen (function(){})() around many times, maybe its an IE thing?  edit:  var singleton = function() {     // code }();  var singleton = (function() {     // code })(); I have installed Ubuntu 12.04-64 bit on my Lenovo IdeaPad laptop, and the wired Ethernet (LAN) connection doesn't work.  Running the lspci -vv | grep Atheros command from the terminal shows me I have the AR8161 Gigabit Ethernet controller:  02:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 08)   This looks like a new product whose drivers are not built into Ubuntu.  How do I install drivers to get the AR8161 working? How to configure idle period for auto locking screen I just installed a fresh Ubuntu 12.04 (Precise Pangolin).   I noticed that, there is no screensaver settings, which is fine. I like to control the period of time after which the blank screen is shown,which automatically locks the screen.  I do not want to enable screensaver. I only wish to be able to change the idle time period required to lock the screen automatically. It seems to me, it is by default around 10-15 minutes. How to automatically add &raquo; (») to  elements using CSS? How can I install packages without starting their associated services? As you're probably aware, by default when you install a package on a Debian or Ubuntu based system, if the package contains a service, that service will generally be enabled and started automatically when you install the package.  This is a problem for me.  I've found myself needing to manage templates for building LXC containers. There are several containers, each corresponding to a Debian or Ubuntu release. (There are also Red Hat-based containers, but they aren't relevant here.)  /var/lib/libvirt/filesystems/debian6_template /var/lib/libvirt/filesystems/debian7_template /var/lib/libvirt/filesystems/ubuntu1004_template /var/lib/libvirt/filesystems/ubuntu1204_template   Occasionally I will find that the templates have a missing package or need some other change, so I will chroot into them to install the package. Unfortunately when I do that, I wind up with several copies of the package's service running!  By way of example, I found the templates didn't have a syslog daemon, so I installed one:  for template in /var/lib/libvirt/filesystems/{debian,ubuntu}*_template; do     chroot $template apt-get install rsyslog done   And promptly wound up with four copies of rsyslog running. Not to mention two copies of exim4. Oops!    I read somewhere (though I can't find it again now) that it's not supposed to start services when running in a chroot, but that clearly isn't happening here.  One potentially viable  calls for temporarily replacing the various commands which actually start services, such as start-stop-daemon and initctl, though this is a lot more work than I really wanted to do. If I have no other choice, though...  The ideal solution here would be for Debian-based systems to stop doing this crap, but failing that, perhaps an obscure or undocumented command line option for apt-get?  In case it wasn't clear, I really want to keep anything related to managing the templates outside the templates, if possible. I know that packages installed with apt-get are stored in /var/cache/apt/archives.  I just installed mariadb server in Ubuntu 16.04 with following command:  sudo apt install mariadb-server   When I tried to find packages in /var/cache/apt/archives, there are no packages. Where are they stored if it's not in this directory? I just manually summoned the Eye of Cthulhu, going into battle with copper armour, tungsten broadsword, gold bow, jester arrows and plenty of lesser healing potions. I came rather close to death but I managed to stay alive. However, the Eye took off when I had his health down to ~1700. I'm assuming this means you only have a few minutes to finish it off after a certain point. Is there any equipment I'm missing to help kill the Eye faster and to help my survivability? If it's relevant, my current life is 120. Do I need a Japanese transit visa when arriving at Narita and departing from Haneda? I'm arriving from New Delhi, India (Indian passport) with JAL at Narita on 11th July at 07:30 and departing for San Francisco with JAL at 00:05 on 12th July from Haneda. Do I need a transit visa as I'll be switching airports and spending a few hours at JAL City Haneda Airport Hotel?  Previously I had connecting flights from Narita to San Francisco and obtained shore passes to relax at Narita Nikko Hotel. Now I'm travelling with my elderly Mom and do not want complications at Narita immigration or later in the day while going from Narita Airport to Haneda airport. Please advise. Why can't a normal user `chown` a file? Set limit to one author when using "et al." in biblatex Code examples, like in the TikZ/PGF manual I like very much the 'side-by-side' code examples in the TikZ/PGF manual...    ... and I would like to use the same thing in a manual I'm writing. I have found the source code for the codeexample environment that the TikZ/PGF manual uses for this purpose (specifically, it's located at /usr/local/texlive/2012/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex).  My (probably rather basic) question is: how can I use the same codeexample environment in my own documents? I ask because I tried compiling the example in the related question below, but the file couldn't be found. Book ID: Astronauts and Lab Students can create portals through space Desperate to locate and re-read exceptional book/series, but cannot remember the title. The high concept: The U.S. has just sent the first successful expedition to Mars, and it has just landed. As the astronauts make their initial exploration outside their ship, a tear in the fabric of space opens up right in front of them, and they look through to the insides of a laboratory (at a California university?) and two students who just figured out how to create arbitrary portals between two points in the Universe. The rest of the novel/series is a consequence of this breakthrough. But I can't remember the author and title(s). Surely someone reading this forum will remember it well! TIA.  (Reposted .) In the Android App, if a question is closed, I won't be able to leave comments on either the question or any of its answers. There are simply no "Add Comment" buttons available anywhere if the question is closed.  See the screenshot below. The comment adding interface is simply removed on closed questions and their answers &mdash; no Reply button in the toolbar, and no Add Comment button under the question.        Occurs on Android app v1.0.50 and v1.0.51, on a HTC One running Android 4.4.3. Imagine that you have the following list. keys = ['name', 'age', 'food'] values = ['Monty', 42, 'spam']  What is the simplest way to produce the following dictionary? a_dict = {'name': 'Monty', 'age': 42, 'food': 'spam'}