Book to learn basics of number theory?
Undergraduate/High-School-Olympiad Level Introductory Number Theory Books For Self-Learning
Euclidean distance vs Squared I am very new to cryptography (so be kind), but I have a question that may seem silly.   If the one-time pad is the perfect cipher and impossible to crack, why would the following algorithm not be one of the strongest:  To encrypt:   generate a random bit array using a pseudo number generator with the key as the seed  The generated bit array is the size of the data use a simple XOR to encrypt using the generated bit array   To decrypt:   pseudo-random number generator will generate the same bit array with the same seed (the key) generate bit array the same size of the encrypted data run XOR on encrypted data using bit array that's generated   This is very simplified, but you can imagine how for larger encryption you could break down the data into blocks, and in order to ensure that the block bit arrays are random a new seed for each can be derived from the key. So, if $f(k)$ is the pseudo random number generator, and b is the block number, you can encrypt each block with $f(k+b)$. ($k$ is key)   Instead of using a pseudo-random number generator, you could use some hash algorithm to generate the pad.    (assuming you can use equivalently strong keys) would this not be a very strong cipher method? Perhaps it may be strong and heavy on memory since the pad needs to be the size of the data. So during encryption and decryption you need to generate a pad that's equivalent to the size of the data.   Is there a flaw in this algorithm, or would something like this not be practical and much slower than current standards? SSL certificate for a public IP address? I just tried buying a Comodo Positive SSL but it was rejected due to not supporting a public IP address, but instead they only support a domain name.  Does anyone know any SSL certificate provider that supports public IP address instead of a domain name?  My company has a dedicated server hosted with a web hosting company, which is used for running a bugtracker for multiple projects (for multiple clients). Since it's only used for a bugtracker, we don't need a domain name (our clients access it by typing the public IP in their browser). This is a follow-up to .     When I click a link to an SE site in the Android app, it gives me an "open with" pop-up that has two options:         Chrome   Stack Exchange         I can then choose to open SE posts like this "Just once" or "Always."      The problem is that when I set the SE app to "always," and I click "open in browser,"   Except, the app crashes when trying to open it in browser.  LogCat (just right after selecting "Open in browser")  01-22 18:03:36.354: E/AndroidRuntime(16064): FATAL EXCEPTION: main 01-22 18:03:36.354: E/AndroidRuntime(16064): Process: com.stackexchange.marvin, PID: 16064 01-22 18:03:36.354: E/AndroidRuntime(16064): java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.stackexchange.marvin.utils.Helpers.getNonMarvinViewIntent(Helpers.java:452) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.stackexchange.marvin.ui.question.QuestionDialog$1.onClick(QuestionDialog.java:39) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1108) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AdapterView.performItemClick(AdapterView.java:310) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView.performItemClick(AbsListView.java:1145) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView$3.run(AbsListView.java:3903) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Handler.handleCallback(Handler.java:739) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Handler.dispatchMessage(Handler.java:95) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Looper.loop(Looper.java:148) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.app.ActivityThread.main(ActivityThread.java:5417) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at java.lang.reflect.Method.invoke(Native Method) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)   I suspect it's related to , but not sure.  Specs:   Device model: Nexus 5 Android version: Android 6.0.1 SE app version: 1.0.82 (beta) Installed browser: Chrome 47.0.2526.83 (latest at current writing) StructureMap error when invalid controller I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type:  website/Admin/action   however if I miss spell the controller name I get the error below:  Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: key  There error occurs on this line:  Controller controller = ObjectFactory.GetInstance(controllerType) as Controller;   Does anyone have any ideas on how I can handle this error or not allow it to happen at all and maybe just goto a 404 page??  Cheers in advance How do I define global variables in CoffeeScript? Is there a prime which is the form of $10^n + 1$ except $2, 11, 101$? Is there a prime which is the form of $10^n + 1$ except $2, 11, 101$?  I confirm there isn't such prime for $n &lt; 64$. I wonder if it is possible to consider $\mathbb R$ as a Cartesian product $X\times X$ for some set $X$. From the point of view of the dimensionality, there are spaces with a Hausdorff dimension $1/2$ (sort of Cantor sets), but I guess there are other problems in this construction  unrelated to the dimension.  Edited: replying on the comment by Asaf. I want that for all $r\in\mathbb R$ there exists a unique representation $r=\langle x,y\rangle$ where $x\in X$ and $y\in X$. Also, what if we want to have $X$ to be a topological space and $h:X\times X\to\mathbb R$ to be a homeomorphism? How can magnets be used to pick up pieces of metal when the force from a magnetic field does no work? I learned that the force from a magnetic field does no work. However I was wondering how magnets can be used to pick up pieces of metal like small paperclips and stuff. I also was wondering how magnets can stick to pieces of metal like a refrigerator? Given two increasing continuous functions $f,g$ prove that $(b-a) \int^b_a f(x)g(x) dx > \int^b_a f(x) dx \int^b_a g(x) dx$ Given two monotonically increasing continuous functions $f,g$ prove that  $$(b-a) \int^b_a f(x)g(x) dx &gt; \int^b_a f(x) dx \int^b_a g(x) dx,\; b&gt;a$$  what I have tried:  Let $$h(x) = (x-a)\int^x_a f(t)g(t) dt - \int^x_a f(t)dt\int^x_a g(t)dt $$ and trying to figure out that $h'&gt;0$ using MVT to reform $h'(x)$ as   $$h'(x) = (x-a)(-f(x)g(\xi_1) - g(x)f(\xi_2) + f(x)g(x) + f(\xi_3)g(\xi_3))$$ where $\xi_{1,2,3} \in (a,x)$ (That method does not seem to work) Example of a function $f$ on $X$ to $\mathbb{R}$ which is not $X$-measurable but $|f|$, and $f^2$ are measurable. Question  The following is from Bartle:  Give an example of a function $f$ on $X$ to $\mathbb{R}$  which is not $X-$measurable but is such that $|f|,$ and $f^2$ are measurable.  Relavant Information  A family $\textbf{X}$ of subsets of $X$ is a $\sigma$ algebra in case:   $\phi, \mathbb{R} \in \textbf{X}$ $X \setminus A \in \textbf{X}$ if $A \in \textbf{X}$ If $(A_n) \in \textbf{X}$, then the union $\bigcup_{n=1}^{\infty} A_n \in \textbf{X}$  Any set in $\textbf{X}$ is called $X-$ measurable.   A function is $X-$ measurable if for every real $\alpha$, the set $\{x \in X : f(x)&gt;\alpha\}$ belongs to $\textbf{X}$  Attempt  Consider the following function: $$f=\begin{cases} 1 &amp;\mbox{ if} \ x \not\in\mathbb{Q} \\                   -1 &amp;\mbox{ if} \ x \in \mathbb{Q}  \end{cases}$$ defined from $\mathbb{R}$ to $\mathbb{R}$ with $\textbf{X}$ being the Borel algebra (the $\sigma$ algebra generated by all open intervals $(a,b)$) Then if $\alpha \in [-1,1)$, the set $\{x: f(x)&gt;\alpha\}$ consists of the irrational numbers. If I can show that the irrationals are not in the Borel Algebra, then I would be done since $|f|=f^2$ is a constant and easily shown to be measurable. Unfortunately I do not know how to show that the irrationals are not in the Borel Algebra.  Edit it has been brought to my attention that the irrationals are in the Borel algebra. I think this is because the rationals, being countable, can be shown to be in the Borel algebra by constructing appropriate small neighborhoods around each rational and then taking the intersections. I now seek to construct a set that is not in the Borel algebra  Alternatively I have tried to define a set other than the irrationals that is not in the Borel Algebra and define a similar function but to no avail. I am currently self studying this book so it would be of great help to me if the answer could contain heuristics on how to tell when a set if borel measurable (although I do not require this in the answer). Control 220V AC line using MCU 2 GROUP BY WITH DISTINCT , SUM , COUNT : PHP MYQL Ref :   I got answer (thanks coytech ) but i need one more column in its :  as per :  id | mid | pid | owgh | nwgh | 1    3      12    1.5    0.6 2    3      12    1.5    0.3 3    3      14    0.6    0.4 4    3      15    1.2    1.1 5    4      16    1.5    1.0 6    4      17    2.4    1.2  7    3      19    3.0    1.4   i got answer      Select mid ,          COUNT(distinct pid) as cpid  ,          SUM(nwgh) as totalnwgh  from test  GROUP BY mid   sqlfiddle :   mid  cpid       totalnwgh 3      4          3.8 4      2          2.2    But above i need one more column that's as below : totowgh  mid cpid        totalnwgh  totowgh 3      4          3.8        6.3 (DISTINCT value as per pid column) 4      2          2.2        3.9   where totowgh = 6.3 come by DISTINCT value of owgh column  as per distinct pid column  mid = 3 has count 5 but distinct pid  = 4 for mid=3 same way "distinct" owgh = 6.3 for mid=3 and distinct pid.  As pid=12 , column owgh value 1.5 is twice ...hence its is count 1 time hence,  1.5 + 0.6 + 1.2 + 3 = 6.3 ( please not this is as per DISTINCT value of pid )  Please note : i need distinct owgh value as per distinct pid or group by pid .. because if i replace value of owgh 0.6 with 1.5 then it will be 5.7 instead of 7.2 but value of owgh 0.6 belong to pid = 14 and not pid = 12 hence totalcount of owgh change ...but i need is 7.2  SEE WHAT I MEANS   : Change HTML Produced by wp_list_comments() I am developing a WordPress theme for which I would like each comment's timestamp wrapped in in a &lt;span&gt; element for the sake of styling it with CSS rules. However,  as I use it in my theme's comments.php template does not seem to provide options to alter the HTML produced:  &lt;ol class="comment-list"&gt;     &lt;?php         wp_list_comments( array(             'style'       =&gt; 'ol',             'format'      =&gt; 'html5',             'short_ping'  =&gt; true,         ) );     ?&gt; &lt;/ol&gt;   which produces timestamps as such:  &lt;time datetime="2015-12-21T19:09:49+00:00"&gt; december 21st,  2015 on 19:09 &lt;/time&gt;   How can I alter the function's output to include a &lt;span&gt;element around each &lt;time&gt; element without altering core files?  I've tried looking at my theme's functions.php, as well as WordPress wp-includes/comment.php and wp-includes/comment-template.php. None of them deal with the actual tag structure of the comment timestamps generated by wp_list_comments(), so there was nothing there for me to play with. I have seen many questions like:      My question is: what happens if you receive this money (without doing anything or giving your bank account number) but do not do anything scammer wants?  I especially want to know about what happens with the money you got and possible legal consequences.    Is it considered yours because scammer transfered it to you? Do you have to return it? If yes, to whom and in what form? And finally, how is it that scammers are just sending money to random people? Aren't they scared that someone will simply not return it? I understand that this may be stolen money, but it surely took some effort (cash/time) to "acquire" it, so why are they just sending it away? I made a script that should notify me when there's a new chapter of manga that I'm reading. I used the command notify-send to do this. The program works when I am trying to run it in terminal. The notification is showing. However, when I placed this in my crontab, the notification doesn't show. I'm pretty sure that the program is running since I made it to create a file for me. The file was created, but the notification didn't show.  Here's my script  #!/bin/bash    #One Piece Manga reminder     #I created a file named .newop that contains the latest chapter.     let new=$(cat ~/.newop)     wget --read-timeout=30 -t20 -O .opreminder.txt http://www.mangareader.net/103/one-piece.html  if (( $(cat .opreminder.txt | grep "One Piece $new" | wc -l) &gt;=1 ))     then         (( new+=1 ))         echo $new         echo $new &gt; ~/.newop         notify-send "A new chapter of One Piece was released."     else         notify-send "No new chapter for One Piece."         notify-send "The latest chapter is still $new."     fi         exit   And here's what I wrote in my crontab  0,15,30,45 12-23 * * 3   /home/jchester/bin/opreminder.sh The new notice for protected questions looks like this:     Earn 10 reputation in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.  The phrasing of this notice leaves out a lot of info, and is incorrect in many cases:  In the case where the user has just created their account on the site (whether or not they have the association bonus of +100), the default 1 for signing up does count toward the required 10. The message implies that the user has to earn 10 more reputation for a total of 11 (or 111), while the actual requirement is 10 (or 110).  If the user just registered and started off with the association bonus, then later lost part of it (e.g. through bounties or making a downvoted post), earning 10 reputation is not enough to answer protected questions. According to the literal wording of the notice, earning 10 reputation is enough regardless of previous rep loss, but this is not the case.   The easiest fix that can be made, to at least fix part of the problem, would be to explicitly indicate that the association bonus does not count. This was implemented in the prior protected question notice in response to , but was omitted from the new notice. This omission  , and adding this back would remove that. Can we please fix this notice? Let $S = \{ax + by: x,y \in \mathbb{Z}\}$  and let $e &gt; 0$ be the smallest element in $S$. Prove that $e \mid a$, and hence prove that $e = \gcd(a,b)$  I'm afraid I can't provide much of my initial working here because I'm at a loss of how to start.  I suppose that to show $e\mid a$ I would have to show that $eg = a$ for some $g \in \mathbb{Z}$. But I have no idea how I would do this. Formal basis for variable substitution in limits So we do a lot of variable substitution in limits at school. Stuff like $\lim\limits_{x\to5}\ (x+1)^2\ =\ \lim\limits_{y\to6}\ y^2$, where we define the substitution $y = x + 1$.  But I've never been clear on what exactly the theoretical basis for this is. What is the formula that you're actually applying when you do variable substitution? What are the formal conditions under which it is possible?  My conjecture would be the following:  For all continuous $f$, and all real $a$: $\lim\limits_{x\to a}\ (f\circ g)(x)\ =\lim\limits_{x\to g(a)}\ f(x)$, where $g$ is a continuous function  So to take my first example, $f$ would be $x^2$, $g$ would be $x + 1$, and $a$ would be $5$.  Am I in the right area? If this is correct, can it be proven using $\epsilon$-$\delta$? I had a half-hearted shot at it the other night and didn't get anywhere. Get tax deduction for expensive car expense