Find all $h:\mathbb{N}\rightarrow \mathbb{N}$ such that   $$h(h(n)) + h(n+1) = n+2$$   I tried this, but wasn't able to make any progress after a while. So, in vain, I looked at the solution. The solution basically obtained $h(1)=1$ and $h(2)=2$ after some casework, and then claimed that $$h(n) = \lfloor n\alpha \rfloor -n + 1$$ (where $\alpha$ denotes the golden ratio) without explaining at all why one would come at such a conclusion. How did they jump to this conclusion?  (Source: Functional Equations: A Problem Solving Approach, Venkatachala.)
Find all functions $f$ such that $f:\mathbb{N}\rightarrow\  \mathbb{N}$ and $f(f(n))+f(n+1)=n+2$   Let us plug in $n=1$  $f(f(1))+f(2)=3$  Since the function is from $\mathbb{N}$ to $\mathbb{N}$, $f(2)$ can only take the values $1,2$. Now we divide the problem into cases.  Case-1: $f(f(1))=2,f(2)=1$  We can assume that $f(1)=c$ for the time being. Then plugging in $n=3$ and using $f(2)=1$ gives $$f(3)=4-c$$ and again since the range of the function is positive integers,then $4-c$ has to be positive and hence $c$ belongs to  {$1,2,3$}. Now, $$f(1)=c$$$$\implies f(f(1))=f(c)$$$$\implies 2=f(c)$$ by the assumption that $f(f(1))=2$ . Now,since $c$ can only take the values $1,2,3$,we start treating cases. If $c=1$,$$f(c)=2$$$$\implies f(1)=2$$ but we know from the deinition of $c$ that $f(1)=c=1$,a contradiction.If $c=2$,then $2=f(c)=f(2)$ but $f(2)=1$ by assumption. Finally,if $c=3$ $$2=f(c)=f(3)$$ but $$f(3)=4-c=4-3=1$$ which is once again a contradiction. Therefore there are no such functions in this case.  Case-2: $f(f(1))=1,f(2)=2$  Again assuming $f(1)=c$ and using $f(n)\le n$ along with plugging $n=c-1$ will give us that $f(1)=1$ and then it is easy to prove that such a function exists by recursion. I can only give a "sort of recursive" way to define the function. Here it goes $$f:\mathbb{N}\rightarrow \mathbb{N}$$$$f(1)=1$$$$f(n)=n+1-f(f(n-1))$$  But this case is harder to deal with.Some help will be appreciated.
I'm a C++ newbie, but I wasn't able to find the answer to this (most likely trivial) question online.  I am having some trouble compiling some code where two classes include each other.  To begin, should my #include statements go inside or outside of my macros?  In practice, this hasn't seemed to matter.  However, in this particular case, I am having trouble.  Putting the #include statements outside of the macros causes the compiler to recurse and gives me "#include nested too deeply" errors.  This seems to makes sense to me since neither class has been fully defined before #include has been invoked.  However, strangely, when I try to put them inside, I am unable to declare a type of one of the classes, for it is not recognized.  Here is, in essence, what I'm trying to compile:  A.h  #ifndef A_H_ #define A_H_  #include "B.h"  class A {     private:         B b;      public:         A() : b(*this) {} };  #endif /*A_H_*/   B.h  #ifndef B_H_ #define B_H_  #include "A.h"  class B {     private:             A&amp; a;      public:         B(A&amp; a) : a(a) {}  };  #endif /*B_H_*/   main.cpp  #include "A.h"  int main() {     A a; }   If it makes a difference, I am using g++ 4.3.2.  And just to be clear, in general, where should #include statements go?  I have always seen them go outside of the macros, but the scenario I described clearly seems to break this principle.  Thanks to any helpers in advance!  Please allow me to clarify my intent if I have made any silly mistakes! Is it possible to run Android apps on Ubuntu? And I don't mean inside an emulator, but natively, as you would with any other application installed using the Ubuntu Software Center. what is this() ? can it have multiple parameters? When is $A- B = B- A$? Hello I am taking a Discrete Mathematics course and having some trouble with this question about sets:  Under what conditions is $A- B = B- A$  Diagram:   Diagram:   Maybe I'm understanding incorrectly, but how can A-B and B-A be equal if they contain elements that are not in each other? Vector Applications in Euclidean Geometry In .NET, which loop runs faster, 'for' or 'foreach'? Let $I = \langle 2\rangle$. Prove $I[x]$ is not a maximal ideal of $\mathbb Z[x]$ even though $I$ is a maximal ideal of $\mathbb Z$.   My professor mentioned that I should try adding something to it to prove that $I[x]$ is not the maximal ideal. I want to assume he meant to add $ \langle 2 \rangle$ to $I[x]$? Unable to format internal drive as APFS on 2018 MacBook Pro I’ve recently ran a semi-routine clean install on my 2018 MacBook Pro. This involves the following steps (in the given order):   Creating a USB installer with the latest macOS Mojave 10.14.2. Booting into the USB (Pressing Option key on boot). Using the Disk Utility, erasing the Disk and formatting it as APFS with a GPT Partition scheme. Using the Terminal, unmounting the disk diskutil unmountDisk disk0, where disk0 is the internal NVME drive. Using the Terminal, running gpt destroy disk0 where disk0. Using the Terminal, running diskutil zeroDisk disk0. Once that process is complete, I use the Disk Utility application to reformat as APFS, and install macOS.   Nothing super crazy, maybe a little redundant in steps, maybe a little overkill, maybe a little unnecessary.  Recently, however, on the final step where I format it as a APFS drive, it fails in creating the APFS container and says Internal State Error. It appears to first format as Mac OS Extended (Journaled) then create an APFS container, then add a APFS Volume. It fails when adding a Volume with An internal error occurred.  I have tried many things, including:   Securely erasing the drive diskutil secureErase 0 disk0. Simply zeroing the disk again diskutil zeroDisk disk0 (I’m not sure what the actual difference between these two are). Reformatting the drive as other things, such as ExFAT / FAT / MacOS Journaled, then trying to format as APFS. Reformatting the drive through the command line instead: diskutil eraseDisk JHFS+ NAME disk0 → diskutil apfs createContainer /dev/disk0s2 → diskutil apfs addVolume disk0s2 APFS NAME (It fails here with Error starting APFS Container creation: The given disk is not an APFS Container Reference (-69630), even though I just made a container there. Also, trying to add a volume to where it actually made the container (i don't know what it does this) diskutil apfs addVolume disk24 APFS NAME also fails with Error: -69624: Unable to add a new APFS Volume to an APFS Container Reformatting the drive using this: diskutil eraseDisk APFS NAME disk0 Restarting and trying these again. Using a different installer than the USB (The one from Command + R, Command + Shift + R, and whatever the other combo is), and trying these again.   All end up at the same thing - the final step fails. I would expect especially after a secure wipe that the drive would be removed from whatever state it was put in, or that if it was a bug with the 10.14.2 installer, that it still wouldn’t happen again in the High Sierra installer. In Disk Utility, I’m left with the following structure:  - APPLE SSD AP(...) // “Container disk24” takes up all space      - Container disk24 // or some other number. “Used” is 207.2MB and “Free” is 1TB.   Please note even though I can format as JHFS+, it won’t let me install the OS to such a formatted volume. The installer tells me this computer forces me to only install on APFS formatted volumes.  Any direction is greatly appreciated. I have never had such a silly problem before. Also, note that I have no Time Machine backup. How to make ssh log in as the right user? I use ssh on a variety of machines, mainly linux. Accounts on these machines vary in naming scheme: if my name is First Last, then I have accounts: first, flast, last_f, lastf, and sometimes I need to log in as root. For each machine I use, I would like the openssh client to know which account to use when I don't specify on the command line.  So the question is: How do I make ssh server Do The Right Thing when a username is not specified? Adding grouped icons to favorite bar in Ubuntu 18.04 Is there anyway to add icons groups to the favorites bar aka Ubuntu dock (something like drawers or unity-launcher-folders) in Ubuntu 18.04 ? How to compute azimuth between QgsPointV2s? The  class has an azimuth() method but the new  class does not. What's the best way to compute the azimuth between QgsPointV2s? I couldn't find a convenient way to convert V2 to the old version, so my fallback is to construct a QgsPoint from the V2's x and y:   self.traj = QgsLineStringV2(...)     p_i = self.traj.pointN(self.i) # this returns a QgsPointV2 p_j = self.traj.pointN(self.j) a = QgsPoint(p_i.x(),p_i.y()).azimuth(QgsPoint(p_j.x(),p_j.y()))   Is there a better way? Let $G$ be abelian, $H$ and $K$ subgroups of orders $n$, $m$. Then G has subgroup of order $\operatorname{lcm}(n,m)$. Let $f$ be a continuous function on $[0,1]$ such that $f([0,1])=[0,1]\times[0,1].$ Then show that $f$ is not one-one.  Hints will be appreciated. This is similar to , except it's a bug report, not a feature request.  Currently, the nominee's comments on his/her own post are not highlights, unless you click "add / show more comments"  When the page is loaded it looks like:    AfterI click "add / show more comments", it becomes:    Could we have the blue highlighting on the post owner's comments there all the time? It becomes difficult to see the nominees responses to questions, especially on nominations where there aren't enough comments to enable the "add / show more comments" features, like Matt's. JSON and escaped double quote I'm currently making a callout to a 3rd party vendor and I'm getting a huge response. What is currently messing me up is this section:   "MessageSeq":13,"Description":"config file: config-qa1.txt\"","MessageTS":"2014-02-17T14:46:58","MessageLevel":4,"IsSystemMessage":false   As you can see here, the portion at the end of the Description value is ended with backslash double quote. If I attempt to parse this via the JSONParser I get an exception. Does anyone have an recommendations on how to resolve this?  Exception Message:  System.JSONException: Unexpected character ('"' (code 34)): was expecting comma to separate OBJECT entries at [line:1, column:3699]  Updated with sample Code   public class ResponseWrapper{     // fields from JSON to auto map     public Integer messageSeq;     public String Description;     public String messageTS;     public Integer messageLevel;     public Boolean isSystemMessage;     // parsing fields     private ResponseWrapper theResponse;     private JSONParser parser;      public void parse(String jsonString){         parser = JSON.createParser(jsonString);         parseJSON();     }      private void parseJSON(){            while (parser.nextToken() != null) {             if (parser.getCurrentToken() == JSONToken.START_OBJECT) {                 theResponse = (ResponseWrapper)parser.readValueAs(ResponseWrapper.class);                            }         }     } }  String responseString = '{"MessageSeq":13,"Description":"config file: config-qa1.txt\"","MessageTS":"2014-02-17T14:46:58","MessageLevel":4,"IsSystemMessage":false}'; system.debug('\n\nBEFORE\n' + responseString); ****Place code in here to test such as ReplaceALL*** ResponseWrapper parser = new ResponseWrapper(); parser.parse(responseString); Maxing out gear with maxed out smithing, enchanting and alchemy I have level 100 smithing, enchanting and alchemy. I also have some nice enchanted gear, fortify smithing and alchemy.   How high should I be able to get my fortified equipment?  Currently I'm around 29% for alchemy and smithing.  How high can I get fortify smithing and fortify enchanting potions without using the console (cheating)? And how? Currently I get +147% and +32% respectively.  Is something like this possible without using the console(or photoshop)? Can someone remind me of the name of the author, the name of the hero and the name of the series if any? Adventure Sci-Fi books, short by today's epic standards ( = about same length as Heinlein's shorter youth books), probably published late 50s?, early 60s? by Bantam? or Del Rey? I think at least 30, possibly more than 40 books in the series. Not comic books. The author is not a well-known writer. At least, I don't remember seeing the name on any other books, ever.   Subject: a man who can move and respond to threats extremely fast learns about a secret potion that allows a person to change bodies with someone else and thus control them. A powerful organization does not want the secret to be known, because they use the potion to control politicians on many planets. The organization's goons are people who had surgeries to remove their emotions, and function like organic computers. They can communicate over interstellar distances and follow and murder anyone who learns the secret. I remember the following detail about the potion: there are two nearly identical molecules that have to be assembled in a certain sequence. Two of the components had to be switched around and that determined who would be dominant and who would be controlled during the mind switch / body swap.   Every book finds the hero on another planet with new adventures, and usually taking another deep-sleep-passage to another world, fleeing his pursuers. The background story about the secret potion is dished out little by little in each book.  One book in the series starts like this: hero is on very hot planet, diving for valuable marine life, catches a deadly fungus disease and is rescued last moment in exchange for his catch...  One of the themes that returns often is that the hero is an excellent knife fighter.  Of course he's a womanizer. In the second (or close to 2nd) book in the series, he's involved with a woman who rules a planet.  To travel to another world, he usually takes the cheapest dead-sleep passage, and there's always a 10-25% risk you won't wake up from that. Before I start, don't lecture me on the fact that FAT32 is old and hasn't been updated for nearly 20 years. Right now I have sorted that. I am trying to install Ubuntu Linux onto a 64GB flash drive and it wants me to format it to one of the EXT file systems.  The problem is if I put the flash drive into a Windows PC, I can't use it. I also can't install the required software onto every Windows PC that I will use. When I tried to install it on FAT32 I got an error and there is no option for NTFS.  Does anyone know how I could do this? Maybe a Windows based tool? Thanks in advance. What's wrong with this? What are tag badges? How do they work?