.
.
.
1
3
1
2
1
1
1
0
9
8
7
6
5
4
3
2
1
is prime?
Let us define a comic number as one that is created by concatenating all of the integers from 1 to n , left to right, in descending order. For example, if we let n = 1 2 , then our comic number would be 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 . What is the first value of n such that its corresponding comic number is prime?
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.
While this is not a proof that it's the smallest, I assure you that it is prime, and that I've checked every number below it! I'd love to see some great example of computer science here; if you have a solution that allowed you to find the answer fairly quickly, please, don't be afraid to share it!
Here is something you can study : Consecutive Number Sequences
After 82, the next n for which the comic number is prime is 37765, which is way hilarious :D
Log in to reply
WOW THAT IS HILARIOUS imagine if I had asked for the 2nd prime!!
Log in to reply
What if I make a problem : Inspired by Garrett Clarke ; and then I'll ask for the 2nd prime. :D Someone would need a super-computer to evaluate that.
Log in to reply
@Satyajit Mohanty – MY COMPUTER WOULD EXPLODE
And then perhaps I could ask for the third such number:)! @Garrett Clarke Truly fantastic problem!
Log in to reply
Well if you found a 3rd number, I'm sure the mathematical community would love to hear what you have to say!
You are a genius.
But why not 2 or 3 and how did u came to this conclusion.... Acc. To me if n=3 the its corresponding comic no. Is 2 and that's also a comic no. If i got the question right
Log in to reply
If n=3 then its corresponding comic number is 321, which is composite.
The only suggestions I can make is to note that all the comic numbers where "n" is a multiple of three are always composite since they also are divisible by three since the sum of the digits is divisible by three. This gives a trivial 33% improvement in a brute force search. Testing for divisibility by 11 can be done by comparing the tally of the digits of the even and odd powers of the ten, if this was done on a rolling basis then it could form a quick test.
Log in to reply
you are right.
We can say the same for n having the form 3 k + 2 for some integer k . and have 66% improvement.
We can rapidly spot that 82 is a good candidate by the following program,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Because of the fact that i s p r i m e function from p y p r i m e s is only probabilistic, we still need to verify that comic(82) is a prime number, which take a very long time.
There's nothing called probabilistic functions in C++ I guess, from what I've learnt till now and yeah I had died and born again by the time I got the answer. Why you do dis C++
Log in to reply
Probabilistic means that a set of tests are done on number n .
If one test fails the number n is for sure not prime.
But if all tests pass, we are not sure that the number n is prime.
Now. we are sure that c o m i c ( n ) for n from 1 to 8 1 are not prime
And for c o m i c ( 8 2 ) , we have to use an other way to prove it's prime.
This actually raises the difference between science/engineering/technology and maths. If you have found that comic(82) has a less than 1/10^10 chance of actually being composite the former would say yes (why waste further time improving the score) whilst the latter can only say it is very very probable that it's a prime.
Log in to reply
I agree with your point of view. Only it depends on the nature of application. Some cryptography algorithms need a real primes to behave as expected. if the number is not a true prime, the protection could be comprised.
I used Miller-Rabin test -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
I strongly feel that a cleverer way exists though
it's unlikely that a clever approach (then testing all terms in the sequence) exists. There isn't a simply way to describe the sequence that we had. If it wasn't just concatenation, but ∑ n 1 0 n , then it is possible to look at the Arithmetic-Geometric progression sum to determine if it can be prime.
Problem Loading...
Note Loading...
Set Loading...
But i feel this is a bit like cheating, so here is my solution taken from ultimate with no modules.
For Miller-Rabin tests above, we know there is at most a 4 1 chance for a given number and base that the "isprime" answer will be wrong. Hence we can run multiple tests with different bases and reduce the chance of error to a very substantially low level.