brain

tamnd's digital brain — notes, problems, research

41294 notes

TAOCP 4.6.3 Exercise 6

**Exercise 4.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.3 Exercise 7

We consider each part separately.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.3 Exercise 3

We are asked to compute $2^{375}$ by various exponentiation methods.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.3 Exercise 5

We are asked to construct the first $r+1$ levels of the "power tree" as defined in Figure 14 and in Exercise 4.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.3 Exercise 4

**Exercise 4.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.3 Exercise 2

We are asked to write a MIX program for Algorithm A (the right-to-left binary method for exponentiation) to compute $x^n \bmod w$, where $w$ is the word size, and then to compare it with a serial mult...

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.3 Exercise 1

Let u(x)=u_nx^n+\cdots+u_0 be reducible over the integers, and let

taocpmathematicsalgorithmsvolume-1simple
TAOCP 4.6.2 Exercise 39

Let \(u(x)\in \mathbb{Z}[x]\) be irreducible, with \(n=\deg u\) and coefficient height \(H\).

taocpmathematicsalgorithmsvolume-1hm-project
TAOCP 4.6.2 Exercise 40

Let u(x)=u_nx^n+\cdots+u_0 be reducible over the integers, and let

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 36

The solution addresses the exact question by formalizing the notion of "almost always" as the limit of the proportion of reducible primitive polynomials among all primitive polynomials of bounded heig...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 37

Let $n$ be fixed and let $p \to \infty$.

taocpmathematicsalgorithmsvolume-1hm-medium
TAOCP 4.6.2 Exercise 38

Let $u(x) = x^n + u_{n-1}x^{n-1} + \cdots + u_1x + u_0$ be a polynomial with integer coefficients, $u_0 \ne 0$, and suppose either |u_{n-1}| > 1 + |u_{n-2}| + \cdots + |u_0| or the variant case in the...

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 34

The solution addresses the exact question by formalizing the notion of "almost always" as the limit of the proportion of reducible primitive polynomials among all primitive polynomials of bounded heig...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 35

Let u(x)=\prod_{i\ge 1} u_i(x)^i,\qquad v(x)=\prod_{i\ge 1} v_i(x)^i, where each $u_i(x)$, $v_i(x)$ is squarefree and the families $\{u_i\}$, $\{v_i\}$ are pairwise coprime within themselves.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 31

Let $p$ be an odd prime and $d \ge 1$.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 33

The statement is **false in general**.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 32

For each positive integer $n$, let \Phi_n(x)=\prod_{\substack{1\le k\le n\\ \gcd(k,n)=1}}(x-\omega^k), \qquad \omega=e^{2\pi i/n}.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.2 Exercise 30

Let R=\mathbb{F}_p[x]/(q(x)).

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 29

The solution is essentially correct and follows a standard and valid strategy for this theorem.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 28

Let $u(x)$ be a random monic polynomial of degree $n$ over $\mathbb{F}_p$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 27

Let f_n(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots+a_0 be a primitive polynomial of degree $n$ with integer coefficients, and let

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 24

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 25

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.2 Exercise 26

Let $u(x) = p_1(x)\cdots p_r(x)$ be squarefree, and let $\deg p_i(x) = d_i$ with $\sum_{i=1}^r d_i = n = \deg(u)$.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.2 Exercise 22

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 23

Let $u(x)$ be a polynomial with integer coefficients that is squarefree over $\mathbb{Z}$.

taocpmathematicsalgorithmsvolume-1hm-medium
TAOCP 4.6.2 Exercise 21

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 20

Let \[ u(x)=u_n x^n+\cdots+u_0=u_n\prod_{j=1}^n(x-\alpha_j), \qquad \|u\|^2=\sum_{j=0}^n |u_j|^2, \qquad

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 19

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 17

We are asked to reconstruct a binary string given the counts of its consecutive pairs grouped by how many ones they contain.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 18

Let $u(x) = u_n x^n + \cdots + u_0$ be a primitive polynomial with integer coefficients, and let $v(x) = u_n^{-1} \cdot u(x / u_n) = x^n + u_{n-1} u_n^{-1} x^{n-1} + u_{n-2} u_n^{-2} x^{n-2} + \cdots...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 15

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.2 Exercise 16

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.2 Exercise 14

The solution correctly addresses the exercise.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.2 Exercise 13

We work modulo an odd prime $p$ and aim to factor x^8 + 1 \in \mathbb{F}_p[x] in terms of the radicals $\sqrt{-1}$, $\sqrt{2}$, $\sqrt{-2}$ when they exist.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 12

Let $u(x)=x^8+1.$ We seek the number $r$ of irreducible factors of $u(x)$ modulo a prime $p$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 11

We are given a black-box quantum operation that acts on a single qubit.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.2 Exercise 10

Assume that $u(x)$ is squarefree and satisfies u(x)=p_1(x)p_2(x)\cdots p_r(x), as in (6).

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.2 Exercise 9

Assume that $u(x)$ is squarefree and satisfies u(x)=p_1(x)p_2(x)\cdots p_r(x), as in (6).

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.6.2 Exercise 8

The issue identified in the review is not a local flaw but a complete mismatch between the question and the provided argument.

taocpmathematicsalgorithmsvolume-1hm-medium
TAOCP 4.6.2 Exercise 7

Assume that $u(x)$ is squarefree and satisfies u(x)=p_1(x)p_2(x)\cdots p_r(x), as in (6).

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 6

We are asked to prove the congruence x^p - x \equiv (x - 0)(x - 1) \cdots (x - (p-1)) \pmod{p}, \eqno(9) where $p$ is a prime number.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 5

The solution addresses both parts of the exercise.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 3

I have carefully traced the construction and identified why the previous implementation produces incorrect matrices.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 4

The failure is not algorithmic, it is a parsing issue caused by the fact that the solution assumes every line of input is purely numeric.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.6.2 Exercise 2

The solution addresses both parts of the exercise.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.2 Exercise 1

Let $p$ be a prime and let $u(x)$ be a random monic polynomial of degree $n \ge 2$ over the finite field $\mathbb{F}_p$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 24

The exercise asks for a direct algebraic simplification of two displayed identities involving content and primitive part of polynomials over a unique factorization domain $S$.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 25

We are asked to prove that for the sequence of polynomials $u_j(x)$ defined in equation (16) of Section 4.

taocpmathematicsalgorithmsvolume-1math-research
TAOCP 4.6.1 Exercise 26

The solution addresses both parts of the exercise.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 23

Let $u_0(x),u_1(x),\dots,u_{k+1}(x)$ be the Sturm sequence generated from a real polynomial $u(x)$ of degree $m=\deg(u)$ as in (29): u_0(x) = u(x),\qquad u_1(x) = u'(x), and for $j \ge 1$,

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 19

We treat the problem in two parts: first the general existence theorem for greatest common right divisors of integer matrices, then the explicit computation for the specific matrices.

taocpmathematicsalgorithmsvolume-1math-project
TAOCP 4.6.1 Exercise 21

We are asked to analyze **Algorithm C** for computing the greatest common divisor (gcd) of two integer polynomials of degree $n$ with coefficients bounded in absolute value by $N$, and to prove that i...

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 20

The game is played on a tree, which is an undirected, connected, acyclic graph.

taocpmathematicsalgorithmsvolume-1math-project
TAOCP 4.6.1 Exercise 17

The previous write-up fails at a foundational level because it treats the task as an array-sorting problem, while the exercise is about the structure of the free associative algebra over an alphabet.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 16

Let N(d_1,\ldots,d_n;S_1,\ldots,S_n) = |S_1|\cdots |S_n| -

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 15

Let $A=(a_{ij})$ be an $n\times n$ real matrix, and let $r_i=(a_{i1},a_{i2},\ldots,a_{in})$ denote its $i$th row.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 13

**Corrected Solution to Exercise 4.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 14

The solution does not correctly address the statement being proved, and it does not provide a valid argument that the pseudo-remainder must be divisible by the leading coefficient $l(v)$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 12

The reviewer feedback does not match the exercise being solved.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 11

The question refers to the row-naming convention of Table 1 in §4.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 10

Let $S$ be a unique factorization domain, and let $S[x]$ denote the ring of polynomials in one indeterminate $x$ with coefficients in $S$.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 8

Let $f(x)$ be a polynomial with integer coefficients, and suppose that $f(x)$ is irreducible over the domain of integers.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 9

**Solution to Exercise 4.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 7

Let $f(x)$ be a unit in the polynomial ring over a unique factorization domain $S$.

taocpmathematicsalgorithmsvolume-1math-simple
TAOCP 4.6.1 Exercise 5

Let $S = \mathbb{F}_p$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.6.1 Exercise 6

We are asked whether the _binary gcd algorithm_ (Algorithm 4.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 2

**Problem 2.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 4.6.1 Exercise 4

Let $F=\mathbf F_p$.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.6.1 Exercise 3

We are asked to compute the pseudo-quotient $q(x)$ and pseudo-remainder $r(x)$ over the integers for u(x) = x^6 + x^5 - x^4 + 2x^3 + 3x^2 - x + 2, \qquad v(x) = 2x^2 + 2x^2 - x + 3.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 47

We are asked to recover a literary quotation x = x_1 x_2 represented in ASCII, from the ciphertext

taocpmathematicsalgorithmsvolume-1math-research
TAOCP 4.6.1 Exercise 1

**Exercise 4.

taocpmathematicsalgorithmsvolume-1simple
TAOCP 4.5.4 Exercise 46

Let G=\langle a\rangle=(\mathbb Z/p\mathbb Z)^\times, where $p$ is prime and $a$ is a primitive root modulo $p$.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.5.4 Exercise 45

We are asked to solve the congruence x^2 - ay^2 \equiv b \pmod{n} for integers $x$ and $y$, given that $a, b \perp n$ and $n$ is odd, without knowledge of the factorization of $n$.

taocpmathematicsalgorithmsvolume-1math-project
TAOCP 4.5.4 Exercise 42

**Corrected Solution to Exercise 4.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 43

Let m=pq be a Blum integer, with

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 44

**Solution.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 41

The requested solution is a standalone writeup, so I am providing it in a writing block.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 40

We are asked to consider an abstract computer that can perform the operations $x + y$, $x - y$, $x \cdot y$, and $\lfloor x/y \rfloor$ on integers $x$ and $y$ of arbitrary length in one unit of time,...

taocpmathematicsalgorithmsvolume-1math-project
TAOCP 4.5.4 Exercise 38

The reviewer’s objections are correct.

taocpmathematicsalgorithmsvolume-1medium
TAOCP 4.5.4 Exercise 37

Let $N = pq$ where $p \equiv 3 \pmod 8$ and $q \equiv 7 \pmod 8$.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 39

We are asked to find a long chain of *successive primes*, where a prime \(q\) is a successor of a prime \(p\) if \[ q = 2^k p + 1 \] for some integer \(k \ge 0\), and both \(p\) and \(q\) are prime.

taocpmathematicsalgorithmsvolume-1project
TAOCP 4.5.4 Exercise 35

Let $N = pq$ where $p \equiv 3 \pmod 8$ and $q \equiv 7 \pmod 8$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 36

Equation (22) has the form T(m)\asymp m+\frac{\ln N}{\ln m}, up to multiplicative factors that vary only slowly with $m$.

taocpmathematicsalgorithmsvolume-1hm-medium
TAOCP 4.5.4 Exercise 33

**Statement.

taocpmathematicsalgorithmsvolume-1math-research
TAOCP 4.5.4 Exercise 34

Let $N = pq$ be the product of two distinct primes, as in the RSA scheme.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 31

We are asked to use exercise 1.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 30

Let $N$ be an odd positive integer with prime factorization N = q_1^{f_1} \cdots q_d^{f_d}, where the $q_i$ are distinct primes and $f_i \ge 1$.

taocpmathematicsalgorithmsvolume-1hm-hard
TAOCP 4.5.4 Exercise 32

Suppose RSA uses public exponent $e=3$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 28

Let $Q(A,B)=A^2-dB^2,$ and let $v_p(n)$ denote the exponent of the prime $p$ in $n$, with the convention that $v_p(n)=k \iff p^k\mid n,\quad p^{k+1}\nmid n.$ The quantity to be determined is $f(p,d)=\...

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 29

Let S(n)=\{\,p_1^{e_1}p_2^{e_2}\cdots p_m^{e_m}\le n : e_i\ge0\,\}.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 27

Let N=5\cdot 2^n+1, and let

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 26

Let N=fr+1,\qquad 0<r\le f+1, and suppose that for every prime divisor $p$ of $f$ there exists an integer $x_p$ such that

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 25

The statement as printed in the exercise contains a typographical problem in the oscillatory term.

taocpmathematicsalgorithmsvolume-1hm-project
TAOCP 4.5.4 Exercise 23

Let $p \ge 0$ be an integer and $q > 1$ an odd integer.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 24

Let $S = {n : 1 < n \le N,\ n\ \text{odd},\ n\ \text{composite}}$.

taocpmathematicsalgorithmsvolume-1math-medium
TAOCP 4.5.4 Exercise 21

Let $p$ be a prime number, and consider Algorithm B from Section 4.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 22

Let $n\ge 3$ be odd, and let $p_n$ be the probability that Algorithm P declares $n$ to be prime when $n$ is actually composite.

taocpmathematicsalgorithmsvolume-1math-hard
TAOCP 4.5.4 Exercise 20

Let $D$ be a given positive integer, and let $p$ range over odd primes.

taocpmathematicsalgorithmsvolume-1math-research
TAOCP 4.5.4 Exercise 18

Let $p_n$ and $p_{n-1}$ denote the two largest prime factors in a typical factorization, ordered so that $p_{n-1} \le p_n$.

taocpmathematicsalgorithmsvolume-1hm-medium