Large and small gaps between consecutive Niven numbers

Jean-Marie De Koninck^{1} and Nicolas Doyon Département de mathématiques et de statistique Université Laval Québec G1K 7P4 Canada jmdk@mat.ulaval.ca doyon@dms.umontreal.ca

Abstract A positive integer is said to be a Niven number if it is divisible by the sum of its decimal digits. We investigate the occurrence of large and small gaps between consecutive Niven numbers.

1 Introduction

A positive integer n is said to be a Niven number (or a Harshad number) if it is divisible by the sum of its (decimal) digits. For instance, 153 is a Niven number since 9 divides 153, while 154 is not. Niven numbers have been extensively studied; see for instance Cai [1], Cooper and Kennedy [2], Grundman [5] or Vardi [6].

Let N(x) denote the number of Niven numbers ≤ x. Recently, De Koninck and Doyon proved [3], using elementary methods, that given any ε > 0,

x^{1−ε} ≪ N(x) ≪ \frac{x log log x}{log x}.

Later, using complex variables as well as probabilistic number theory, De Koninck, Doyon and Kátai [4] showed that

N(x) = (c + o(1))\frac{x}{log x},  (1)

1Research supported in part by a grant from NSERC.

where c is given by

c = \frac{14}{27} log 10 ≈ 1.1939.  (2)

In this paper, we investigate the occurrence of large gaps between consecutive Niven numbers. Secondly, denoting by T (x) the number of Niven numbers n ≤ x such that n + 1 is also a Niven number, we prove that

T (x) ≪ \frac{x log log x}{(log x)^{2}}.

We conclude by stating a conjecture.

2 Main results

Given a positive integer ℓ, let n_{ℓ} be the smallest positive integer n such that the interval [n, n + ℓ − 1] does not contain any Niven numbers.

Theorem 1. If ℓ is sufficiently large, then

n_{ℓ} < (100(ℓ + 2))^{ℓ+3}.

Theorem 2. As x → ∞,

T (x) ≪ \frac{x log log x}{(log x)^{2}}.

3 The search for large gaps between consecutive Niven numbers

It follows from the fact that the set of Niven numbers is of zero density that there exist arbitrarily long intervals free of Niven numbers.

Denote by n = n(k) the smallest Niven number such that n + k is also a Niven number while each one of n + 1, n + 2, …, n + k − 1 is not. The following table provides the value of n(k) when k is a multiple of 10 up to 120.

\begin{matrix}k & n(k) \\ 10 & 90 \\ 20 & 7560 \\ 30 & 28680 \\ 40 & 119772 \\ 50 & 154876 \\ 60 & 297864 \end{matrix}  \begin{matrix}k & n(k) \\ 70 & 968760 \\ 80 & 7989168 \\ 90 & 2879865 \\ 100 & 87699842 \\ 110 & 497975920 \\ 120 & 179888904 \end{matrix}

We shall now show how one can construct arbitrary large intervals free of Niven numbers, say intervals of length ℓ, and thereby establish the proof of Theorem 1.

First, given a positive integer m, set

t = t(m) = ⌊\frac{log(18m)}{log 10}⌋ + 1,  (3)

where ⌊y⌋ stands for the largest integer ≤ y, and let m be the smallest positive integer satisfying

\frac{9m − 9t − 1}{9t + 2} > ℓ.  (4)

Then consider integers n which can be written as the concatenation of the numbers 10^{m} − 1 and d, where d is a t digit number yet to be determined, that is the m + t digit number

n = ⟨\underbrace{99 ⋯ 9}_{m}, d⟩ = (10^{m} − 1) · 10^{t} + d.  (5)

Then let b · 9m be the smallest multiple of 9m located in the interval

I = [\underbrace{99 ⋯ 9}_{m} \underbrace{00 ⋯ 0}_{t} , \underbrace{99 ⋯ 9}_{m+t}].

Note that at least two such multiples of 9m belong to I since the length of I is 10^{t}, which itself is larger than 18m because of (3).

We now count the number of Niven numbers belonging to the interval

J := [b · 9m, (b + 1) · 9m[⊂ I.

For any positive integer n of the form (5), it is clear that n ∈ I and thus that s(n) can take at most 9t + 1 values ranging from 9m to 9m + 9t. It follows that for any fixed value of s(n), there is at most one multiple of s(n) in the interval J, and therefore that there exist at most 9t + 1 Niven numbers in J.

We have thus created an interval J of length 9m containing at most 9t+1 Niven numbers, and therefore, by a pigeon-hole argument, containing a subinterval free of Niven numbers

and of length at least \frac{9m − 9t − 1}{9t + 2}, which is larger than ℓ by condition (4), thus completing our task of constructing arbitrarily large intervals free of Niven numbers.

For example, if we require gaps of width ℓ = 100, 200 and 300 respectively, free of Niven numbers, here is a table showing the corresponding values of m and t, as well as the length of the interval J which needs to be investigated to find the proper gap.

ℓ  m t length of J
100 416 4  3744
200 1028 5  9252
300 1539 5  13851

The good news about this algorithm is that by scanning relatively small intervals (of length O(ℓ log ℓ)), we are guaranteed arbitrary large gaps. The bad news is that gaps this large are more likely to occur much sooner, as is shown, for instance, in the first table of this section in the case ℓ = 100. Nevertheless, our algorithm provides a non trivial bound on n_{ℓ}, which is precisely the object of Theorem 1 which now becomes easy to proves. Indeed, if ℓ is large enough, we have in view of (4)

\frac{9m − 9t}{9t} < ℓ + 1,

so that

m < \frac{m}{t} < ℓ + 2.

Therefore, using (3) and (5), we have

n_{ℓ} < 10^{m+t} = 10^{\frac{m+t}{t} ·t} = 10^{(\frac{m}{t} +1)·t} < 10^{(ℓ+3)·t} < 10^{(ℓ+3)( \frac{log m}{log 10} +2)} < 10^{(ℓ+3)( \frac{log(ℓ+2)}{log 10} +2)}
= e^{log(ℓ+2)^{ℓ+3}} · 10^{2(ℓ+3)} = (ℓ + 2)^{ℓ+3} · 10^{2(ℓ+3)} = (100(ℓ + 2))^{ℓ+3} ,

which proves Theorem 1.

4 Small gaps between consecutive Niven numbers

It follows from (1) that the sum of the reciprocals of the Niven numbers diverges, and in fact that

∑_{n≤x n Niven number} \frac{1}{n} = (c + o(1)) log log x,

where c is given by (2).

We shall call twin Niven numbers those pairs (n, n + 1), such as (20,21) and (152,153), both members of which are Niven numbers. We can show that the sum of the reciprocals of twin Niven numbers converges. In fact, we can establish that if T stands for the set of twin Niven numbers (n, n + 1) and

T (x) := #{n ≤ x : (n, n + 1) ∈ T },

then

T (x) = O (\frac{x log log x}{(log x)^{2}}) ,

which is precisely the statement of Theorem 2 and which implies that

∑_{{n \atop (n,n+1)∈T}} \frac{1}{n} < +∞.  (6)

Indeed, using Theorem 2, one can write that

∑_{{n≤x \atop (n,n+1)∈T}} \frac{1}{n} = ∑_{{n \atop (n,n+1)∈T}} \frac{1}{n} − ∑_{{n>x \atop (n,n+1)∈T}} \frac{1}{n} = c_{2} + O (\frac{log log x}{log x}) ,

where

c_{2} = 1+ \frac{1}{2} + \frac{1}{3} +⋯+ \frac{1}{9} + \frac{1}{20} + \frac{1}{80} + \frac{1}{110} + \frac{1}{111} + \frac{1}{132} + \frac{1}{152} + \frac{1}{200} + \frac{1}{209} + \frac{1}{224} + \frac{1}{399} +⋯ ≈ 3.07,

which in particular implies (6).

Before we prove Theorem 2, note that it is easy to show that T is an infinite set. This can be established by observing that 2 divides 2·10^{k} and 3 divides 2·10^{k} +1 for each positive integer k.

On the other hand, using a computer, one can obtain the following table:

\begin{matrix}x & T (x) \\ 10 & 9 \\ 100 & 11 \\ 1000 & 32 \end{matrix}  \begin{matrix}x & T (x) \\ 10^{4} & 145 \\ 10^{5} & 904 \\ 10^{6} & 6 191 \end{matrix}  \begin{matrix}x & T (x) \\ 10^{7} & 44 742 \\ 10^{8} & 332 037 \\ 10^{9} & 2 551 917 \end{matrix}

We now move to prove (6).

Let (n, n + 1) ∈ T and assume that n is a K-digit number, with K ≥ 2. Write n as

n = a · 10^{R+B} + b · 10^{R} + 10^{R} − 1,  (7)

where a is a K − B − R digit number and b is a B digit number not ending with a 9. Here B and R are non negative integers; later, we shall set B as a function of K. Now, observe that s(n) = s(a) + s(b) + 9R and that s(n + 1) = s(a) + s(b) + 1. Since (n, n + 1) ∈ T, we have

s(n)|a · 10^{R+B} + b · 10^{R} + 10^{R} − 1 and s(n + 1)|a · 10^{R+B} + b · 10^{R} + 10^{R}.

We therefore have

\{ \begin{matrix}b · 10^{R} ≡ −a · 10^{R+B} − 10^{R} + 1 (mod s(n)), \\ b · 10^{R} ≡ −a · 10^{R+B} − 10^{R} (mod s(n + 1)). \end{matrix}

Since s(n) and s(n + 1) are relatively prime, we can use the Chinese Remainder Theorem to state that there exists one (and only one) non negative integer m < s(n)s(n + 1), where m = m(a, R, B, s(n), s(n + 1)), such that

b · 10^{R} ≡ m (mod s(n)s(n + 1)).  (8)

Observing that (n, 10^{R}) = 1 and s(n)|n, we have that (s(n), 10^{R}) = 1. Hence it follows from

(8) that there exists one (and only one) non negative integer m′ < \frac{s(n)s(n + 1)}{(s(n + 1), 10^{R})}, where

m′ = m′(a, R, B, s(n), s(n + 1)), satisfying the congruence

b ≡ m′ (mod \frac{s(n)s(n + 1)}{(s(n + 1), 10^{R})}).  (9)

Assume for now that the integers K, R, a, B and s(b) are all fixed. Since s(n) = s(a) + s(b) + 9R and s(n + 1) = s(a) + s(b) + 1, the number of b’s satisfying (9) is less than

\frac{10^{B} (s(n + 1), 10^{R})}{s(n)s(n + 1)} + 1.

Now, as the value of s(b) varies from 0 to 9B − 1, the number Γ = Γ(K, R, a, B) of suitable b’s ( that is, those satisfying (9), for K, R, a and B fixed, satisfies

Γ ≤ ∑_{0≤s(b)≤9B−1} (\frac{10^{B}(s(b) + s(a) + 1, 10^{R})}{(s(a) + 9R)(s(a) + 1)} + 1) .

We then have, letting k = s(b),

Γ ≤ ∑_{d|10^{R}} ∑_{{0≤k≤9B−1 \atop (k+s(a)+1,10^{R})=d}} (\frac{10^{B} · d}{(s(a) + 9R)(s(a) + 1)} + 1) .

It follows that

Γ ≤ ∑_{d|10^{R}} (\frac{9B}{d} + 1) (\frac{10^{B} · d}{(s(a) + 9R)(s(a) + 1)} + 1)

≤ \frac{(R + 1)^{2} · 9B · 10^{B}}{(s(a) + 9R)(s(a) + 1)} + \frac{5}{2} \frac{10^{R} · 10^{B}}{(s(a) + 9R)(s(a) + 1)} + (9B + 1)(R + 1)^{2}.

Set B := ⌊log K⌋. If R > 2 log K, the number of n’s satisfying (7) is O(10^{K}/K^{2}). Therefore we may also assume that R ≤ 2 log K. If s(a) ≤ K/2, one can show that the number of n’s satisfying (7) is O(10^{Kη}) for some positive η < 1. Hence we can make the assumption that s(a) > K/2. We then get that, if B ≥ 1,

Γ ≤ \frac{5 · 10^{B}((R + 1)^{2} · 9B + 2 · 10^{R})}{K^{2}}.

From these observations, it follows that

T (10^{K}) ≤ ∑_{R≤2 log K} \frac{10^{K}}{10^{R+B}} \frac{5 · 10^{B}}{K^{2}} ((R + 1)^{2} · 9B + 2 · 10^{R})

= 5\frac{10^{K}}{K^{2}} ∑_{R≤2 log K} (9B \frac{(R + 1)^{2}}{10^{R}} + 2)

≪ \frac{10^{K} log K}{K^{2}} .

Thus, given an arbitrary large x, if we choose K = ⌊\frac{log x}{log 10}⌋, Theorem 2 follows immediately.

5 Final remarks

Most likely, one can remove the log log x on the right hand side of (6), but we could not prove this.

On the other hand, it has been shown by Grundman [5] that, given an integer ℓ, 2 ≤ ℓ ≤ 20, one could find an infinite number of Niven numbers n such that n + 1, n + 2, …, n + ℓ − 1 are also Niven numbers (and that there does not exist 21 consecutive numbers which are all Niven numbers). For each integer ℓ ∈ [2, 20], if we denote by T_{ℓ}(x) the number of Niven numbers n ≤ x such that n + 1, n + 2, …, n + ℓ − 1 are also Niven numbers, we conjecture that

T_{ℓ}(x) ≪ \frac{x}{log^{ℓ} x}.

6 Acknowledgements

The authors would like to thank the referee for several helpful comments which greatly improved the quality of this paper.

References

[1] T. Cai, On 2-Niven numbers and 3-Niven numbers, Fibonacci Quart. 34 (1996), 118–120.

[2] C. N. Cooper and R. E. Kennedy, On consecutive Niven numbers, Fibonacci Quart. 21 (1993), 146-151.

[3] J. M. De Koninck and N. Doyon On the number of Niven numbers up to x, Fibonacci Quart., to appear.

[4] J. M. De Koninck, N. Doyon, and I. Kátai, On the counting function for the Niven numbers, Acta Arithmetica 106 (2003), 265–275.

[5] H. G. Grundman, Sequences of consecutive Niven numbers, Fibonacci Quart. 32 (1994), 174–175.

[6] I. Vardi, Niven numbers, §2.3 in Computational Recreations in Mathematics, Addison-Wesley, 1991, pp. 19 and 28–31.

2000 Mathematics Subject Classification: Primary: 11A63, 11A25.

Keywords: Niven numbers.

(Concerned with sequence \underline{A005349}.)

Received October 21, 2002; revised version received June 20, 2003. Published in Journal of Integer Sequences, July 9, 2003.

Return to Journal of Integer Sequences home page.