I am unable to figure out the output of the following program  big_num_1   = 1000 big_num_2   = 1000 small_num_1 = 1 small_num_2 = 1 big_num_1 is big_num_2 # False small_num_1 is small_num_2 # True   What is happening above? Why is one False and other True.  Source:
2846
Why does the following behave unexpectedly in Python?  &gt;&gt;&gt; a = 256 &gt;&gt;&gt; b = 256 &gt;&gt;&gt; a is b True           # This is an expected result &gt;&gt;&gt; a = 257 &gt;&gt;&gt; b = 257 &gt;&gt;&gt; a is b False          # What happened here? Why is this False? &gt;&gt;&gt; 257 is 257 True           # Yet the literal numbers compare properly   I am using Python 2.5.2. Trying some different versions of Python, it appears that Python 2.3.3 shows the above behaviour between 99 and 100.  Based on the above, I can hypothesize that Python is internally implemented such that "small" integers are stored in a different way than larger integers and the is operator can tell the difference. Why the leaky abstraction? What is a better way of comparing two arbitrary objects to see whether they are the same when I don't know in advance whether they are numbers or not?
49764
The Problem Let $A$ be the matrix $\bigl(\begin{smallmatrix}a&amp;b\\c&amp;d\end{smallmatrix} \bigr)$, where no one of $a,b,c,d$ is $0$. Let $B$ be a $2\times 2$ matrix such that $AB+BA=\bigl(\begin{smallmatrix} 0&amp;0\\ 0&amp;0 \end{smallmatrix} \bigr)$. Show that either   $a+d=0$, in which case the general solution for $B$ depends on 2 parameters, or $ad-bc=0$, in which case the general solution for $B$ depends on one parameter.   (this is question 22 of the last matrix exercise of Further Pure Mathematics by Bostock et al.)  Comments Writing $B=\bigl(\begin{smallmatrix} e&amp;f\\ g&amp;h \end{smallmatrix} \bigr)$ and multiplying out I get that    $(a+d)(f+g)+(b+c)(e+h)=0$ $ae+bg+cf+dh=0$   but I am unable to get the required restrictions on $a,b,c,d$. Is there a quick way of doing the problem that doesn't require manual computation? I thought of considering invertible and non-invertible cases but couldn't get anywhere. Help would be much appreciated.
12700
I am writing a program to output all $a,b \in \mathbb{N}$, where $a \le b \le n$ (for a given $n \in \mathbb{N}$), such that  $$ \frac{ab}{2\sqrt{ab}+a+b}=c\in \mathbb{N} $$  For example, $a=9$, $b=36$, and $c=4$ satisfy this equation.    My program runs at a tolerable speed for values of $n&lt;10^5$, but is not efficient enough for higher values.  Is there anything of value from number theory that I can use to eliminate my options?  For instance, I know that $\sqrt{ab} \in \mathbb{N}$ is a necessary (but not sufficient) condition.
28149
• $C_n =$ this number of bit strings  • A binary string with no adjacent 0s is constructed by   Adding “1” to any string w of length $n-1$ satisfying the condition, or Adding “10” to any string v of length $n-2$ satisfying the condition   I still don't find that intuitive at all. Why adding up $C_{n-1} + C_{n-2}$ results in $C_n$? I have tried my best and asked my friends for help, but they find the formula unintuitive as well. Could anyone here come up with a clear explanation? Thanks!
72883
Is it true that if $ U \oplus W_1 = U \oplus W_2 $, then $ W_1 = W_2 $? I think that if $ U \oplus W_1 = U \oplus W_2 $, then u+w1=u+w2, so W1=W2. But did I make any mistakes?
34769
These are all from Sipser's book, second edition. I was just hoping someone could verify/explain those that are more difficult for me.  $2n = O(n)$: true  $n^2 = O(n)$: false  $n^2 = O(n\log^2 n)$: I say false, because $\log^2 n$ grows more slowly than $n$  $n\log n = O(n^2$): true because $n$ grows more quickly than $\log^2n$  $3^n = 2^{O(n)}$: I wasn't sure what this notation meant. Any clarification here?  $2^{2^n} = O(2^{2^n})$: I would say true, but I'm not entirely sure why.  $n = o(2n)$: false, because $o(2n) = o(n)$ and $n$ grows as quickly as itself.  $2n = o(n^2)$: true, $n^2$ is always more than $2n$ for some constant.  $2^n = o(3^n)$: true  $1 = o(n)$: I'm not really sure.  $n = o(\log n)$: false, $n$ is always larger.  $1 = o(1/n)$: true, because 1 is always larger.
6134
I had a task where I had to figure if the argument was true or not.  $A=\{ n ∈ ℤ \mid n^2 &lt; 5 \}, \quad  B=\{ 7, 8, \{2\}, \{2, 7, 8\}, \{\{7\}\} \}$  The first one was $\{-1, 2\} ∈ A$ and the answer to this was not true  since the set is not an integer.  The second one was $\{-1, 2\} ⊂ A$ and the answer to this was true since  -1 and 2 are elements of $A$.  I just can't seem to understand the difference between ∈ and ⊂ in this task and why the first argument was not true. Also it confuses me that the answer to the first one was that not true because the set is not an integer but aren't -1 and 2 integers?  There is other parts of this task that also add more confusion:     {2, 7, 8} ∈ B Answer: True since {2, 7, 8} is an element of set B      {2, 7, 8} ⊂ B Answer: Not true, for example 2 is not an element in set   B
79098
I have never done this type of question (with arbitrary variables in a counting problem), so I had a lot of difficulty. Please let me know if my approach is wrong. Thanks!   "Computer number 1 is assigned no jobs"; "Computers number 1 and 2 are assigned no jobs"; "exactly two of the computers are assigned no jobs" "No computer is assigned more than one job".   Here are my attempts:  Firstly, the total number of combinations is $r^n$, since for each of the n computers, an unlimited number of tasks from r can be allocated.    Since Computer 1 can be assigned no jobs, there are $r^{n-1}$ ways to assign the tasks to the remaining tasks. Thus P = $\frac{r^{n-1}}{r^n}$. Same idea to the one above, P = $\frac{r^{n-2}}{r^n}$ There are $r^{n-2}$ resources to allocate, but since any two computers, there would be $n \choose 2$ different ways to choose the two computers. Thus $P=\frac{(r^{n-2}) {n \choose 2}}{r^n}$ This one I have no idea how to even begin. Please help!
85075
A friend and I are going back and forth with brain-teasers and I have no idea how to solve this one.  My assumption is that it's possible with some bitwise operators, but not sure.
3104
I'm stuck on what how to continue. I know I'm missing a few steps but this is what I have so far. Thank you in advance!   ¬Cube(b) → Small(b) Small(c) → (Small(d) ∨ Small(e))  Small(d) → ¬Small(c) Cube(b) → ¬Small(e)   Small(c)   ¬Small(b)   ¬Cube(b) Small(b) (→ Elim 1,7) ⊥ (⊥intro 6, 8)    10.Cube(b) (¬Intro 7-9)   ¬Small(e) (→ Elim 4,10)     Goal: Small(c) → Small(b)
13511
I was reading upon Biham and Shamir's paper and a fact has been presented over there: if $ P_1 = \bar P_2$ and I choose a key $K_1 = \bar K_2$ then in that case  $$T_1 = DES(P_1, K_1)$$ $$T_2 = DES(P_2, K_2)$$  then $T_1 = \bar T_2$ . Does this hold for only that particular combination of S-box or it will be same for any S-box combination. I mean if I change S-boxes randomly then will it still be same?  Also there is one more thing mentioned on the paper, but I am not able to get it. PFB the image.   Here output $T$ will be $\bar T_2$ only if I $P_2$ was inserted with $\bar K$. And clearly I am entering $P_1$ (which is $\bar P_2$) hence the output can never be $T_2$. Please correct.
4066
Are the following two boolean expressions the same?  if [ -n $1 ] ; then  if [ -n "$1" ] ; then   If not - When should you put a variable in quotes?
71281
Is this considered bad style  $$2 = \sqrt{4} &lt; \sqrt{16} = 4?$$  It seems as though this is not strictly correct, since $2 = \sqrt{4}$ is a logical proposition which represents boolean value (true or false). A boolean value cannot be less than $\sqrt{16}$.  On the other hand, I am sure that most people will correctly interpret this as shorthand for $2 = \sqrt{4},$ $\sqrt{4} &lt; \sqrt{16},$ and $\sqrt{16} = 4$
21599
If I know for two numbers a and b that    $${a &lt; b }$$  Then is it correct to say that    $$ a \leq b $$  I know that the second statement is true as long as the first one is. It seems OK as it is true but from the other side it seems kinda weird (to me), to say that, if you know, that a is strictly less that b.It's like you lose some extra information.
15071
Suppose $m, n$ are infinite ordinal numbers. $$a) m=n → |m|=|n|$$ $$b)|m|=|n| →m=n$$ $$c)m&lt;n→ |m|&lt;|n|$$ $$d)|\max{(m,n)}|&lt; |m|+|n|$$ $$e)|m|&lt;|n| →|m|^{|n|}&lt;|n|^m$$  Which of the above statements are true? (a) looks true but I do not know the way to work it out. Please help
67560
I am stuck on the 4 th one.I have done the rest.I have found out the value of a_n.But not getting how to proceed for the 4 th one.
24179
I just came back from my Number Theory course, and during the lecture there was mention of the Collatz Conjecture.  I'm sure that everyone here is familiar with it; it describes an operation on a natural number – $n/2$ if it is even, $3n+1$ if it is odd.  The conjecture states that if this operation is repeated, all numbers will eventually wind up at $1$ (or rather, in an infinite loop of $1-4-2-1-4-2-1$).  I fired up Python and ran a quick test on this for all numbers up to $5.76 \times 10^{18}$ (using the powers of cloud computing and dynamic programming magic).  Which is millions of millions of millions. And all of them eventually ended up at $1$.  Surely I am close to testing every natural number? How many natural numbers could there be?  Surely not much more than millions of millions of millions. (I kid.)  I explained this to my friend, who told me, "Why would numbers suddenly get different at a certain point?  Wouldn't they all be expected to behave the same?"  To which I said, "No, you are wrong!  In fact, I am sure there are many conjectures which have been disproved by counterexamples that are extremely large!"  And he said, "It is my conjecture that there are none! (and if any, they are rare)".  Please help me, smart math people.  Can you provide a counterexample to his conjecture?  Perhaps, more convincingly, several?  I've only managed to find one! (Polya's conjecture). One, out of the many thousands (I presume) of conjectures. It's also one that is hard to explain the finer points to the layman. Are there any more famous or accessible examples?