Chapter 1 What is number theory

Number theory is the study of the set of positive whole numbers, which is often called the set of natural numbers.

We know natural numbers have different types: odd, even, square, cube, prime ( 质数 ), composite ( 合数 ), x mod y, triangular, perfect, fibonacci.

The main goal of number theory is to discover interesting and unexpected relationships between different sorts of numbers and to prove that these relatinships are true.

If we want to study math, number theory is partly experimental and partly theoretical. ( 数论一半是实验性的,一半是理论性的 ):

  • Accumulate data, usually numerical, but sometimes more abstract in nature.
  • Examine the data and try to find patterns and relationships.
  • Formulate conjectures (i.e., guesses) that explain the patterns and relationships. These are frequently given by formulas.
  • Test your conjectures by collecting additional data and checking whether the new information fits your conjectures.
  • Devise an argument (i.e., a proof) that your conjectures are correct.

这一节主要是介绍了数论是研究自然数之间的关系,如果我们想研究各种关系的情况,需要通过大量的收集数据,观察数据之间的关系和规律,后续提出猜想,来用大量的数据来验证猜想是否正确,后续需要证明你的猜想是正确的.

1.1 The first two numbers that are both squares and triangles are 1 and 36. Find the next one and, if possible, the one after that. Can you figure out an efficient way to find triangular-square numbers? Do you think that there are infinitely many?

I found some numbers using code.

for i in range(1, 10000):
    triangles_number = i * (i + 1) // 2
    square_root = int(triangles_number ** 0.5)
    if square_root * square_root == triangles_number:
        print(f"Triangular-square number found: {triangles_number} (Triangle index: {i}, Square root: {square_root})")

result:
- 1 (Triangle index: 1, Square root: 1)
- 36 (Triangle index: 8, Square root: 6)
- 1225 (Triangle index: 49, Square root: 35)
- 41616 (Triangle index: 288, Square root: 204)
- 1413721 (Triangle index: 1681, Square root: 1189)
- 48024900 (Triangle index: 9800, Square root: 6930)

i find patterns and relationships about these data:

Square root : $6 \times 6 - 1 = 35, 6 \times 35 - 6 = 204, 6 \times 204 - 35 = 1189$ … $m_{k+1} = 6m_k - m_{k-1}$

Triangle index: $6 \times 8 - 1 + 2 = 49, 6 \times 49 - 8 + 2 = 288, 6 \times 288 - 49 + 2 = 1681$ … $m_{k+1} = 6m_k - m_{k-1} + 2$

I want to prove this formula:

$\frac {(1 + n) \times n} {2} = m ^ 2$

$4n ^ 2 + 4n = 8m^2$

$(2n + 1)^2 - 8m^2 = 1$

if $ x = 2n + 1 $ and $ y = 2m$

we can get $ x^2 - 2y^2 = 1$ because Pell’s equation is $x^2 - Dy^2 = 1$

If n and m are 0, it doesn’t make any sense. $x=3, y=2$ is the smallest nontrivial solution

$(3 + 2\sqrt 2)(3 - 2\sqrt 2) = 1$

$(x + y\sqrt 2)(x - y\sqrt 2) = 1$

$(3 + 2\sqrt 2)(3 - 2\sqrt 2)(x + y\sqrt 2)(x - y\sqrt 2) = 1$

$(3x + 4y + \sqrt 2(2x + 3y))(3x + 4y - \sqrt 2(2x + 3y)) = 1$

if $3x + 4y = x'$ and $2x + 3y = y'$

we can get $(x' + \sqrt 2 y')(x' - \sqrt 2 y') = 1$ $x'^2 - 2y'^2 =1$

Therefore there are infinitely many solutions. For example, starting from the solution $(x, y) = (3, 2)$, the formulas $x' = 3x + 4y$ and $y' = 2x + 3y$ give a new solution $(17, 12)$. Since $x = 2n + 1$ and $y = 2m$, this new solution gives $n = 8$ and $m = 6$, which is the square–triangular number $36$. Each time we apply the formulas, we get a strictly larger solution, so this process never stops. Therefore there are infinitely many square–triangular numbers.

1.2 Try adding up the first few odd numbers and see if the numbers you get satisfy some sort of pattern. Once you find the pattern, express it as a formula. Give a geometric verification that your formula is correct.

I adding up the first few odd numbers:

$$1 = 1,\quad 1+3 = 4,\quad 1+3+5 = 9,\quad 1+3+5+7 = 16$$

the sums are exactly the square numbers, Let $x$ be the last odd number in the sum. Then the number of terms is $\frac{x+1}{2}$, so

$$1 + 3 + 5 + \cdots + x = \left(\frac{x+1}{2}\right)^2$$

If the sum does not start from 1 but from some odd number $a$, we can subtract the missing part. Let $m = a - 2$ be the odd number just before $a$. Then

$$a + (a+2) + \cdots + x = \left(\frac{x+1}{2}\right)^2 - \left(\frac{m+1}{2}\right)^2,$$

Geometric verification. Arrange $n^2$ dots in an $n \times n$ square, and cut the square into L-shaped layers. Consider the layer whose side length is $s = \frac{x-1}{2} + 1$, where $x$ is an odd number. This layer contains

$$s + s - 1 = (x + 2 - 1) - 1 = x$$

1.3 The consecutive odd numbers 3, 5, and 7 are all primes. Are there infinitely many such “prime triplets”? That is, are there infinitely many prime numbers p such that p + 2 and p + 4 are also primes?

The odd multiples of 3 are $9, 15, 21, 27, \ldots$, appearing every 6. We show that every triple $(p,\ p+2,\ p+4)$ with $p > 3$ contains one of them.

Starting from $p = 5$ and moving forward by 6 each time, the triples

$$(5, 7, \mathbf{9}),\quad (11, 13, \mathbf{15}),\quad (17, 19, \mathbf{21}),\ \ldots$$

each contain a multiple of 3 in the third position ($p + 4$).

Suppose the first position skips past the multiple of 3 and starts at the very next odd number. Then the new third position is $(p + 4) + 2 + 4 = (p + 4) + 6$. Since $(p+4) \bmod 3 \equiv 0$, adding 6 does not change the remainder, so $((p+4) + 6) \pmod 3 \equiv 0 $ as well. The new triple therefore contains a multiple of 3 again. It follows that there are not infinitely many primes $p$ such that $p + 2$ and $p + 4$ are also primes.

1.4. It is generally believed that infinitely many primes have the form N2 + 1, although no one knows for sure. (a) Do you think that there are infinitely many primes of the form $N^2 - 1$? (b) Do you think that there are infinitely many primes of the form $N^2 - 2$? (c) How about of the form $N^2 - 3$? How about $N^2 - 4$? (d) Which values of a do you think give infinitely many primes of the form $N^2 - a$

If a is not a perfect square can have infinitely many primes.

For example, $N^2 - 1 = (N+1)(N-1)$, so this number always has at least two known factors, namely $N+1$ and $N-1$.

If $a$ is a square number, say $a = k^2$, then by the difference of two squares formula, $N^2 - a = (N+k)(N-k)$.

1.5. The following two lines indicate another way to derive the formula for the sum of the first $n$ integers by rearranging the terms in the sum. Fill in the details. $$1 + 2 + 3 + \cdots + n = (1 + n) + (2 + (n-1)) + (3 + (n-2)) + \cdots$$ $$= (1 + n) + (1 + n) + (1 + n) + \cdots$$How many copies of $n + 1$ are in there in the second line? You may need to consider the cases of odd $n$ and even $n$ separately. If that’s not clear, first try writing it out explicitly for $n = 6$ and $n = 7$.

Instead of treating the two cases separately, I derived a single formula that covers both:

$$1 + 2 + \cdots + n = (1+n)\cdot\frac{n - (n \bmod 2)}{2} + (n \bmod 2)\cdot\frac{n + (n \bmod 2)}{2}$$

1.6. For each of the following statements, fill in the blank with an easy-to-check criterion: (a) $M$ is a triangular number if and only if ____ is an odd square. (b) $N$ is an odd square if and only if ____ is a triangular number. (c) Prove that your criteria in (a) and (b) are correct.

$$8M + 1 = 8\cdot\frac{n(n+1)}{2} + 1 = 4n^2 + 4n + 1 = (2n+1)^2$$

Chapter 2 Pythagorean Triples