The number
1
2
1
is composite.
The number
1
2
1
1
is composite.
The number
1
2
1
1
1
is composite.
The number
1
2
1
1
1
1
is composite.
Let n be the smallest positive integer such that 1 2 n times 1 1 . . . 1 1 is prime.
Find n .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Then may I accept are there no any method to solve it manually ?
Log in to reply
NO, you can't solve it manually. Or more precisely: it's too tedious to solve it by hand.
Log in to reply
Well, we can cut the problem down a little. If we write x n = 1 2 × n 1 1 … 1 then 1 1 divides x n whenever n is odd, and 3 divides x n whenever 3 divides n , so we can restrict our search to even n which are not multiples of 3 . That has cut out two-thirds of the numbers to test.
Log in to reply
@Mark Hennings – Add to this the fact that 7 divides x n when n ≡ 2 ( m o d 6 ) , and we only need to search for primes in integers x n where n ≡ 4 ( m o d 6 ) . That means you only have to test 2 3 numbers until you find the prime number x 1 3 6 .
At this point, short cuts run out, since some of the prime factorisations of these x n only involve seriously large prime numbers. For example: x 3 4 = 1 0 1 4 9 2 1 7 7 8 1 × 1 0 2 9 6 4 4 8 8 5 4 1 × 1 1 5 8 9 4 7 9 9 9 8 2 7 9 1
@Mark Hennings – Oh that's nice! I don't know why I didn't thought of this...
Please anyone post the solution manually notwithstanding long and tedious.
Log in to reply
This is meant to be "Computer Science" problem, so I seriously doubt that there's a "notwithstanding long and tedious" solution.
For Matlab, this made it much easier! https://www.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic Thank you John D'Errico!
Log in to reply
By the way, I also found this problem to be very interesting!
Since the number X n is a multiple of 3 when n ≡ 2 ( m o d 3 ) , and a multiple of 1 1 if n is odd, we can cut down our hunt to number of the form 6 m and 6 m + 4 straight away...
Here is My Java Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
I used BigInteger to calculate the value of n.
Problem Loading...
Note Loading...
Set Loading...
Here is my Python program:
Of course the isprime() function is where the fun lies. I use a Miller–Rabin primality test. You can look those up on the web.
It's important to know that for numbers this large, the test only gives likely primes. But if the test is run with enough "witness" numbers, it gives a very good probability of indicating primality. It's not a bad idea to double check the result if you have another way to do that.
It's surprising to me that it required such a large number to finally find a prime. n = 136.