# number theory

# Number theory : A set of friendly examples

**Even and odd numbers**

Two whole numbers are added together. If their sum is odd, which statements below are

always true? Which are always false? Which are sometimes true and sometimes false?

1 Their quotient is not a whole number.

2 Their product is even.

3 Their difference is even.

4 Their product is more than their sum.

5 If 1 is added to one of the numbers and the product is found, it will be even.

**The Collatz conjecture**

Choose any whole number to start with.

If it is odd, multiply it by 3 and then add 1.

If it is even, divide it by 2. Then repeat this process on the number just obtained. Keep repeating the procedure.

For example, if you start with 58, the resulting chain of numbers is

58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, …

The Collatz conjecture, made by Lothar Collatz in 1937, claims that, if you repeat this

process over and over, starting with any whole number greater than zero, eventually you will finish up with the sequence … 4, 2, 1, 4, 2, 1.

A conjecture is a statement that is thought to be true but has not been proved mathematically to be true for all cases. Although the Collatz conjecture has been shown to work − often very quickly − for many whole numbers, there are some quite small numbers that take a very long time to come down to … 4, 2, 1, 4, 2, 1.Apply this process to all the whole numbers greater than zero and less than or equal to 30.

For each one, find:

• how many steps it takes to reach 1 the frst time

• the largest number in the sequence. (For the sequence above, 58 takes 19 steps and reaches a maximum of 88.)

Look for shortcuts and work with a partner if you like.

**Long division**

Here is a way to check how good your long division skills are. If you are able to follow it

through and get to the end without making a mistake, you can consider yourself a qualiꏨed long division champion.

• Start with any two-digit number (for example, 58). Write it three times so that a six-digit number is formed (585 858).

- Divide this number by 21. There should not be any remainder. If there is, try and find out where you made your mistake and fix it.

• Now divide this new four- or possibly five-digit number by 37. Once again, there should be no remainder.

• Finally, divide this number − which should by now have only three or four digits − by 13.

You will know if you got it right by looking at the number you are left with.

Explain why this exercise works.

(Doing any of this exercise on a calculator is still interesting but is de뀠nitely wimping out!)

**Totient numbers**

1 A totient number is the number of fractions between 0 and 1 (not including 0 or 1) for

a given denominator that cannot be reduced to a simpler equivalent fraction. The totient

number of 2 is 1, since we have ; of 3 it is 2, since we have and ; and of 4 it is also 2, since we have

and ( can be reduced to ). The totient number of 5 is 4, since we have , , , ; and of 6 it is 2, since we have and

. Find the totient numbers forall denominators up to 12.

2 For any denominator n, there are n fractions between 0 and 1 (including 0 but not 1). Of

these fractions, some will be counted towards the totient number of n, but others will

cancel down and count towards the totient number of one of the factors of n. Using this

information and the totient numbers from the previous question, calculate the totient

numbers for 15, 18, 20 and 24.

3 The totient number is related to the prime factors of the original number, since these will

determine which fractions can be cancelled. Using this information, calculate the totient numbers of 72, 81, 98 and 100.

Without using a calculator, can you say which of this set of numbers could not be square numbers?

8116801, 251301659, 3186842, 20720704.

You can just by checking the last digit (units digit) of each number.

Do a bit of experimentation with a calculator and find the four digits that square numbers end in. (This eliminates the third number in this set).

Now check out the pairs of digits that your odd square numbers end with. What digits are possible in the tens position of an odd square number? (This number eliminates the second number in the set).

Complete these sentences with what you have discovered:

* In a square number, the last digit (units digit) can only be _____, _______, _______, _______, _______ or _______.

* The second last digit (tens place) of an odd square number is always _______.

Cube numbers behave rather differently.

A bit of experimentation will show that cube numbers can end in ANY digit (units place). This digit depends on the last digit (units place) of the original number being cubed.

Complete this table:

Fourth powers are in fact just square numbers that have been squared. For example, .

Since and , the last digit of a fourth power can only be 0, 1, 5 or 6.

Fifth powers have a magic of their own. Do a bit of experimentation to find out what it is. In p, particular, I suggest you create tables of second powers, third powers, fourth powers and fifth powers of all numbers from zero to 20. Check, compare…actually, it is fun to “compare rate of growth of powers with increasing integers”…this idea involves rudimentary ideas of calculus…

An odd number can usually be written as a sum of a prime number and another number, which is a power of two. This is true for all odd numbers greater than one but less than 100.

For example, if we choose 23, we can say that it is equal to . There is one more way to represent 23: it is . So, there are two ways to represent 23 as a sum of a prime number and a power of two. But, and do not work as both 21 and 15 are not prime numbers.

Some odd numbers like this can be expressed in many ways.

Try to find various representations as sum(s) of prime number and a power(s) of two of the following integers: 45, 29, 59, 95.

If you are adventurous or courageous, try to find such representations of all odd numbers lying from 1 to 100. You need a lot of patience and stamina and grit…but you will develop an “intuitive feel or tactile feel for numbers”…that’s the way math begins…

There are some odd numbers which cannot be expressed as a sum of a prime number and a power of two. Such numbers are called .

An example of an obstinate number is as the working below shows:

The next power of 2 is , which is clearly greater than 251. Hence, 251 is an obstinate number.

In fact, 251 is the third obstinate number. The first two lie between 100 and 150. Find these two odd numbers keeping track of how you eliminated the other twenty three odd numbers between 100 and 150.

.

Making a list of the powers of two up to might be a good place to start with. Look for short cuts and patterns as you proceed further.

Have fun with numbers !!

Regards,

Nalin Pithwa.

# Patterns in the primes: Clay Math, James Maynard, 2015

(shared from Clay Math website and shared for my readers. Many thanks to James Maynard and Clay Math :-))

# Tutorial on Euclidean algorithm for GCD: pre RMO or PRMO 2019

For each of the following pairs of integers a and n, show that a is relatively prime to n, or that a and n are coprime to each other:

- a=13, n=20
- a=69, n=89
- a=1891, n=3797
- a=6003722857, n=77695236973 (the Euclidean algorithm only requires 3 steps for these integers!).

Cheers,

Nalin Pithwa.

# Some Number Theory Questions for RMO and INMO

1) Let and k be any positive integers. Prove that if and only if .

2) Prove that there are no positive integers a, b, such that .

3) If a and are any positive integers, prove that is not divisible by .

4) The integers 1,3,6,10, , , …are called the triangular numbers because they are the numbers of dots needed to make successive triangular arrays of dots. For example, the number 10 can be perceived as the number of acrobats in a human triangle, 4 in a row at the bottom, 3 at the next level, then 2, then 1 at the top. The square numbers are The pentagonal numbers 1, 5, 12, 22, , , , can be seen in a geometric array in the following way: Start with n equally spaced dots on a straight line in a plane, with distance 1 between consecutive dots. Using as a base side, draw a regular pentagon in the plane. Similarly, draw additional regular pentagons on base sides , , , , all pentagons lying on the same side of the line . Mark dots at each vertex and at unit intervals along the sides of these pentagons. Prove that the total number of dots in the array is . In general, if regular k-gons are constructed on the sides , , …, , with dots marked again at unit intervals, prove that the total number of dots is . This is the nth k-gonal number.

5) Prove that if , then is a divisor of . Show that if a, m, n are positive with , then

, if a is even; and is 2, if a is odd.

6) Show that if then or 3.

7) Show that if and p is an odd prime, then or 1.

8) Suppose that , where x and y are integers greater than 1 and . Show that if and only if .

9) Prove that .

10) Let a and b be positive integers such that . Show that the integer must be a perfect square.

Note that in the above questions, in general, (a,b) means the gcd of a and b.

More later,

Nalin Pithwa.

# Fermat-Kraitchik Factorization Method for factoring large numbers: training for RMO

Reference: Elementary Number Theory, David M. Burton, 6th Edition.

In a fragment of a letter in all probability to Father Marin Mersenne in 1643, Fermat described a technique of his for factoring large numbers. This represented the first real improvement over the classical method of attempting to find a factor of n by dividing by all primes not exceeding . Fermat’s factorization scheme has at its heart the observation that the search for factors of an odd integer n (because powers of 2 are easily recognizable and may be removed at the outset, there is no loss in assuming that n is odd) is equivalent to obtaining integral solutions of x and y of the equation .

If n is the difference of two squares, then it is apparent that n can be factored as .

Conversely, when n has the factorization , with , then we may write

Moreover, because n is taken to be an odd integer, a and b are themselves odd, hence, and will be nonnegative integers.

One begins the search for possible x and y satisfying the equation or what is the same thing, the equation by first determining the smallest integer k for which . Now, look successively at the numbers , , , , until a value of is found making a square. The process cannot go on indefinitely, because we eventually arrive at the representation of n corresponding to the trivial factorization . If this point is reached without a square difference having been discovered earlier, then n has no other factors other than n and 1, in which case it is a prime.

Fermat used the procedure just described to factor in only 11 steps, as compared with making 4580 divisions by the odd primes up to 44021. This was probably a favourable case designed on purpose to show the chief virtue of this method: it does not require one to know all the primes less than to find factors of n.

To illustrate the application of Fermat’s method, let us factor the integer . From a table of squares, we find that ; thus it suffices to consider values of for those k that satisfy the inequality . The calculations begin as follows:

This last line exhibits the factorization , where both the factors are prime. In only seven steps, we have obtained the prime factorization of the number 119143. Of course, one does not always fare so luckily — it may take many steps before a difference turns out to be a square.

Fermat’s method is most effective when the two factors of n are of nearly the same magnitude, for in this case, a suitable square will appear quickly. To illustrate, let us suppose that is to be factored. The smallest square exceeding n is so that the sequence starts with:

. Hence, the factors of 23449 are

When examining the differences as possible squares, many values can be immediately excluded by inspection of the final digits. We know, for instance, that a square must end in one of the six digits 0,1,4,5,6,9. This allows us to exclude all the values in the above example, save for 1266, 1961, 4761. By calculating the squares of the integers from 0 to 99 modulo 100, we see further that, for a square, the last two digits are limited to the following 22 possibilities:

00; 01, 04; 09; 16; 21; 24; 25; 29; 36; 41; 44; 49; 56; 61; 64; 69; 76; 81; 84; 89; 96.

The integer 1266 can be eliminated from consideration in this way. Because 61 is among the last two digits allowable in a square, it is only necessary to look at the numbers 1961 and 4761; the former is not a square, but .

There is a generalization of Fermat’s factorization method that has been used with some success. Here, we look for distinct integers x and y such that is a multiple of n rather than n itself, that is,

.

Having obtained such integers (or, ) can be calculated by means of the Euclidean Algorithm. Clearly, d is a divisor of n, but is it a non-trivial divisor? In other words, do we have ?

In practice, n is usually the product of two primes p and q, with so that d is equal to 1, p, q, or pq. Now, the congruence translates into . Euclid's lemma tells us that p and q must divide one of the factors. If it happened that and , or expressed as a congruence . Also, and yield . By seeking integers x and y satisfying , where , these two situations are ruled out. The result of all this is that d is either p or q, giving us a non-trivial divisor of n.

Suppose we wish to factor the positive integer and happen to notice that . Then, we compute using the Euclidean Algorithm:

This leads to the prime divisor 11 of 2189. The other factor, namely 199, can be obtained by observing that

The reader might wonder how we ever arrived at a number, such as 579, whose square modulo 2189 also turns out to be a perfect square. In looking for squares close to multiples of 2189, it was observed that and which translates into and .

When these congruences are multiplied, they produce . Because the product , we ended up with the congruence .

The basis of our approach is to find several having the property that each is, modulo n, the product of small prime powers, and such that their product’s square is congruent to a perfect square.

When n has more than two prime factors, our factorization algorithm may still be applied; however, there is no guarantee that a particular solution of the congruence , with will result in a nontrivial divisor of n. Of course, the more solutions of this congruence that are available, the better the chance of finding the desired factors of n.

Our next example provides a considerably more efficient variant of this last factorization method. It was introduced by *Maurice Kraitchik* in the 1920’s and became the basis of such modern methods as the *quadratic sieve algorithm*.

Let be the integer to be factored. The first square just larger than n is . So. we begin by considering the sequence of numbers for . As before, our interest is in obtaining a set of values for which the product is a square, say . Then, , which might lead to a non-factor of n.

A short search reveals that ; ; ; or, written as congruences, ; ; . Multiplying these together results in the congruence: , that is, . But, we are unlucky with this square combination. Because only a trivial divisor of 12499 will be found. To be specific,

After further calculation, we notice that

which gives rise to the congruence .

This reduce modulo 12499 to and fortunately, . Calculating

produces the factorization

Problem to Practise:

Use Kraitchik’s method to factor the number 20437.

Cheers,

Nalin Pithwa

# Questions based on Wilson’s theorem for training for RMO

1(a) Find the remainder when is divided by 17.

1(b) Find the remainder when is divided by 29.

2: Determine whether 17 is a prime by deciding if

3: Arrange the integers 2,3,4, …, 21 in pairs a and b that satisfy .

4: Show that .

5a: Prove that an integer is prime if and only if .

5b: If n is a composite integer, show that , except when .

6: Given a prime number p, establish the congruence

7: If p is prime, prove that for any integer a, and

8: Find two odd primes for which the congruence holds.

9: Using Wilson’s theorem, prove that for any odd prime p:

10a: For a prime p of the form , prove that either

or

10b: Use the part (a) to show that if is prime, then the product of all the even integers less than p is congruent modulo p to either 1 or -1.

More later,

Nalin Pithwa.