P Ones

Find the sum of all prime numbers p p that divides 111111111111111 1 the digit 1 is repeated p times \underset{\text{the digit 1 is repeated }p \text{ times}}{\underbrace{111111111111111\cdots 1}} .


The answer is 3.

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.

3 solutions

Happy Melodies
Jun 21, 2015

Edited Solution Intuition: ( 111 1 ) p = 1 0 p 1 + 1 0 p 2 + + 10 + 1 \underbrace{(111 \ldots 1)}_p =10 ^{p-1} + 10^{p-2} + \ldots + 10 + 1 Next notice: 1 0 p 1 + 1 0 p 2 + + 10 + 1 = 1 0 p 1 9 10 ^{p-1} + 10^{p-2} + \ldots + 10 + 1 = \frac{10^p -1}{9} By Fermat's Little Theorem ( a p a ( m o d p ) a^p \equiv a \pmod p ), we have 1 0 p 1 10 1 = 9 ( m o d p ) 10^p-1 \equiv 10 -1 = 9 \pmod p .

Then, it follows that: 1 0 p 1 9 1 ( m o d p ) p : gcd ( p , 9 ) = 1 \frac{10^p -1}{9} \equiv 1 \pmod{p} \ \forall p: \gcd(p,9) = 1 .

The only possible prime that satisfies gcd ( p , 9 ) 1 \gcd(p,9) \neq 1 is 3 \boxed{3} . Checking this case, we see that indeed 3 3 divides 111 111 and we are done!

Special thanks to @Prasun Biswas for pointing out the errors in my previous solution.

Your second equation should have RHS as 1 0 p 1 9 \dfrac{10^p-1}9 . Also, it should be Fermat's Little Theorem, not Last (in your conclusion). Fermat's Last Theorem is a completely different theorem.

Here's how the Fermat's Little Theorem argument works.

We have, by FLT and basic modular arithmetic,

1 0 p 10 ( m o d p ) 1 0 p 1 9 ( m o d p ) 1 0 p 1 9 1 ( m o d p ) p : gcd ( p , 9 ) = 1 10^p\equiv 10\pmod{p}\implies 10^p-1\equiv 9\pmod{p}\\\implies\frac{10^p-1}{9}\equiv 1\pmod{p}~~\forall~p:\gcd(p,9)=1

And the only prime for which gcd ( p , 9 ) 1 \gcd(p,9)\neq 1 is p = 3 p=3 . Check this case manually using the divisibility rule for 3 3 and you see that p = 3 p=3 indeed works and is hence the only prime solution.

The conclusion follows the same as in your solution.

You can use a similar approach to try out this proof problem (Q-4) here .

Prasun Biswas - 5 years, 11 months ago

Log in to reply

Why does the greatest common divisor of p and 9 have to be 1 in order for that congruence to work?

Ραμών Αδάλια - 4 years, 12 months ago

Log in to reply

@Ραμών Αδάλια @Puneet Pinku, the reason for that is because, in modular arithmetic, division by a number x x is well-defined (valid) for a congruence when x x and the congruence modulus are coprime. You can see that this is true because modular multiplicative inverse of an element exists iff it's coprime with the modulus.

When they are not coprime, the division might result in an incorrect congruence. For example, consider 5 15 ( m o d 10 ) 5\equiv 15\pmod{10} which is true but division of both sides by 5 5 gives 1 3 ( m o d 10 ) 1\equiv 3\pmod{10} which is obviously false.


Another way you can see why they should be coprime is by means of the following theorem:

Theorem: Let a , b a,b be two integers divisible by an integer x 0 x\neq 0 and let n n be a positive integer. Then, the following congruence holds:

a b ( m o d n ) a / x b / x ( m o d n / gcd ( x , n ) ) a\equiv b\pmod{n}\iff a/x\equiv b/x\pmod{n/\gcd(x,n)}

For our case, we need the modulus to be n n , so we set gcd ( x , n ) = 1 \gcd(x,n)=1 , i.e., consider only those x x 's which are coprime to n n . For a proof of the above theorem, see this .

Prasun Biswas - 4 years, 11 months ago

Just saw this post! You are right and I realised how messed up my solution is ... (Can't imagine how I put it as Fermat's Last Theorem instead of Little but I knew that haha.) Thank you for correcting me! :)

Happy Melodies - 5 years, 10 months ago

Why should the gcd of (p,9) be 1?

Puneet Pinku - 5 years ago

There are many primes that divide 111...1. For example: 3|111, 11|1111, 41|11111, 239|1111111, etc. Do these not matter?

Kelly Waters - 5 years, 7 months ago

Log in to reply

The problem says that p 11 11 p p\mid\underbrace{\overline{11\ldots 11}}_p (notice the underbrace) , hence the number of 1 1 's in the corresponding repunit must be p p too.

Only the case of p = 3 p=3 satisfies the problem criterions since 111 111 has 3 1's and 3 111 3\mid 111 . The rest of the cases you mentioned don't have the number of 1's in the corresponding repunit equal to p p . For example, 11 1111 11\mid 1111 but 1111 1111 has 4 1's, not 11 1's.

Prasun Biswas - 5 years, 7 months ago

agree that 3 works, but id it the only prime? doesn't 1 work as well? (1 is prime and divises itself, no?)

Alexis Vlr - 4 years, 8 months ago

Log in to reply

1 is not a prime

Sean Tremba - 2 years, 10 months ago

I have to say the meaning of the question was unclear until I read the answer. P isn't the number, and it's not the base in which the number is expressed, it's the number of digits in the number? I feel like I spent more time reading the question than was spent writing it, or at the least, not much effort would be required to phrase it clearly. Hopefully this app doesn't habitually waste people's time.

Ban Yan - 3 years, 11 months ago

17 works as well? 17*653594771824183 = 11 111 111 111 111 111

Unless I messed up my long division?

Ashley Reavis - 5 years, 3 months ago

Log in to reply

Yup, you messed up your long division. My calculator shows that,

11111111111111111 17 653594771241830.05882353 \frac{11111111111111111}{17}\approx 653594771241830.05882353

Prasun Biswas - 5 years, 3 months ago

But 11 also satisfies.

Aaryaman Gupta - 5 years, 8 months ago

Log in to reply

No it does not. The equation is asking a prime that divides perfectly the length of the number equal to p. 11 does not satisfy because:

11111111111 mod 11 ≠ 0. Notice the length p of the integer is 11 which is not dividing the number. Thus 3 is the only solution possible, by divisibility rule. Read posts by Prasun biswas who as explained it well above.

Nitin Mishra - 5 years ago

11 111 111 111 : 11 = 1 010 101 010 And 13 also works.

Ragnhild Kjøsnes - 5 years, 5 months ago

Log in to reply

11 does not satisfy. For numbers consisting only of one's eleven only divides them if there is an even number of ones. The equation is asking for numbers that evenly divide.

Miles Johnson - 5 years, 3 months ago

Log in to reply

This was a terribly worded question. I thought i was asking for the sum of primes from the set {1, 11, 111, 1111, etc} I have never seen the | notation like used in the problem. I came here to learn but frustrated by poorly worded problems

Richard Allred - 3 years, 6 months ago
Daniela Perlini
Sep 20, 2018

Let a a be ( 111...1 ) (111...1) . It's clear that a = a × 10 + 1 1 0 p a=a\times 10 + 1 -10^{p} where p p is the number of digits 1 1 that build a a .

Since 1 0 p 10 ( m o d p ) 10^p\equiv 10 \pmod p (for Fermat's Little Theorem), the following equation is true: 9 a + 1 = 1 0 p 10 ( m o d p ) 9a+1=10^{p}\equiv 10 \pmod p

We then can deduce that

9 ( a 1 ) 0 ( m o d p ) 9(a-1)\equiv 0 \pmod p

For the zero-product property we have that p 9 p a 1 p|9 \vee p|a-1 .

If p a 1 p|a-1 then clearly p a p\nmid a , so p \nexists p such that p ( 111...1 ) p| (111...1) and p ( 111...0 ) p|(111...0) . Therefore p 9 p|9 : that is true only if p = 3 p=3 .

Now I only need to verify that it's actually true that 3 111 3|111 , which it is. So the "sum" of all prime numbers such that p ( 111...1 ) p|(111...1) is 3 3 .

Leonhard Euler
Feb 24, 2020

Suppose p p divides 111 1 p \underbrace{111\ldots 1}_{p} . Then p p also divides 999 9 p = 1 0 p 1 \underbrace{999\ldots 9}_{p} = 10^{p}-1 .

In other words 1 0 p 1 0 ( m o d p ) 10^{p}-1\equiv 0 \pmod{p} .

By Fermat's Little Theorem, we know 1 0 p 10 ( m o d p ) 10^{p}\equiv 10\pmod{p} .

Therefore 9 0 ( m o d p ) 9\equiv 0 \pmod{p} , which can only be true for p = 3 p=3 , if p p is a prime.

Since 3 3 is a prime factor of 111 111 , the only prime number p p such that p 111 1 p p|\underbrace{111\ldots 1}_{p} is p = 3 \boxed{p=3} .

Thank you sir,thsi is much better neat and clean explanation

majoj pradhani - 8 months, 3 weeks ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...