Processing math: 100%

Thursday, November 7, 2019

Prepending and appending a repunit with the same number

Consider a repunit R(n) of n digits in decimal, i,e, the number consisting of n 1's which is equal to (10n1)/9. If we append and prepend R(n) with the same number k, which we will denote as  k|R(n)|k with | denoting concatenation of digits, will k|R(n)|k be prime? For instance, for k = 324 and n = 1111, k|R(n)|k=3241111324=22×112×281×23831. It turns out that if n is a power of 2, then k needs to have at least n digits for k|R(n)|k to be prime. In particular, we have the following result:

Theorem: If 2r is the largest power of 2 that divides n and k has at most 2r1 digits, then k|R(n)|k is not prime. This is true even if some of the digits of k are leading zeros.

Proof: If k has m digits, then k|R(n)|k=k(10n+m+1)+R(n)10m which is a multiple of gcd(R(n),10n+m+1).

Since 102r1=(102r11)×(102r1+1) and 9 does not divide 10n+1, by induction it is easy to show that 102w+1 is a divisor of  R(2r) for 1w<r. Since R(2r) is a divisor of R(2rs), 102w+1 is also a divisor of R(2rs).

For 1m<2r, let t be the 2-adic valuation (or 2-adic order) of m, i.e. t is the largest integer such that 2t divides m. This means that  0t<r.

Then 102rs+m+1=102tq+1=(102t)q+1 for some odd number q.

Since the sum of two odd powers aq+bq is divisible by a+b, this implies that 102rs+m+1 is divisible by 102t+1.

This implies that for n=2rs and for all 1m<2r, gcd(R(n),10n+m+1)102t+1>1, i.e. k|R(n)|k is not prime. QED

For example, for n = 32, the smallest k such that k|R(n)|k is prime is k = 10000000000000000000000000000077, a number with 32 digits. The smallest such k for different n's can be found in OEIS sequence A263182 (see also OEIS sequence A329121).

No comments:

Post a Comment