Solution of the Week #379 - So Many Digits

Glossary: a number which only contains 1s, such as 11 or 11111 is called a repunit. All prime numbers with the exception of 2 and 5 divide exactly into a repunit of p-1 digits, and frequently divide exactly into smaller repunits too (some divisor of p-1).

74 is 37 x 2, but we don’t need to worry about the factor of 2, as 3…374 and 1…13…374 will naturally contain exactly one factor of 2 too.

3…374 can be rewritten as 2(1…1 x 150 + 37).

Since 150 and 37 do not share any factors, we are effectively looking for the smallest repunit that 37 divides into. By inspection 37 x 3 = 111, and so therefore our intermediate number will have three 3s: 33374.

For the second part we need to find the smallest repunit that 16687 (half of 33374) divides exactly into. The first thing we need to do is to decompose 16687 into its prime factors. 16687 = 11 x 37 x 41.

11 itself IS a repunit, specifically the second repunit, so the number of 1s we need must be even. From the fact that 37 divides into 111, the number of 1s must also be a multiple of 3.

We can use modular arithmetic to find the first repunit that 41 divides into:

1(mod41), *10+1=11

11=11(mod41), *10+1=111

111=29(mod41), *10+1=291

291=4(mod41), *10+1=41

41=0(mod41)

Therefore 41 divides into the fifth repunit 11111 (in fact it’s 271 x 41), and so the number of 1s in the final answer will also be a multiple of 5.

Since these 2, 3 and 5 are relatively prime, their lowest common multiple is merely their product: 30. So our number will have 30 1s, followed by 33374, so 35 digits altogether:

 

11,111,111,111,111,111,111,111,111,111,133,374