How to sum different digits in one integer? For example: int = and 411; I want to pull out the numbers and sum them: 4 + 1 + 1 = 6, tried in various ways, but I gather ASCII value in the table, and I do not want it?
What's the fastest and easiest to read implementation of calculating the sum of digits?  I.e. Given the number: 17463 = 1 + 7 + 4 + 6 + 3 = 21
Einstein equation  where $E$ is energy, $m$ mass, and $c$ the speed of light in vacuum. So does it mean objects without any mass does not posses energy for eg lights photons does not have mass but how can they posses energy component.set not working for picklist field I have a number of lightning:inputField that i'm setting based on certain criteria, these all work except for picklist field types. The code below shows how i am setting the fields. The country field is the picklist and the 2 alerts have the correct value in them, however the value is not getting set on country. Is there a different method for setting picklist fields?  var address = res.getReturnValue(); var country = component.find('Country__c'); var pcodeFld = component.find('Postcode__c');  if(country != undefined){  alert(country);  alert(address.Country);  country.set('v.value', address.Country); } if(pcodeFld != undefined){  pcodeFld.set('v.value', address.Postcode); }   EDIT: I can set a default value whilst using $A.createComponents using .set("v.value", "United Kingdom");  it just seems that i can't set it after the component has rendered based on some user action.  Reproduceable Example:  I just can't seem to set the value of any picklist fields when using lightning:inputField.  Component  &lt;aura:component implements="flexipage:availableForRecordHome, force:hasRecordId"&gt; &lt;div class="slds-p-bottom_large slds-p-left_large" style="width:500px"&gt;     &lt;lightning:recordEditForm aura:id="recordViewForm"                                   recordId="{!v.recordId}"                                  objectApiName="Contact"&gt;         &lt;lightning:messages /&gt;         &lt;lightning:inputField fieldName="FirstName" /&gt;         &lt;lightning:inputField fieldName="LastName" aura:id="lastname"/&gt;         &lt;lightning:inputField fieldName="Birthdate" /&gt;         &lt;lightning:inputField fieldName="Phone" /&gt;         &lt;!--Picklist--&gt;         &lt;lightning:inputField fieldName="Country__c" aura:id="Country__c"/&gt;         &lt;lightning:button label="Update" variant="brand" onclick="{!c.update}"/&gt;     &lt;/lightning:recordEditForm&gt; &lt;/div&gt;     &lt;/aura:component&gt;   Controller  ({         update: function(component, event, helper) {         //alert(component.find("Country__c"));        component.find("Country__c").set("v.value", "Ireland");     },  }) I googled it but I couldn't find the answer... maybe I didn't seek it in the proper way. My question is if &quot;to&quot; must be repeated in sentences such as the following ones:   In the past, women used to do the housework and to take care of children.  The aim of this meeting is to control their progress and to discuss the new working plan.    If I had to bet, I would omit the second to... But I am not sure about it. There are a lot of software in Windows to merge PDF files but how can we do the same in Ubuntu? Set spawn point for a specific player I made a server and me and one of my friends want to do a prank on another friend, because he stole all my enchanted diamond armor.  The Prank  I want to set a player's spawn point in a pit of lava, how would I do this without affecting anyone else's spawn point? WinForms Global Exception Handling? For groups $A,B,C$, if $A\times B$ and $A\times C$ are isomorphic do we have $B$ isomorphic to $C$? The motivation for this question is in my answer to this post :       (1) If I take $A$, $B$ and $C$ three groups such that $A\times B$ is isomorphic to $A\times C$ then do we have $B$ is isomorphic to $C$ ?   In the post a counter example is given when $A$ is an infinitely generated group. However I cannot get a counter-example when $A$, $B$ and $C$ are assumed to be finite groups. Note that there is no reason a priori if $\phi$ is an isomorphism from $A\times B$ to $A\times C$ that $\phi(A\times\{1_B\})=A\times\{1_C\}$.   In the case of finite groups it is true because of the Krull-Schmidt theorem : .  A slightly more general question is the following :     (2) If $B$ and $C$ are two finitely generated groups, can I always find a finitely generated group $A$ such that $A\times B$ is isomorphic to $A\times C$?   If $A$ is not assumed to verify any property but to be a group we can take :  $$A=B^{\mathbb{N}}\times C^{\mathbb{N}} $$  Furthermore replacing :$ \prod_{\mathbb{N}}$ by $\bigoplus_{\mathbb{N}}$ (or more likely the restricted product for groups but I am not sure of a well known notation, it is the subgroup of the product with all but a finite number components being trivial) will give you the same result for countably infinite groups.   $\underline{\text{Edit}}$ : To be clear about what I am asking. (1) is kown to be true for finite groups whereas (2) is known to be true when we are considering groups without restriction (even just for countably infinite groups). Let us pretend we are working on the smaller class of groups : the finitely generated groups. Is there any counter example to $(1)$? Is there any counter example to $(2)$?   $\underline{\text{Edit 2}}$: Here is a partial answer, from the classification of finitely generated abelian groups $(1)$ is always true if all groups are assumed to be abelian finitely generated groups. Now assume that $A\times B=G=A\times C$. Then you have (derived groups) :  $$D(G)=D(A)\times D(B)=D(A)\times D(C) $$  So the abelianizations verify :  $$A^{ab}\times B^{ab}=A^{ab}\times C^{ab}$$  Because we are now in the realm of finitely generated abelian groups we get :  $$B^{ab}=C^{ab} $$  So $(2)$ cannot be true in general for instance you can take $B:=\mathbb{Z}$ and $C=\mathbb{F}_5$, those two groups have different abelianizations.   The new question can be found here : Edges on an even number of Hamilton cycles Should black holes be considered two-dimensional or three-dimensional? I asked  that turned out to have multiple correct answers. How do I pick between them to determine which to accept?  All of the answers were different. They were not the same answer given multiple times. Please warn about exceeding 50 question limit prior to asking a new question Sum of reciprocals of numbers with certain terms omitted I know that the harmonic series $1 + \frac12 + \frac13 + \frac14 + \cdots$ diverges. I also know that the sum of the inverse of prime numbers $\frac12 + \frac13 + \frac15 + \frac17 + \frac1{11} + \cdots$ diverges too, even if really slowly since it's $O(\log \log n)$.  But I think I read that if we consider the numbers whose decimal representation does not have a certain digit (say, 7) and sum the inverse of these numbers, the sum is finite (usually between 19 and 20, it depends from the missing digit). Does anybody know the result, and some way to prove that the sum is finite? I'm working through Rotman (1994). It's the 2nd chapter where my curiosity lead me to a question that is not from the book. Here's the problem that inspired the question:      2.8. Imbed $S_n$ as a subgroup of $A_{n+2}$, but show, for $n\ge2$, that $S_n$ cannot be imbedded in $A_{n+1}.$    Since the alternate subgroup has the property of even parity, I thought that a little investigation of parity for the second and third symmetric groups was in order. So I constructed a table for each of them, grouped by even and odd number of disjoint products.   I'll forego writing the actual table and simply provide the answers. In symmetric groups with an even idegree, two even permutations come together under composition to produce an even permutation. Two odds also make an even. Two different parities produce odd elements.   When the symmetric group has an odd degree, e.g. $S_3$, two odds make an odd, two evens make an odd, and two different parities make an even element. Exactly the opposite results from the symmetric groups with even index.   Two questions: is this enough to prove the $A_{n+1}$ case? And can this be generalized modulo 2 e.g. $A_{2n+1}$? Package for drawing RDF graphs Is there some package to draw nice RDF graphs, such as the one below (taken from )?  Can such a graph (with the same style) be produced in TikZ? Any way to add CSS for a single page/node? I'm cleaning up my big crazy style sheets (possibly pertinent to a future question) and I'm wondering the best way to add custom CSS to a specific node or page. In particular, my work site's home page is a Panel Page and it has a bunch of different styling. Right now the CSS is just included with the main theme style sheet. Is there a way to say, &quot;if this is node Foo, then add foo.css&quot;? Is  what I'm looking for? I might be interested in generalizing this to other nodes/sections/etc, but at the moment I just want to handle this one item. The reCAPTCHA has become too difficult for humans to solve The reCAPTCHAs have suddenly become almost illegible. I regularly have to change it four or five times before I find one I can read. I am tempted to just enter the known word (an easy guess), and leave the other. Can something be done? Why is there a controversy on whether mass increases with speed? How do you take profit from stock trading while keeping capital invested? According to this , if at least one of the nouns involved is plural then it should take the plural form of the verb. Otherwise, it should take the singular form of the verb. But in the last part it says not all grammars agree to those rules thus proximity rule applies. However, it doesn't explain when to apply the proximity rule and when not to use the former rules. Dual Booting win 10 and Ubuntu 18.04 on two separate physical ssds I have gotten as far as to create the bootable usb, booting into that bootable usb and getting to the install options however i quit because I had some concerns.  I currently have a Samsung 850 evo 1tb that has win 10ninstalled. I want to dual boot with Ubuntu 18.04 by installing it on a brand new unformatted uninitialized Samsung 860bevo 250gb. Should i format the brand new ssd as a new volume in win 10 and then proceed with the Ubuntu install on this volume. What else should i do? Im a first time Ubuntu user and installer.  Any and all help is appreciated.