This function is not sum correctly. sum=1    aj=121 sum=12   aj=12 sum=121          aj=1 This is not show in the alert.   // declaring the recursive function /////////////////////////////////////////////////// function isPal(aj, n) {   var sum = 0;   //alert("aj=" + aj);   if (Math.trunc(aj) != 0) {      sum = sum * 10 + aj % 10;      alert("sum=" + sum + " aj= " + aj + " n=" + n);     isPal(aj / 10, n); // recursive call same as while(n!=0) using loop   } else if (sum == n)     return 1;   else     return 0; } //////////////////////////////////////////////////// var palindrome; n = parseInt(prompt("Enter a number to check for Palindrome", "121")); palindrome = isPal(n, n); alert("palindrome = " + palindrome); if (palindrome == 1)   alert(n + " is palindrome\n"); else   alert(n + " is not palindrome\n");
How do I check if a number is a palindrome?  Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).
Dropping one of the columns when using one-hot encoding df says I have 20G more disk space used than du. Why? Setting a background image on a JFrame using Swing Is there a such thing as an exchange program in Harry Potter? In the Harry Potter universe, is there any mention of an exchange student at Hogwarts or one of the Hogwarts students going on exchange at another school?  This happens all the time in the "muggle" school systems I'm sure it would happen in the wizarding schools as well. Could someone explain this shebang line which uses sh and then does exec perl? This is from . It's about executing a Perl script.     Finally, if you are unfortunate enough to be on an ancient Unix system   that doesn’t support the magic #! line, or if the path to your   interpreter is longer than 32 characters (a built-in limit on many   systems), you may be able to work around it like this:   #!/bin/sh -- # perl, to stop looping eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0;   Can you explain step by step what's going on here? I'm trying to make it work or encompass, but to no avail.  At execution of just the above, I'm getting this:  /bin/sh: 0: Illegal option -- When is matrix multiplication commutative? I know that matrix multiplication in general is not commutative. So, in general:  $A, B \in \mathbb{R}^{n \times n}: A \cdot B \neq B \cdot A$  But for some matrices, this equations holds, e.g. A = Identity or A = Null-matrix $\forall B \in \mathbb{R}^{n \times n}$.  I think I remember that a group of special matrices (was it $O(n)$, the ?) exist, for which matrix multiplication is commutative.  For which matrices $A, B \in \mathbb{R}^{n \times n}$ is $A\cdot B = B \cdot A$? how do I change the registered name in Windows 7 to my own name? Z-axis issue with the floating review info panel, permits various elements to flow over it I was having a look at an old question of mine when I browsed the  from the timeline. I scrolled downwards and realized the Review completed panel comes along for the ride. While that might be , tags flowing over top of it as pictured below probably isn't.  Here's a .gif of the Question and Duplicate tabs flowing over it as well. Note that the timeline button also flows over. If vote buttons are present, they will also flow over it.  Reproduced on Chrome and Microsoft Edge. Update Per  by Tiago Martins Peres, this issue also happens in other Review types, namely Late Answers, First Posts and Low Quality Posts. In addition to that, it is causing the action buttons on reviews to become unclickable if you scroll low enough.  As a temporary workaround, you can use 's , which  this issue. Up until now, I implemented all-against-all collision detection in my games. It worked fine.  But I reached a point where implementing this kind of collision detection, makes the game run poorly, because there are two many objects to iterate through and check for collision.  I have searched this site and found something about 'uniform grids'. But I didn't completely understand what it is and how to implement it. Tried to Google it but nothing easy enough to understand came up.  I am a beginner to 2D-game programming. Do you mind trying to explain to uniform-grids, or link me to some good tutorial?  Thanks a lot Show that $x_{n+1}-\dfrac{x_n}{2}$ converges to zero implies that $(x_n)_n$ also converges to zero. Let $(x_n)_n$ be a sequence of real numbers such that $$\lim\limits_{n\rightarrow \infty}\left( x_{n+1} - \dfrac{x_n}{2}\right)=0.$$ Show that $(x_n)_n$ must also converge to zero.     $\textbf{My Attempt:}$   My original idea was to use the triangle inequality and the fact that $$\lim\limits_{n\rightarrow \infty}\left( x_{n+1} - \dfrac{x_n}{2}\right)=0$$   to show that the sequence $(x_n)_n$ is Cauchy and hence converges to some real number $a$, which would give me $$\lim\limits_{n\rightarrow \infty}x_n=a=\lim\limits_{n\rightarrow \infty}x_{n+1}\implies a-\dfrac a 2= \lim\limits_{n\rightarrow \infty}\left( x_{n+1} - \dfrac{x_n}{2}\right)=0\implies a=0.$$ However, I'm having trouble showing that $(x_n)_n$ is Cauchy.   Any suggestions/hints would be greatly appreciated. Thanks! Should I ask questions I already know the answer to and answer them myself? Number of points on a line in a finite projective plane I've been reading some proofs regarding finite projective planes of order n, and often they start out by assuming that each line contains n+1 points. Is this a fact that follows from the axioms for finite projective planes? Or does this relate to the order of the finite field being projected? (for example in the Fano plane, does the fact that each line contains 3 points follow from the fact that there are 3 elements {0,1,2} in Z_2?) I haven't been able to find a clear explanation of this (clearly I do not yet have a solid understanding of how such planes are constructed). If someone could enlighten me that would be excellent. How to Fix "Read-only file system" error when I run something as sudo and try to make a folder/file? When I try to save something or rename a file/folder it say this error " Read-only file system" or run something as root in the terminal it say this error  sudo: unable to open /var/lib/sudo/"My User Name"/0: Read-only file system  W: Not using locking for read only lock file /var/lib/dpkg/lock E: Unable to write to /var/cache/apt/   E: The package lists or status file could not be parsed or opened.   When I make a Folder the error dialog in the details with Nautilus is this:    Error creating directory: Read-only file system   I would show you I picture of it but it isn't even letting my save onto my flash drive. Please help me. Strange artifacts along window borders after waking computer from sleep mode NB: Nvidia has released an official fix; please see ,  and/or .  Upon waking up Ubuntu 16.04 from Suspend, the following graphical glitches appear around all windows, context menus, and similar:      This is currently known to affect the following NVIDIA cards running the proprietary drivers:  NVIDIA GeForce 610M, driver version 375.39, 340.102 NVIDIA GT 630M, driver version 375.39 NVIDIA GTX 650, driver version 375.39 NVIDIA GT 740M, driver version 378.13 NVIDIA GTX 745, unknown driver version NVIDIA GTX 850M, driver version 375.39, 378.13 NVIDIA GT 940M, driver version 375.39 NVIDIA GTX 950M, unknown driver version NVIDIA GTX 960M, driver version 378.13 NVIDIA GTX 970, driver version 375.39 NVIDIA GTX 970M, driver version 375.39 NVIDIA GTX 980 TI, unknown driver version NVIDIA GTX 1060, driver version 375.26, 375.39, 378.09 NVIDIA GTX 1070, driver version 378.09  The above above list has been sourced from reports from other users here on AU,  thread, and  thread. NB: This is be no means an exclusive list. It probably effects nearly all Nvidia cards.  Furthermore, this issue has been replicated on a clean install where the only change was a software update and the installation of the latest NVIDIA drivers.  What is going on, and how can it be resolved? I am trying to create something similar to this in Tikz:    I have been looking at using the \shadedraw macro, but have not found a way to create the color spectrum.  It seems possible if I stack multiple gradient-shaded rectangles on top of each other, but I would rather not use such a lengthy and ugly solution.  Is there a way to recreate this PH-scale image in Tikz, ideally using few rectangles?  (Note: the number labels are not necessary, as they will be replaced with horizontal lines anyway.) Did svchost.exe behaviour change in Windows 10 Creators Update (Build 1703)? What other languages have features and/or libraries similar to Perl's format? Formula Specific to Running User? I have a requirement where a certain field can be edited without the validations firing for a particular user. Now I tried to write rule like LastModifiedId != '005000000000000AAA' but the validation was still firing. Then I realized that until the record saves, the LastModifiedId does not change and the validations still fire, as the LastModifiedId would not be updated to the exempted User.   Is there any workaround or a way to check the Id of the User who is currently editing the record? Troubleshooting why Powerbank Doesn't Charge Cell Phone I have powerbank that provides 5v (presumably regulated) power, as typical of most usb interface powerbanks. I have been trying out my powerbank with different phones. It works on all except one. I have tried it with various USB cables, making sure I didn't overlook anything foolish. Then, I looked at the AC adapter of the phone that it didn't seem to be compatible with. The adapter read: 5.4v DC output. The device's official website or manual doesn't tell me what the input voltage should be. So I have the following questions   Is the fact that the device's AC adapter creates a DC 5.4v output enough to assume that, this is the correct voltage for my cell phone? If 5.4v is the input voltage, then when I attempt to power it with a 5v power bank, am I hurting it? Thus far, it just seems to be non-responsive when I try this. It seems another explanation is polarity mismatch. I'm aware that laptops have a polarity correction feature, which could explain why I can charge this phone via my laptop. Is there any other way to tell if polarity is an issue, given that I don't have access to detailed product information (unless the official website is updated, or something)   So that's the gist of it, I'm not sure why my powerbank isn't charging my phone. And I'm having difficulty troubleshooting the underlying problem by myself. Any tips big or small will be appreciated. I was recently invited to join InitiativeQ via a friend on Facebook. The underlying idea makes rough sense to me (as a non finance expert). However their 'hook' seems to be that early adopters will get free money later down the line when the currency launches (the earlier you adopt, the more currency you will receive). Looking at the website, there is a big button with the text Reserve $128,957 (I assume that's their idea of what the dollar value of my reservation will be if it launches).  The website's production quality suggests it is not a scam, however the language suggests strongly that it is. Is this a scam, a get rich quick scheme? Or am I being overly paranoid?