1

Prove that:

For any integer $n > 5$, if $n$ divides $\dfrac{10^{n-1}-1}{9}$, then $n$ is a prime number.

This can also be generalized further as

If $n$ is an integer > 5 and divides a number made out of $k$ repdigit and if $n$ = 1 mod $k$ then $n$ must be a prime number

I also wonder if computation can be optimized for such a special case and the same can be used for finding prime numbers more quickly.

J. W. Tanner
  • 60,406
user3137471
  • 169
  • 8
  • Thanks, I was trying to fix the MathJx display too, it is new for me :) – user3137471 Jan 19 '16 at 20:15
  • Interestingly "related section" just gave me the answer to this http://math.stackexchange.com/questions/4758/why-do-primes-other-than-2-and-5-divide-infinitely-many-repunits?rq=1 However what about the generalization? – user3137471 Jan 19 '16 at 20:29
  • That question doesn't seem to answer yours. That question seems to use the converse - that if $p>5$ is prime, then $10^{p-1}-1$ is divisible by $p$. – Thomas Andrews Jan 19 '16 at 20:35
  • Yes you are right, I just realized and as Charles posted 91 is false prime for such a scenario. f(z)=x=1;n=1;while(x%z!=0,x=10*x+1;n+=1;if(x%z==0,print(n" | "isprime(z)))) I created above pari program to test but apparently I didnt test upto 91 lol – user3137471 Jan 19 '16 at 20:41
  • Yes. The term I was looking for, by the way, was "pseudoprime." There are lots of different types - the composite numbers $n$ such that $n\mid10^{n-1}-1$ are "Fermat pseudoprimes to the base $10$." – Thomas Andrews Jan 19 '16 at 20:45
  • Counterexamples under 1000: 33 91 99 259 451 481 561 657 703 909 – Asinomás Jan 19 '16 at 20:47
  • No, not all those numbers are counter examples to my question, I just figured out that following sequence is the counter example http://oeis.org/A000864 – user3137471 Jan 19 '16 at 20:55

1 Answers1

4

$91>5,$ and 91 divides $\frac{10^{90}-1}{9},$ but $91=7\cdot13$ is composite.

I discovered this with a quick PARI/GP script

ok(n)=if(n%3,Mod(10,n)^(n-1)==1,Mod(10,9*n)^(n-1)==9)
forcomposite(n=6,1e6, if(ok(n), return(n)))

which, suitably modified, lead me to sequence A000864 in the OEIS. Amusingly enough, these numbers are called the "deceptive (non)primes". The OEIS also gives a reference to a paper in the Missouri Journal of Mathematical Sciences which discusses these numbers. Through the magic of Moore's Law, it takes only seconds to replicate the calculations reported there! I extended the search to $10^9$ on a lark, finding 5210 pseudoprimes. The search took 11 minutes on one core.

Charles
  • 32,122
  • oh darn, so it means as thomas pointed out above, these are false primes! So do you have any other comments about "If n is an integer > 5 and divides a number made out of k repdigit and if n = 1 mod k then n must be a prime number". ?

    I will mark this question as closed and resolved once I get some insight on that

    – user3137471 Jan 19 '16 at 20:39
  • Don't close it, select this as the answer. Closing it negates the work Charles put into helping you. @user3137471 – Thomas Andrews Jan 19 '16 at 20:40
  • Sure, I meant the same when I mentioned "resolved" :) – user3137471 Jan 19 '16 at 20:42