To some extent the beauty of number theory seems to be related to the contradiction between the simplicity of the integers and the complicated structure of the primes, their building blocks. This has always attracted people.
This quote is indeed true. If you just think about the simplicity of integers and complexity of primes, it's really horrifying. It's almost like how easy and intuitive it is to analyse big "classical objects" but extremely un-intuitive to discuss about "quatum objects".
Today's blog will be a bit special. Today we will discuss about a simple algorithm which is one of the most easiest algorithm which find primes in a certain range. This is called The Sieve of Eratosthenes.
Main Idea of Eratosthenes
The main idea behind this algorithm is very simple. Let's try to understand this using an example.
Suppose, you want to find all primes within $20$.
First you write down all numbers from $2$ to $20$. The list will be $[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]$
Then, you take $2$ and eliminate all it's multiple from the list. This will remove all evens. The remaining list will be $[2,3,5,7,9,11,13,15,17,19]$.
After this, you take $3$ and start eliminating all it's multiple. After this step the new list is $[2,3,5,7,11,13,17,19]$
If we go on again and again by taking the smallest untouched number of the remaining list (in this case 5), then we will filter out all possible composite numbers from the list and finally we will have all primes.
This is basically our algorithm. Below you can find the algorithm for $30$.
Sieve of Eratosthenes
Code to perform this
The code to perform this is quite easy, specially in python, because of the filter function. Let's see the code;
n = 20
all_list = [i for i in range(2,n+1)]
factor_2_remove = filter(lambda m: m %2 !=0, all_list)
factor_2_remove = list(factor_2_remove)
factor_2_remove.append(2)
print(factor_2_remove)
#output:[3, 5, 7, 9, 11, 13, 15, 17, 19, 2]
As you can clearly see, first we have created a list containing a list from $2$ to $n$, then we use filter. This function filter out the numbers which doesn't satisfy the given. Here the condition is $m \not\equiv 0$ mod $2$. This is written as $m%2 !=0$ in python. After using this we again have to add $2$ as it also doesn't satisfy the condition so, it also is removed.
So, to find all primes within any range, we simply do this for all number, not just $2$. You can use a simple for loop for this.
n = 100
all_list = [i for i in range(2,n+1)]
for i in len(all_list):
first_ele = all_list[0]
all_list = filter(lambda m: m %first_ele !=0, all_list)
all_list = list(all_list)
all_list.append(first_ele)
print(all_list)
#Output: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
See!, how easy it is.. But we can do even better. Notice, here we have to run the loop $\pi(n)$ times. But we don't have to do that.
Note: $\pi(n)$ is a function, which represent number of primes in between $2$ to $n$.
Remember: If an integer $a>1$ is not divisible by any prime $p\leq \sqrt{a}$, then $a$ is of necessity a prime.
Using this we can increase the efficiency of the program. Let's try to understand this using an example.
Suppose, we want to find primes up to $100$. Then, we create a list up to $100$, i.e., $2,3,4,5,6,7,\cdots ,98,99,100$. Now, we take $2$ and remove all multiples of $2$ from the list, except $2$ itself. We again do the same for $3$, $5$,$\cdots $. But notice $\sqrt{100}=10$, so we just do this up to $10$, i.e., up to $7$. And this will generate all primes within $100$.
If we do this, now the we only have to run the loop for $\pi(n)$ times. Let's see how much the speed has increased. I will now make two functions, one which runs the loop $\pi(n)$ times and one which runs $\pi(\sqrt{n})$ times.
import math as mp
def with_just_sqrtn(n):#uses sqrt n
all_list = [i for i in range(2,n+1)]
root_n = mp.ceil(mp.sqrt(n))
for i in range(n):
first_ele = all_list[0]
all_list = filter(lambda m: m %first_ele !=0, all_list)
all_list = list(all_list)
all_list.append(first_ele)
if first_ele == root_n:
break
return all_list
print(with_just_sqrtn(100))
#output: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
See, the output is same as before.
The previous one can also be written as a function.
def with_all(n):
all_list = [i for i in range(2,n+1)]
for i in range(n):
first_ele = all_list[0]
all_list = filter(lambda m: m %first_ele !=0, all_list)
all_list = list(all_list)
all_list.append(first_ele)
return all_list
Now, let's find which one takes much time. We will use $n=1,00,000$
n = 1_00_000
import time
start_t = time.time()
with_all(n)
print("Time = %s seconds"%(time.time()-start_t))
#Output: Time = 131.59189105033875 seconds
Just close to $2$ min $11$ sec. Now, let's run the one with small loop number.
So, i hope now you can see, how much faster it is compared to the previous one.
This is all for today, I hope you have learnt something new.
Collatz Conjecture and a simple program
Author: Kazi Abu Rousan
Mathematics is not yet ready for such problems.
Paul Erdos
Introduction
A problem in maths which is too tempting and seems very easy but is actually a hidden demon is this Collatz Conjecture. This problems seems so easy that it you will be tempted, but remember it is infamous for eating up your time without giving you anything. This problem is so hard that most mathematicians doesn't want to even try it, but to our surprise it is actually very easy to understand. In this article our main goal is to understand the scheme of this conjecture and how can we write a code to apply this algorithm to any number again and again.
Note: If you are curious, the featured image is actually a visual representation of this collatz conjecture \ $3n+1$ conjecture. You can find the code here.
Statement and Some Examples
The statement of this conjecture can be given like this:
Suppose, we have any random positive integer $n$, we now use two operations:
If the number n is even, divide it by $2$.
If the number is odd, triple it and add $1$.
Mathematically, we can write it like this:
$f(n) = \frac{n}{2}$ if $n \equiv 0$ (mod 2)
$ f(n) = (3n+1) $ if $n \equiv 1$ (mod 2)
Now, this conjecture says that no-matter what value of n you choose, you will always get 1 at the end of this operation if you perform it again and again.
Let's take an example, suppose we take $n=12$. As $12$ is an even number, we divide it by $2$. $\frac{12}{2} = 6$, which is again even. So, we again divide it by $2$. This time we get, $\frac{6}{2} = 3$, which is odd, hence, we multiply it by 3 and add $1$, i.e., $3\times 3 + 1 = 10$, which is again even. Hence, repeating this process we get the series $5 \to 16 \to 8 \to 4 \to 2 \to 1$. Seems easy right?,
Let's take again, another number $n=19$. This one gives us $19 \to 58 \to 29 \to 88 \to 44 \to 22 \to 11 \to 34 \to 17 \to 52 \to 26 \to 13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1$. Again at the end we get $1$.
This time, we get much bigger numbers. There is a nice trick to visualize the high values, the plot which we use to do this is called Hailstone Plot.
Let's take the number $n=27$. For this number, the list is $27 \to 82 \to 41 \to 124 \to 62 \to 31 \to 94 \to 47 \cdots \to 9232 \cdots$. As you can see, for this number it goes almost as high as 9232 but again it falls down to $1$. The hailstone plot for this is given below.
Hailstone for 27. The highest number and with it's iteration number is marked
So, what do you think is the conjecture holds for all number? , no one actually knows. Although, using powerful computers, we have verified this upto $2^{68}$. So, if you are looking for a counterexample, start from 300 quintillion!!
Generating the series for Collatz Conjecture for any number n using python
Let's start with coding part. We will be using numpy library.
import numpy as np
def collatz(n):
result = np.array([n])
while n >1:
# print(n)
if n%2 == 0:
n = n/2
else:
n = 3*n + 1
result = np.append(result,n)
return result
The function above takes any number $n$ as it's argument. Then, it makes an array (think it as a box of numbers). It creates a box and then put $n$ inside it.
Then for $n>1$, it check if $n$ is even or not.
After this, if it is even then $n$ is divided by 2 and the previous value of n is replaced by $\frac{n}{2}$.
And if $n$ is odd, the it's value is replaced by $3n+1$.
For each case, we add the value of new $n$ inside our box of number. This whole process run until we have the value of $n=1$.
Finally, we have the box of all number / series of all number inside the array result.
Let's see the result for $n = 12$.
n = 12
print(collatz(n))
#The output is: [12. 6. 3. 10. 5. 16. 8. 4. 2. 1.]
You can try out the code, it will give you the result for any number $n$.
Test this function.
Hailstone Plot
Now let's see how to plot Hailstone plot. Suppose, we have $n = 12$. In the image below, I have shown the series we get from $12$ using the algorithm.
Series and Step for $n=12$.
Now, as shown in the above image, we can assign natural numbers on each one of them as shown. So, Now we have two arraies (boxes), one with the series of numbers generated from $n$ and other one from the step number of the applied algorithm, i.e., series of natural numbers. Now, we can take elements from each series one by one and can generate pairs, i.e., two dimensional coordinates.
As shown in the above image, we can generate the coordinates using the steps as x coordinate and series a y coordinate. Now, if we plot the points, then that will give me Hailstone plot. For $n = 12$, we will get something like the image given below. Here I have simply added each dots with a red line.
The code to generate it is quite easy. We will be using matplotlib. We will just simply plot it and will mark the highest value along with it's corresponding step.
import numpy as np
import matplotlib.pyplot as plt
def collatz(n):
result = np.array([n])
while n >1:
# print(n)
if n%2 == 0:
n = n/2
else:
n = 3*n + 1
result = np.append(result,n)
return result
n = 63728127
y_vals = collatz(n); x_vals = np.arange(1,len(y_vals)+1)
plt.plot(x_vals,y_vals)
x_val_max = np.where(y_vals == max(y_vals))[0][0]+1
plt.text(x_val_max, max(y_vals), '({}, {})'.format(x_val_max, int(max(y_vals))))
plt.grid(color='purple',linestyle='--')
plt.ylabel("Sequence Generated")
plt.xlabel("Number of Iteration")
plt.show()
The output image is given below.
Crazy right?, you can try it out. It's almost feels like some sort of physics thing right!, for some it seems like stock market.
This is all for today. In it's part-2, we will go into much more detail. I hope you have learn something new.
Maybe in the part-2, we will see how to create pattern similar to this using collatz conjecture.
Gaussian Prime Spiral and Its beautiful Patterns
Author: Kazi Abu Rousan
Mathematics is the science of patterns, and nature exploits just about every pattern that there is.
Ian Stewart
Introduction
If you are a math enthusiastic, then you must have seen many mysterious patterns of Prime numbers. They are really great but today, we will explore beautiful patterns of a special type of 2-dimensional primes, called Gaussian Primes. We will focus on a very special pattern of these primes, called the Gaussian Prime Spiral. First, we have understood what those primes are. The main purpose of this article is to show you guys how to utilize programming to analyze beautiful patterns of mathematics. So, I have not given any proof, rather we will only focus on the visualization part.
Gaussian Integers and Primes
We all know about complex numbers right? They are the number of form $z=a+bi$, were $i$ = $\sqrt{-1}$. They simply represent points in our good old coordinate plane. Like $z=a+bi$ represent the point $(a,b)$. This means every point on a 2d graph paper can be represented by a Complex number.
In python, we write $i$ = $\sqrt{-1}$ as $1j$. So, we can write any complex number $z$ = $2 + 3i$ as $z$ = $2+1j*3$. As an example, see the piece of code below.
z = 2 + 1j*3print(z)
#output is (2+3j)
print(type(z))
#output is <class 'complex'>
#To verify that it indeed gives us complex number, we can see it by product law.
z1 = 2 + 1j*3z2 = 5 + 1j*2print(z1*z2)
#output is (4+19j)
To access the real and imaginary components individually, we use the real and imag command. Hence, z.real will give us 2 and z.imag will give us 3. We can use abs command to find the absolute value of any complex number, i.e., abs(z) = $\sqrt{a^2+b^2} = \sqrt{2^2+1^2}= \sqrt{5}$. Here is the example code.
print(z.real)
#Output is 2.0
print(z.imag)
#output is 3.0
print(abs(z))
#Output is 3.605551275463989
If lattice points, i.e., points with integer coordinates (eg, (2,3), (6,13),... etc) on the coordinate plane (like the graph paper you use in your class) are represented as complex numbers, then they are called Gaussian Integers. Like we can write (2,3) as $2+3i$. So, $2+3i$ is a Gaussian Integer.
Gaussian Primes are almost same in $\mathbb{Z}[i]$ as ordinary primes are in $\mathbb{Z_{+}}$, i.e., Gaussian Primes are complex numbers that cannot be further factorized in the field of complex numbers. As an example, $5+3i$ can be factorised as $(1+i)(3-2i)$. So, It is not a gaussian prime. But $3-2i$ is a Gaussian prime as it cannot be further factorized. Likewise, 5 can be factorised as $(2+i)(2-i)$. So it is not a gaussian prime. But we cannot factorize 3. Hence, $3+0i$ is a gaussian prime.
Note: Like, 1 is not a prime in the field of positive Integers, $i$ and also $1$ are not gaussian prime in the field of complex numbers. Also, you can define what a Gaussian Prime is, using the 2 condition given below (which we have used to check if any $a+ib$ is a gaussian prime or not).
Checking if a number is Gaussian prime or not
Now, the question is, How can you check if any given Gaussian Integer is prime or not? Well, you can use try and error. But it's not that great. So, to find if a complex number is gaussian prime or not, we will take the help of Fermat's two-square theorem.
A complex number $z = a + bi$ is a Gaussian prime, if:. As an example, $5+0i$ is not a gaussian prime as although its imaginary component is zero, its real component is not of the form $4n+3$. But $3i$ is a Gaussian prime, as its real component is zero but the imaginary component, 3 is a prime of the form $4n+3$.
One of $|a|$ or $|b|$ is zero and the other one is a prime number of form $4n+3$ for some integer $n\geq 0$. As an example, $5+0i$ is a gaussian prime as although it's imaginary component is zero, it's real component is not of the form $4n+3$. But $3i$ is a gaussian prime, as it's real component is zero and imaginary component, 3 is a prime of form $4n+3$.
If both a and b are non-zero and $(abs(z))^2=a^2+b^2$ is a prime. This prime will be of the form $4n+1$.
Using this simple idea, we can write a python code to check if any given Gaussian integer is Gaussian prime or not. But before that, I should mention that we are going to use 2 libraries of python:
matplotlib $\to$ This one helps us to plot different plots to visualize data. We will use one of it's subpackage (pyplot).
sympy $\to$ This will help us to find if any number is prime or not. You can actually define that yourself too. But here we are interested in gaussian primes, so we will take the function to check prime as granted.
So, the function to check if any number is gaussian prime or not is,
import numpy as np
import matplotlib.pyplot as plt
from sympy import isprimedef gprime(z):#check if z is gaussian prime or not, return true or false
re = int(abs(z.real)); im = int(abs(z.imag))
if re == 0 and im == 0:
return False
d = (re**2+im**2)
if re != 0 and im != 0:
return isprime(d)
if re == 0 or im == 0:
abs_val = int(abs(z))
if abs_val % 4 == 3:
return isprime(abs_val)
else:
return False
Let's test this function.
print(gprime(1j*3))
#output is True
print(gprime(5))
#output is False
print(gprime(4+1j*5))
#output is True
Let's now plot all the Gaussian primes within a radius of 100. There are many ways to do this, we can first define a function that returns a list containing all Gaussian primes within the radius n, i.e., Gaussian primes, whose absolute value is less than or equals to n. The code can be written like this (exercise: Try to increase the efficiency).
def gaussian_prime_inrange(n):
gauss_pri = []
for a in range(-n,n+1):
for b in range(-n,n+1):
gaussian_int = a + 1j*b
if gprime(gaussian_int):
gauss_pri.append(gaussian_int)
return gauss_pri
Now, we can create a list containing all Gaussian primes in the range of 100.
To plot all these points, we need to separate the real and imaginary parts. This can be done using the following code.
gaussian_p_real = [x.real for x in gaussain_pri_array]
gaussian_p_imag = [x.imag for x in gaussain_pri_array]
The code to plot this is here (exercise: Play around with parameters to generate a beautiful plot).
plt.axhline(0,color='Black');plt.axvline(0,color='Black') # Draw re and im axis
plt.scatter(gaussian_p_real,gaussian_p_imag,color='red',s=0.4)
plt.xlabel("Re(z)")
plt.ylabel("Im(z)")
plt.title("Gaussian Primes")
plt.savefig("gauss_prime.png", bbox_inches = 'tight',dpi = 300)
plt.show()
Look closely, you can find a pattern... maybe try plotting some more primes
Gaussian Prime Spiral
Now, we are ready to plot the Gaussian prime spiral. I have come across these spirals while reading the book Learning Scientific Programming with Python, 2nd edition, written by Christian Hill. There is a particular problem, which is:
Although, history is far richer than just solving a simple problem. If you are interested try this article: Stepping to Infinity Along Gaussian Primes by Po-Ru Loh (The American Mathematical Monthly, vol-114, No. 2, Feb 2007, pp. 142-151). But here, we will just focus on the problem. Maybe in the future, I will explain this article in some video.
The plot of the path will be like this:
Beautiful!! Isn't it? Before seeing the code, let's try to understand how to draw this by hand. Let's take the initial point as $c_0=3+2i$ and $\Delta c = 1+0i=1$.
For the first step, we don't care if $c_0$ is gaussian prime or not. We just add the step with it, i.e., we add $\Delta c$ with $c_0$. For our case it will give us $c_1=(3+2i)+1=4+2i$.
Then, we check if $c_1$ is a gaussian prime or not. In our case, $c_1=4+2i$ is not a gaussian prime. So, we repeat step-1(i.e., add $\Delta c$ with it). This gives us $c_2=5+2i$. Again we check if $c_2$ is gaussian prime or not. In this case, $c_2$ is a gaussian prime. So, now we have to rotate the direction $90^{\circ}$ towards the left,i.e., anti-clockwise. In complex plane, it is very easy. Just multiply the $\Delta c$ by $i = \sqrt{-1}$ and that will be our new $\Delta c$. For our example, $c_3$ = $c_2+\Delta c$ = $5+2i+(1+0i)\cdot i$ = $5+3i$.
From here, again we follow step-2, until we get the point from where we started with the same $\Delta c$ or you can do it for your required step.
The list of all the complex number we will get for this particular example is:
Index
Complex No.
Step
Index
Complex No.
Step
0
$3+2i$
+1
7
$2+4i$
-1
1
$4+2i$
+1
8
$1+4i$
-i
2
$5+2i$
+i
9
$1+3i$
-i
3
$5+3i$
+i
10
$1+2i$
+1
4
$5+4i$
-1
11
$2+2i$
+1
5
$4+4i$
-1
12
$3+2i$
+i
6
$3+4i$
-1
13
$3+3i$
+i
Complex numbers and $\Delta c$'s along Gaussian prime spiral
Note that although $c_{12}$ is the same as $c_0$, as it is a Gaussian prime, the next gaussian integer will be different from $c_1$. This is the case because $\Delta c$ will be different.
To plot this, just take each $c_i$ as coordinate points, and add 2 consecutive points with a line. The path created by the lines is called a Gaussian prime spiral. Here is a hand-drawn plot.
I hope now it is clear how to plot this type of spiral. You can use the same concept for Eisenstein primes, which are also a type of 2D primes to get beautiful patterns (Excercise: Try these out for Eisenstein primes, it will be a little tricky).
We can define our function to find points of the gaussian prime spiral such that it only contains as many numbers as we want. Using that, let's plot the spiral for $c_0 = 3+2i$, which only contains 30 steps.
Here is the code to generate it. Try to analyze it.
def gaussian_spiral(seed, loop_num = 1, del_c = 1, initial_con = True):#Initial condition is actually the fact
#that represnet if you want to get back to the initial number(seed) at the end.
d = seed; gaussian_primes_y = []; gaussian_primes_x = []
points_x = [d.real]; points_y = [d.imag]
if initial_con:
while True:
seed += del_c; real = seed.real; imagi = seed.imag
points_x.append(real); points_y.append(imagi)
if seed == d:
break
if gprime(seed):
del_c *= 1j
gaussian_primes_x.append(real); gaussian_primes_y.append(imagi)
else:
for i in range(loop_num):
seed += del_c; real = seed.real; imagi = seed.imag
points_x.append(real); points_y.append(imagi)
if gprime(seed):
del_c *= 1j ;
gaussian_primes_x.append(real); gaussian_primes_y.append(imagi)
gauss_p = [gaussian_primes_x,gaussian_primes_y]
return points_x, points_y, gauss_p
Using this piece of code, we can literally generate any gaussian prime spiral. Like, for the problem of the book, here is the solution code:
Also, you can use python using an android app - Pydroid 3 (which is free)
I have also written this in Julia. Julia is faster than Python. Here you can find Julia's version: https://zurl.co/wETi
Prime Number for ISI BStat | TOMATO Objective 70
Try this beautiful problem from Integer based on Prime number useful for ISI BStat Entrance.
Prime number | ISI BStat Entrance | Problem no. 70
The number of integers \(n>1\), such that n, n+2, n+4 are all prime numbers is ......
Zero
One
Infinite
More than one,but finite
Key Concepts
Number theory
Algebra
Prime
Check the Answer
Answer: One
TOMATO, Problem 70
Challenges and Thrills in Pre College Mathematics
Try with Hints
taking n=3, 5, 7, 11, 13, 17....prime numbers we will get
Case of n=3
n= 3
n+2=5
n+4=7
Case of n=5
then \(n\)=5
n+2=7
n+4=9 which is not prime....
Case of n=7,
then n=7
n+2=9 which is not prime ...
n+4=11
Can you now finish the problem ..........
We observe that when n=3 then n,n+2,n+4 gives the prime numbers.....other cases all are not prime.Therefore any no can be expressed in anyone of the form 3k, 3k+1 and 3k+2.
can you finish the problem........
If n is divisible by 3 , we are done. If the remainder after the division by 3 is 1, the number n+2 is divisible by 3. If the remainder is 2, the number n+4 is divisible by 3
The three numbers must be primes! The only case n=3 and gives\((3,5,7)\)
Prime number Problem | ISI BStat | TOMATO Objective 96
Try this beautiful problem from Integer based on Prime number useful for ISI B.Stat Entrance.
Prime number | ISI B.Stat Entrance | Problem no. 96
The number of different prime factors of 3003 is.....
2
15
7
16
Key Concepts
Number theory
Algebra
Prime numbers
Check the Answer
Answer: 16
TOMATO, Problem 96
Challenges and Thrills in Pre College Mathematics
Try with Hints
At first, we have to find out the prime factors. Now \(3003\)=\(3 \times 7 \times 11 \times 13\). but now it can be expressed as another prime number also such as \(3003=3 \times 1001\). So we have to find different prime factors.
Can you now finish the problem ..........
Now, if you have a number and its prime factorisation, \(n={p_1}^{m_1} {p_2}^{m_2}⋯{p_r}^{m_r}\) you can make divisors of the number by taking up to \(m_1\) lots of \(p_1\), up to \(m_2\) lots of \(p_2\) and so on. The number of ways of doing this is going to be\( (m_1+1)(m_2+1)⋯(m_r+1)\).
can you finish the problem........
for the given case \(3003\) has \(2^4=16 \)divisors.
Remainder Problem | ISI-B.Stat Entrance | TOMATO 90
Try this beautiful problem from Integer based on Remainder useful for ISI B.Stat Entrance.
Remainder Problem | ISI B.Stat Entrance | Problem-90
The remainder when \( 3^{12} +5^{12}\) is divided by 13 is......
2
1
4
3
Key Concepts
Division algorithm
Divisor
Number theory
Check the Answer
Answer: 2
TOMATO, Problem 90
Challenges and Thrills in Pre College Mathematics
Try with Hints
The given number is \( 3^{12} +5^{12}\)
we have to check if it is divided by 13 what will be the remainder? if we express the number in division algorithm form then we have........\( 3^{12} +5^{12}=((3)^3)^4+((5)^2)^6)=(27)^4 +(25)^6\)=\(((13 \times 2+1)^4+(13 \times 2-1)^6)\)
Can you now finish the problem ..........
Remainder :
Clearly if we divide \(((13 \times 2+1)^4+(13 \times 2-1)^6)\) by 13 then from \((13 \times 2+1)^4\) , the remainder be 1 and from \((13 \times 2-1)^6)\), the remainder is 1
Try this beautiful problem from Singapore Mathematics Olympiad, SMO, 2012 based on Prime numbers.
Problem on Prime Numbers - (SMO Test)
Let A be a 4 - digit integer. When both the first digit (leftmost) and the third digit are increased by n, and the second digit and the fourth digit are decreased by n, the new number is n times A. Find the value of A.
1201
1551
1818
2000
Key Concepts
Algebra
Prime Number
Check the Answer
Answer: 1818
Singapore Mathematics Olympiad
Challenges and Thrills - Pre - College Mathematics
Try with Hints
If you got stuck you can follow this hint:
We can assume the 4 digit number to be A = \(\overline {abcd}\)
If we expand it into the equation
1000(a+n) + 100(b - n) + 10(c+n) + (d-n) = nA
Try the rest of the sum ...........
After the previous hint :
If we compare the equation it gives :
A + 909 n = nA or
(n-1)A = 909 n
Now one thing we can understand that n and (n-1) are relatively prime and 101 is a prime number . So n= 2 or n= 4.
We have almost got the answer .So try to do the rest now ..........
If n = 4 then A = 1212, which is impossible right?