Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

The Sum of Digits of $N$ and $N 2$: January 2010

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/45897038

The sum of digits of $n$ and $n^2$

Article · January 2010


Source: arXiv

CITATIONS READS

6 719

3 authors:

Kevin G. Hare Shanta Laishram


University of Waterloo Indian Statistical Institute
92 PUBLICATIONS   649 CITATIONS    56 PUBLICATIONS   302 CITATIONS   

SEE PROFILE SEE PROFILE

Thomas Stoll
University of Lorraine
52 PUBLICATIONS   226 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Self Affine Sets View project

Odd Perfect Numbers View project

All content following this page was uploaded by Thomas Stoll on 05 May 2014.

The user has requested enhancement of the downloaded file.


THE SUM OF DIGITS OF n AND n2

KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

Abstract. Let sq (n) denote the sum of the digits in the q-ary
arXiv:1001.4170v1 [math.NT] 23 Jan 2010

expansion of an integer n. In 2005, Melfi examined the structure


of n such that s2 (n) = s2 (n2 ). We extend this study to the more
general case of generic q and polynomials p(n), and obtain, in
particular, a refinement of Melfi’s result. We also give a more
detailed analysis of the special case p(n) = n2 , looking at the
subsets of n where sq (n) = sq (n2 ) = k for fixed k.

1. Introduction
Let q ≥ 2 and denote by sq (n) the sum of digits in the q-ary represen-
tation of an integer n. Recently, considerable progress has been made
towards understanding the interplay between the sum-of-digits of some
algebraically defined sequences, such as primes [5] and polynomials [1]
or, in particular, squares [6]. In the latter, C. Mauduit and J. Rivat
proved an asymptotic expansion of the sum of digits of squares [6] in
arithmetic progressions. Their proof heavily relies on good estimates
of quadratic Gauss sums. For the case of general polynomials p(n) of
degree h > 2 there is still a great lack of knowledge regarding their
distribution with respect to digitally defined functionals [1].
Several authors studied the pointwise properties and relationships
of sq (p(n)), e.g., K. Stolarsky [8], B. Lindström [4], G. Melfi [7], and
M. Drmota and J. Rivat [2]. In particular, a conjecture of Stolarsky [8]
about some extremal distribution properties of the ratio sq (p(n))/sq (n)
has been recently settled by the authors [3]. Melfi [7] proposed to study
the set of n’s such that s2 (n2 ) = s2 (n), and he obtained that

(1) # n < N : s2 (n2 ) = s2 (n) ≫ N 1/40 .
Using heuristic arguments, Melfi conjectured a much stronger result
that
 Nβ
(2) # n < N : s2 (n2 ) = s2 (n) ≈
log N
with β ≈ 0.75488 . . . , giving an explicit formula for β. The aim of the
present paper is to provide a generalization to general p(n) and base q
K.G. Hare was partially supported by NSERC.
Computational support provided by CFI/OIT grant.
Th. Stoll was partially supported by an APART grant of the Austrian Academy
of Sciences.
1
2 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

of Melfi’s result as well as to use the method of proof to sharpen Melfi’s


exponent in (1). Moreover, we provide a local analogon, i.e., getting
a lower bound for the number of n’s such that sq (n2 ) = sq (n) = k for
some fixed k.
Theorem 1.1. Let p(x) ∈ Z[x] have degree at least 2, and positive
leading coefficient. Then there exists an explicitly computable γ > 0,
dependent only on q and p(x), such that
 
q−1
(3) # n < N, q ∤ n : |sq (p(n)) − sq (n)| ≤ ≫ Nγ,
2
where the implied constant depends only on q and p(x).
This result is given in Section 2. In the general case of q-ary digits
and polynomials p(x), the bound (q − 1)/2 in (3) cannot be improved.
This is easily seen by recalling the well-known fact
(4) sq (n) ≡ n mod (q − 1).
Indeed, if we set p(x) = (q − 1)x2 + x + a for a ∈ N then we find that
sq (p(n)) − sq (n) ≡ p(n) − n ≡ a mod (q − 1)
which could be any of 0, 1, . . . , q − 2 depending only on the choice of a.
The method of proof of Theorem (1.1) allows to improve on Melfi’s
result (1).
Theorem 1.2.

(5) # n<N : s2 (n2 ) = s2 (n) ≫ N 1/19 .
Following on Melfi’s paper [7], we examine the case when p(n) = n2
and q = 2 in more detail. We consider the set of all n’s such that
s2 (n) = s2 (n2 ), and partition the set into the subsets dependent upon
the value of s2 (n). By noticing that s2 (n) = s2 (2n) and s2 (n2 ) =
s2 ((2n)2 ) we see that we can restrict our attention to odd n.
Theorem 1.3. Let k ≤ 8. Then
{n < N, n odd : s2 (n2 ) = s2 (n) = k}
is a finite set.
This was done by explicit computation of all such n which are given
in Tables 1 and 2. A discussion of how these computations were made
is given in Section 3.
Based on these initial small values of k, one might expect that this
is always true. Let
(6) n(2) = 1101111 |00 .{z
. . 00} 1101111
r

be written in base 2. Then s2 (n) = s2 (n2 ) = 12 for all r ≥ 8. This is


in fact a special case of a more general property.
THE SUM OF DIGITS OF n AND n2 3

Theorem 1.4. Let k ≥ 16 or k ∈ {12, 13}. Then


{n < N, n odd : s2 (n2 ) = s2 (n) = k}
is an infinite set.
The proof of this result is given in Section 4. Despite of great effort
we are not able to decide the finiteness problem in the remaining cases
k ∈ {9, 10, 11, 14, 15}. However, we will comment on some heuristic
evidence that it seems unlikely that there are infinitely many solutions
in the cases k = 9 and k = 10, respectively, in Section 5.
Somewhat surprisingly, a similar answer can be given if q ≥ 3.
Theorem 1.5. Let q ≥ 3 and assume
k ≥ 94(q − 1).
Then the equation
(7) sq (n2 ) = sq (n) = k
has infinitely many solutions in n with q ∤ n if and only if
(8) k(k − 1) ≡ 0 mod (q − 1).
We show this result in Section 6.
2. Proof of Theorems 1.1 and 1.2
Following Lindström [4] we say that terms are noninterfering if we
can use the following splitting formulæ:
Proposition 2.1. For 1 ≤ b < q k and a, k ≥ 1,
(9) sq (aq k + b) = sq (a) + sq (b),
(10) sq (aq k − b) = sq (a − 1) + (q − 1)k − sq (b − 1).
Proof. See [3]. 
Proof of Theorem 1.1: The proof uses a construction of a sequence
with noninterfering terms which has already been used in [3]. However,
to obtain the bound N γ in (3) instead of a logarithmic bound, we have
to make a delicate refinement. To begin with, define the polynomial
tm (x) = mx4 + mx3 − x2 + mx + m
where m ∈ Z. Set m = q l − r with 1 ≤ r ≤ ⌊q αl ⌋, q ∤ r and 0 < α < 1.
Obviously, for α < 1 there exists l0 (α) such that for all l > l0 (α) we
have m ≥ 3. Furthermore let k be such that q k > m. By consecutively
employing (9) and (10) we see that
sq (tm (q k )) = (q − 1)k + sq (m − 1) + 3sq (m)
= (q − 1)k + sq (q l − (r + 1)) + 3sq (q l − r)
(11) = (q − 1)k + (q − 1)l − sq (r) + 3((q − 1)l − sq (r − 1))
≤ (q − 1)k + 4(q − 1)l.
4 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

First consider the easier case of monomials p(n) = nh , h ≥ 2 where we


can give a somewhat more direct proof. We have
tm (x)h = (mx4 + mx3 − x2 + mx + m)h
(12)
4h
X
= cj,h(m)xj
j=0
  
h 4h h h
h 4h−1 h−1
= m x + hm x + m − hm x4h−2
2
     
h h h h−1
+ h+ m −2 m x4h−3 + smaller powers.
3 2
From [3] we have that tm (x)h has only positive coefficients, which are
bounded by (2mh)h . This means that sq (tm (q k )h ) does not depend on
k if k is sufficiently large (see (9)). More precisely, if q k > (2mh)h
(note that a sufficient condition for this is k ≥ (h + 1)l) then we get
for sufficiently large l and a symmetry argument for the coefficients of
tm (x)h ,
   
k h h h h h h−1
sq (tm (q ) ) ≥ 2 sq (m ) + sq (hm ) + sq m − hm
2
     
h h h h−1
(13) +sq h+ m −2 m .
3 2
Consider the first summand sq (mh ) in (13). We have
h  
h l h
X h
m = (q − r) = (−1)h−j q jl r h−j
j=0
j
h
X
(14) = (−1)h−j dj q jl
j=0

which shows that mh is a polynomial in q l with coefficients of alternat-


ing signs. Now there are exactly ⌊h/2⌋ negative signs in this expansion.
All coefficients in (14) are bounded in modulus by
0 < dj ≤ (2r)h ≤ (2q αl )h ≤ q (αl+1)h ,
and in turn their q-ary sum of digits is less than sq (dj ) ≤ (q−1)(αl+1)h.
Therefore, by (10), we get that for fixed α < 1/h and sufficiently large
l we have
sq (mh ) ≥ ⌈h/2⌉(q − 1)l − ⌈h/2⌉(q − 1)(αl + 1)h
h
(15) ≥ (q − 1)(l(1 − αh) − h).
2
THE SUM OF DIGITS OF n AND n2 5

A similar argument can be applied to the other three summands in (13).


This yields
(16) sq (tm (q k )h ) ≥ 4h(q − 1)(l(1 − αh) − h).
Therefore, for each sufficiently large l we can find k with
q−1
(17) |sq (tm (q k )h ) − sq (tm (q k ))| ≤
2
provided that k ≥ (h + 1)l and
(q − 1)k + 4(q − 1)l ≤ 4h(q − 1)(l(1 − αh) − h).
Note that these conditions allow to successively increase k (see (11)) in
order that sq (tm (q k )) and sq (tm (q k )h ) differ by at most (q − 1)/2. For
sufficiently large l these two conditions translate into
(18) (h + 1)l ≤ 4l(h(1 − αh) − 1) − 4h2 .
Take α = 1/(5h2 ) < 1/h. It is then a direct calculation to verify
that (18) is true for all h and sufficiently large l. Summing up, we have
obtained that for sufficiently large l we can find ≫ q αl values r where
we in turn can provide a value k with (17). In addition, each triple
(l, r, k) gives rise to a different value of tm (q k ). We thus have (3).
Now consider the case of a general polynomial p(x) = ah xh +ah−1 xh−1 +
· · · + a0 ∈ Z[x]. There exist positive integers s1 and s2 , both only de-
pending on the polynomial p(x) such that
p(q s1 x + q s2 + 1) = a′h xh + a′h−1 xh−1 + · · · + a′0
has only positive coefficients. With the notation of (12) we obtain
(19)
3
X
p(q s1 tm (x) + q s2 + 1) = a′h c4h−i,h (m) x4h−i
i=0
7
X 
+ a′h c4h−i,h (m) + a′h−1 c4h−i,h−1(m) x4h−i
i=4
+ smaller powers.
First suppose h ≥ 4. By choosing s1 sufficiently large (this choice again
only depends on p(x)) we get that the coefficients of xj in p(q s1 tm (x) +
q s2 + 1) with 4h − 7 ≤ j ≤ 4h are polynomials in m of degree h since we
can avoid unwanted cancellation for these coefficients. The coefficients
of these terms (as polynomials in m) are alternating in sign, since for
h ≥ 4 and i = 0, 1, . . . , 2h − 1 we have
h
X
(20) ci,h (m) = c4h−i,h (m) = dj,i,h mj
j=h−⌊i/2⌋

where dj,i,h dj+1,i,h < 0 for all j with h − ⌊i/2⌋ ≤ j < h. Setting
m = q l −r we therefore can choose s1 , s2 in the way that a′h c4h−i,h (m)+
6 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

a′h−1 c4h−i,h−1 (m) as a polynomial in q l has ⌈h/2⌉ negative coefficients


for each = 0, 1, . . . , 2h − 1. Now, for q s2 + 1 < q s1 , we get by (11) that

sq (q s1 tm (q k ) + q s2 + 1) ≤ (q − 1)k + 4(q − 1)l + 2.

In (19) we have therefore found eight summands sharing the property


of the eight summands in the monomial case (see (13)). From this we
proceed as as in the case of monomials to get the statement.
It remains to deal with the cases of general quadratic and cubic
polynomials, where we cannot directly resort to (20) (note that 8 >
(2h − 1) + 1 for h = 2, 3). We instead do a more direct calculation.
Let h = deg p = 2 which is the case of quadratic polynomials. By
suitably shifting the argument x 7→ q s1 x + q s2 + 1 we can arrange for a
polynomial p(q s1 x + q s2 + 1) = a′2 x2 + a′1 x + a′0 with a′2 , a′1 , a′0 > 0 and
2a′2 > a′1 . Each coefficient of xi in p(q s1 tm (x) + q s2 + 1), 0 ≤ i ≤ 8, is a
function of m and of a′2 , a′1 and a′0 . In a similar way as before (here we
use 9 summands instead of the 8 in the case of h ≥ 4) we obtain for
sufficiently large l,

sq (p(q s1 tm (q k ) + q s2 + 1)) > 8(q − 1)l ≥ 4h(q − 1)l.

Now we can choose k suitably to get the assertion. Finally, for a cubic
polynomial, we are able to achieve p(q s1 x + q s2 + 1) = a′3 x3 + a′2 x2 +
a′1 x+a′0 with a′3 , a′2 , a′1 , a′0 > 0 and 3a′3 > a′2 . Then, each coefficient of xi
in p(q s1 tm (x) + q s2 + 1), 0 ≤ i ≤ 12, is a function of m and a′3 , a′2 , a′1 , a′0 ,
and thus we get for sufficiently large l,

sq (p(q s1 tm (q k ) + q s2 + 1)) > 12(q − 1)l ≥ 4h(q − 1)l.

By choosing k suitably, we obtain the result. This completes the proof


of Theorem 1.1. 

Proof of Theorem 1.2: We apply the method of proof of Theorem 1.1


to the special case q = 2 and p(n) = n2 . Instead of using the rather
crude bounds, we here use exact values to get our result. To begin
with, we observe that the largest coefficient (as m → ∞) of tm (x)2 is the
coefficient of x4 , namely 4m2 +1. Therefore we get noninterfering terms
when 2k ≥ 4m2 +1. A sufficient condition for this is 2k ≥ 4·22l = 22l+2 ,
or equivalently,

(21) k ≥ 2l + 2.

On the other hand, the coefficients of x8 and x7 (resp. x1 and x0 )


in tm (x)2 are m2 and 2m2 which have the same binary sum of digits.
Now assume α < 1/2 and l > l0 (α) be sufficiently large. We then use
THE SUM OF DIGITS OF n AND n2 7

Proposition 2.1 and set m = 2l − r with 1 ≤ r ≤ ⌊2αl ⌋ to obtain


(22) s2 (tm (2k )2 ) ≥ 4s2 (m2 ) + s2 (4m2 + 1)

= 5s2 (2l−1 − r)2l+1 + r 2 + 1
≥ 5s2 (2l−1 − r)
= 5 ((l − 1) − s2 (r − 1))
≥ 5(l − 1) − 5αl
≥ (2 + ε)l
for any 0 < ε < 1/2. This means that for any α < 1/2 we have ≫ q αl
values r where we in turn can provide a value k satisfying (17) which
is due to
2l + 2 ≤ k ≤ (2 + ε)l.
This yields
tm (q k ) ≤ 2q 4k+l ≤ 2q 4(2+ε)l+l ≤ q (9+5ε)l .
Hence, letting N = q (9+5ε)l we note that we have
 1
αl
αl
≫q = N (9+5ε)l = N α/(9+5ε) ≥ N 1/19
solutions to (17). This finishes the proof. 

3. Proof of Theorem 1.3


The proof that there is only a finite number of odd n such that
s2 (n2 ) = s2 (n) ≤ 8 is a strictly computational one. We discuss how
our algorithm works.
Consider
Xk
n= 2 ri = 2 r1 + 2 r2 + · · · + 2 rk
i=1
with 0 = r1 < r2 < r3 < · · · < rk . We have
X k
k X k
X k X
X k
2 ri +rj 2ri
n = 2 = 2 + 2ri +rj +1 .
i=1 j=1 i=1 i=1 j=i+1

We therefore need to examine the exponents


{2r1 , 2r2 , . . . , 2rk , r1 + r2 + 1, r1 + r3 + 1, . . . , rk−1 + rk + 1}
and the possible iterations between these exponents by carry propaga-
tion.
Clearly, 2r1 is the strict minimum within these exponents. Other
relationships between exponents are not as clear. For example, r1 +
r3 + 1 could be less than, equal to, or greater than 2r2 depending on
the choices of r3 and r2 . Each of these cases must be examined in
turn. Numerous of these inequalities have implications for the order
of other exponents in the binary expansion of n2 . So, once we make
an assumption in our case by case analysis, this might rule out future
8 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

possibilities. For example, if we assume that 2r3 < 1 + r1 + r4 , then


we have as a consequence that 1 + r2 + r3 < 1 + r1 + r4 (by noticing
that r2 < r3 ). In the case of equality we “group” terms. For example,
if we assumed that 2r3 = 1 + r2 + r4 , then we could, first, replace all
occurrences of r2 with 2r3 − 1 − r4 , and second replace 22r3 + 21+r2 +r4
by 22r3 +1 .
Our algorithm occasionally finds a solution set with fractional or
negative values for ri , which is a contradiction. On the other hand,
it is possible for the algorithm to find a solution, even if all of the
exponents cannot be explicitly determined. This would happen if there
is an infinite family of n with s2 (n2 ) = s2 (n) = k with some nice
structure, (as is the case for k = 12, see (6)). The algorithm will
detect, and report this. We used the method for k up to 8. For each of
these values, there was only a finite number of n, and all of them are
enumerated in Tables 1 and 2.

4. Proof of Theorem 1.4


For the proof of Theorem 1.4, we first state some auxiliary results.
Denote by (n)2 the binary representation of n, and 1(k) a block of k
binary 1. We begin with the following key observation.
Proposition 4.1. If there exists u and v such that s2 (u) + s2 (v) =
s2 (u2 ) + s2 (uv) + s2 (v 2 ) = k, then for i sufficiently large, the numbers
of the form (n)2 = u0i v satisfy s2 (n2 ) = s2 (n) = k.
Proof. This follows at once from Proposition 2.1, relation (9). 
We use Proposition 4.1 to prove the following lemma.
Lemma 4.2. Let (u)2 = 1(k1 ) 01(n1 ) and (v)2 = 1(k2 ) 01(n2 ) . Assume
that n1 ≥ k1 + 2, n2 ≥ k2 + 2 and n1 ≥ n2 . Then
s2 (u2 ) = n1 and s2 (v 2 ) = n2 ,
and 
k1 + 2 if n2 = k1 + 1, n1 = n2 + k2 + 1

s2 (uv) = n2 + 1 if n2 > k1 + 1, n1 = n2 + k2 + 1

n + 1 if k = k , n > n .
1 1 2 1 2

Proof. Let (U)2 = 1(k) 01(n) with n ≥ k+2. Then U = 2n −1+2n+1 (2k −
1) and we calculate
U 2 = 22n − 2n+1 + 1 + 2n+2 (2n+k − 2n − 2k + 1) + 22n+2 (22k − 2k+1 + 1)
= 1 + 2n+1 + 22n + 2n+k+2 (1 + 2 + 22 + · · · + 2n+k−1 ) − 22n+k+2
= 1 + 2n+1 + 2n+k+2 + · · · + 22n−1 + 22n+k+2 + 22n+k+3 + · · · + 22n+2k+1 .
Hence s2 (U 2 ) = n and therefore s2 (u2 ) = n1 and s2 (v 2 ) = n2 .
THE SUM OF DIGITS OF n AND n2 9

Base 10 Base 2 Base 10 Base 2

s2 (n) = s2 (n2 ) = 1 s2 (n) = s2 (n2 ) = 7


1 1 127 1111111
319 100111111
s2 (n) = s2 (n2 ) = 2 351 101011111
3 11 375 101110111
379 101111011
s2 (n) = s2 (n2 ) = 3 445 110111101
7 111 575 1000111111
637 1001111101
s2 (n) = s2 (n2 ) = 4 815 1100101111
15 1111 1087 10000111111
1149 10001111101
s2 (n) = s2 (n2 ) = 5 1255 10011100111
31 11111 1815 11100010111
79 1001111 2159 100001101111
91 1011011 2173 100001111101
157 10011101 2297 100011111001
279 100010111 2921 101101101001
4191 1000001011111
s2 (n) = s2 (n2 ) = 6 4207 1000001101111
63 111111 4345 1000011111001
159 10011111 6477 1100101001101
183 10110111 8689 10000111110001
187 10111011 10837 10101001010101
287 100011111 16701 100000100111101
317 100111101 18321 100011110010001
365 101101101 33839 1000010000101111
573 1000111101
1071 10000101111
1145 10001111001
1449 10110101001
4253 1000010011101
4375 1000100010111
4803 1001011000011

Table 1. Odd n such that s2 (n2 ) = s2 (n) ≤ 7.

Now, consider s2 (uv). We have

uv =1 + 2n1 + 2n2 + 2n1 +n2 − 2n1 +k1 +1 − 2n2 +k2 +1 − 2n1 +n2 +k1 +1 −
2n1 +n2 +k2 +1 + 2n1 +n2 +k1 +k2 +2 .
10 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

Base 10 Base 2 Base 10 Base 2

s2 (n) = s2 (n2 ) = 8 s2 (n) = s2 (n2 ) = 8 (cont)


255 11111111 5811 1011010110011
639 1001111111 5865 1011011101001
703 1010111111 5911 1011100010111
735 1011011111 5971 1011101010011
751 1011101111 6479 1100101001111
759 1011110111 6557 1100110011101
763 1011111011 8415 10000011011111
893 1101111101 8445 10000011111101
975 1111001111 8697 10000111111001
1151 10001111111 10035 10011100110011
1215 10010111111 11591 10110101000111
1277 10011111101 11597 10110101001101
1455 10110101111 13233 11001110110001
1463 10110110111 13591 11010100010111
1495 10111010111 16575 100000010111111
1501 10111011101 16607 100000011011111
1599 11000111111 16889 100000111111001
1647 11001101111 17393 100001111110001
1661 11001111101 22807 101100100010111
2175 100001111111 23441 101101110010001
2301 100011111101 23575 101110000010111
2685 101001111101 25907 110010100110011
2919 101101100111 33777 1000001111110001
2987 101110101011 46377 1011010100101001
3259 110010111011 46881 1011011100100001
4223 1000001111111 51811 1100101001100011
4349 1000011111101 66173 10000001001111101
4601 1000111111001 67553 10000011111100001
4911 1001100101111 69521 10000111110010001
5069 1001111001101 133231 100000100001101111
5231 1010001101111 227393 110111100001000001
5799 1011010100111 266335 1000001000001011111

Table 2. Odd n such that s2 (n2 ) = s(n) = 8.

We may assume that k1 ≥ k2 . Then


W := 2n1 +n2 +k1 +k2 +2 − 2n1 +n2 +k2 +1 − 2n1 +n2 +k1 +1
= 2n1 +n2 +k2 +1 (1 + 2 + · · · + 2k1 −k2 −1 + 2k1 −k2 +1 + · · · + 2k1 )

has s2 (W ) = k1 . We distinguish three cases to conclude:


THE SUM OF DIGITS OF n AND n2 11

(1) Let n1 = n2 + k2 + 1 and n2 = k1 + 1. Then uv = 1 + 2n2 + W


and hence s2 (uv) = k1 + 2.
(2) Let n1 = n2 + k2 + 1 and n2 > k1 + 1. Then uv = 1 + 2n2 + W +
2n1 +k1 +1 (2n2 −k1 −1 − 1) and hence s2 (uv) = 2 + k1 + n2 − k1 − 1 =
n2 + 1.
(3) Let k1 = k2 = k and n1 > n2 . Then uv = 1 + 2n2 + 2n1 + W +
2n2 +k+1(2n1 −k−1 − 1) − 2n1 +k+1 and hence s2 (uv) = 3 + k + n1 −
k − 2 = n1 + 1.
This finishes the proof. 

Proof of Theorem 1.4. Let n1 , n2 , k1 , k2 be positive integers with n1 ≥


k1 + 2, n2 ≥ k2 + 2 and u, v be as in Lemma 4.2. Let (N)2 = u0R v
be the binary representation of N where R ≥ n1 + n2 + k1 + k2 . By
Proposition 4.1 and Lemma 4.2 we have for any R ≥ n1 + n2 + k1 + k2 ,
s2 (N) = s2 (u) + s2 (v) = n1 + n2 + k1 + k2 ,
s2 (N 2 ) = s2 (u2 ) + s2 (v 2 ) + s2 (uv) = n1 + n2 + s2 (uv).
Let k ≥ 2. Taking k1 = k2 = k and n1 = n2 = 2k, we find from Lemma
4.2 and 2k ≥ k + 2 that
s2 (N 2 ) = s2 (N) = 6k
implying there are infinite families of n such that s2 (n) = s2 (n2 ) = s
for s of the form 6k with k ≥ 2.
Let k2 = 2, k1 ≥ 3, n2 = k1 + 2 and n1 = n2 + k2 + 1 = k1 + 4. Then
s2 (uv) = n2 +1 by Lemma 4.2 implying s2 (N 2 ) = s2 (N) = 3(k1 +2)+1.
Hence there are infinite families of n such that s2 (n) = s2 (n2 ) = s for
s of the form 3k + 1 with k ≥ 5.
Let k1 ≥ k2 ≥ 3 and n2 = k1 + k2 − 1, n1 = n2 + k2 + 1. Then
s2 (uv) = n2 + 1 = k1 + k2 from Lemma 4.2 implying s2 (N 2 ) = s2 (N) =
3k1 + 4k2 − 1. Let k2 = 3. Then s2 (N 2 ) = s2 (N) = 3(k1 + 3) + 2 for
k1 ≥ 3 giving infinite families of n such that s2 (n) = s2 (n2 ) = s for s
of the form 3k + 2 with k ≥ 6.
Let k2 = 4. Then s2 (N 2 ) = s2 (N) = 3(k1 + 5) for k1 ≥ 4 giving
infinite families of n such that s2 (n) = s2 (n2 ) = s for s of the form 3k
with k ≥ 27.
Summing up, we have infinite families of n with s(n2 ) = s(n) = s for
all s ≥ 22, respectively, s ∈ {12, 16, 18, 19, 20}. For s ∈ {13, 17, 21},
we take (N)2 = u0R v with
s = 13 : u = 10111, v = 10110111111
s = 17 : u = 111011111, v = 10110111111
s = 21 : u = 11110111111, v = 111101111111.
This completes the proof of Theorem 1.4. 
12 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

Base 10 Base 2

u s2 (u) s2 (u2)
23 10111 4 3
47 101111 5 4
111 1101111 6 4
95 1011111 6 5
5793 1011010100001 6 5
223 11011111 7 5
727 1011010111 7 5
191 10111111 7 6
367 101101111 7 6
415 110011111 7 6
1451 10110101011 7 6
46341 1011010100000101 7 6
479 111011111 8 5
447 110111111 8 6
887 1101110111 8 6

Table 3. s2 (u) ≤ 8, s2 (u2 ) < s2 (u) and s2 (u2 ) ≤ 6.

5. Evidence that s2 (n2 ) = s2 (n) ≤ 10 is finite


All examples of infinite families with s2 (n2 ) = s2 (n) = k have the
form given from Lemma 4.1. We show that there do not exists u and v
satisfying Proposition 4.1, with k ∈ {9, 10}. We illustrate this method
for k = 8, as it contains all of the key ideas without being overly
cumbersome. The case of k = 8 is actually proved to be finite by the
techniques of Section 3, but this does not detract from this example.
The other two cases are similar.
Assume the contrary, that there exists u and v such that

s2 (u) + s2 (v) = s2 (u2 ) + s2 (v 2 ) + s2 (uv) = 8

We easily see that s2 (v), s2 (u) ≥ 2. Furthermore, as s2 (u), s2 (v) ≥


2, we see that s2 (u2 ), s2 (v 2 ) ≥ 2. Also, we have that s2 (uv) ≥ 2.
Therefore, we have 2 ≤ s2 (u2 ), s2 (v 2 ) ≤ k − 4. Lastly, we see that one
of u or v must be “deficient”, that s2 (u2 ) < s2 (u) or s2 (v 2 ) < s2 (v).
Assume without loss of generality that s2 (u2 ) < s2 (u). Given the
restrictions, we have that 2 ≤ s2 (u) ≤ 6. Using the same algorithm as
in Section 3, we can find all u such that 2 ≤ s2 (u) ≤ 6 and s2 (u2 ) <
s2 (u), s2 (u2 ) ≤ 4. These are the first three entries of Table 3.
Therefore, it suffices to show that there do not exists v for u = 23, 47
or 111 with s2 (u) + s2 (v) = s2 (u2 ) + s2 (v 2 ) + s2 (uv) = 8.
THE SUM OF DIGITS OF n AND n2 13

(1) Let u = 23 = 10111. Given that s2 (uv) ≥ 2 we have that


s2 (v) = 4 and s2 (v 2 ) ≤ 3. The only possible solution by Table 3
is v = 23 = 10111, but s2 (uv) = 3, a contradiction.
(2) Let u = 47 = 101111. Given that s2 (uv) ≥ 2 we have that
s2 (v) = 3 and s2 (v 2 ) ≤ 2. There are no solutions by Table 3 for
this, a contradiction.
(3) Let u = 111 = 11101111. Given that s2 (uv) ≥ 2 we have that
s2 (v) = 2 and s2 (v 2 ) ≤ 2. There is one possible solution to
this by Table 3, namely v = 3 = 11. But then s2 (uv) = 5, a
contradiction.
A similar, but more elaborate analysis can be done for k = 9 and
k = 10 using the additional information in Table 3. Here we look at
2 ≤ s2 (u) ≤ 7, s2 (u2 ) < s2 (u) and s2 (u2 ) ≤ 5.
6. Proof of Theorem 1.5
The proof uses the strategy adopted for the case q = 2 (see Section 3).
However, in order to handle more possible digits in the case of q ≥ 3,
the analysis is much more delicate. In the proof we will make frequent
use of the fact (4) and of the splitting formulae of Proposition 2.1,
which will apply if we have noninterfering terms at our disposal.
To begin with, the condition (8) is necessary, since (7) implies
sq (n2 ) − sq (n) ≡ n2 − n ≡ k 2 − k ≡ 0 mod (q − 1).
For the construction of an infinite family, we first prove a crucial lemma.
Lemma 6.1. Let
u = ((q − 1)k 0 (q − 1)n e)q
with k ≥ 2, n ≥ k + 2 and 0 ≤ e ≤ q − 2. Then
sq (u) = (q − 1)(n + k) + e
and
sq (u2 ) = (q − 1)(n + 1) + f (q, e)
where
(23) f (q, e) = sq ((q − e)2 ) + sq (2(q − 1)(q − e)) − sq (2(q − e) − 1).
Proof. Since u = e + (q n − 1)q + (q k − 1)q n+2 , we get
u2 = (q − e)2 + 2(q − 1)(q − e)q n+1 − 2(q − e)q n+k+2
(24) + (q − 1)2 q 2n+2 − 2(q − 1)q 2n+k+3 + q 2n+2k+4 .
By assumption that n ≥ k + 2 and n, k ≥ 2, the terms in (24) are
noninterfering. We therefore get
sq (u2 ) = sq ((q − e)2 ) + sq (2(q − 1)(q − e)) − sq (2(q − e) − 1) + (n − k)(q − 1)
+ sq ((q − 1)2 − 1) − sq (2(q − 1) − 1) + (k + 1)(q − 1).
= (n + 1)(q − 1) + sq (q 2 − 2q) − sq (2q − 3) + f (q, e).
14 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

The claimed value of sq (u2) now follows by observing that sq (q 2 −2q) =


sq (q − 2) = q − 2 and sq (2q − 3) = sq (q + q − 3) = 1 + q − 3 = q − 2. 

Now consider

u = ((q − 1)k1 0 (q − 1)n1 )q ,


v = ((q − 1)k2 0 (q − 1)n2 e)q

where we suppose k1 , n1 , k2 , n2 ≥ 2 and n1 ≥ k1 + 2, n2 ≥ k2 + 2.


Since q ∤ n we further suppose that e 6= 0. We want to construct an
infinite family of solutions to (7) of the form n = (u0(i) v), where i is a
sufficiently large integer, such that terms will be noninterfering. Our
task is to find an admissible set of parameters k1 , n1 , k2 , n2 such that
for sufficiently large n1 + n2 + k1 + k2 we have

sq (u) + sq (v) = sq (u2 ) + sq (2uv) + sq (v 2 )


(25) = e + (q − 1)(n1 + n2 + k1 + k2 ).

First it is a straightforward calculation to show that 2uv = w1 + w2


with

(26) w1 = 2q n1 +n2 +k1 +k2 +3 − 2(q − 1)q n1 +n2 +k1 +2 − 2(q − 1)q n1 +n2 +k2 +2

and

w2 = 2(q − 1)2 q n1 +n2 +1 − 2(q − e)q n1 +k1 +1 − 2q n2 +k2 +2


(27) + 2(q − 1)(q − e)q n1 + 2(q − 1)q n2 +1 + 2(q − e).

Note that w1 and w2 are noninterfering because of k2 ≥ 2. Now, set

(28) k1 = n2 ≥ k2 + 2, n1 = 2k2 − α,

where we will later suitably choose α = α(q, e) only depending on q


and e. Then terms in (26) are again noninterfering and we get

sq (w1 ) = sq (2q k1 +1 − 2(q − 1)q k1 −k2 − 2(q − 1))


= sq (2q k2 +1 − 2q + 1) + (q − 1)(k1 − k2 ) − sq (2q − 3)
= 1 + k2 (q − 1) + (q − 1)(k1 − k2 ) − (q − 2)
= (k1 − 1)(q − 1) + 2.

Next, by (28), we find that

w2 = 2q k1 +2k2 −α+1 ((q − 1)2 − (q − e)) − 2q k1 +k2 +2


(29) + 2(q − 1)(q − e)q 2k2 −α + 2(q − 1)q k1 +1 + 2(q − e).
THE SUM OF DIGITS OF n AND n2 15

In order to have terms noninterfering in (29), we impose the following


inequalities on the parameters,
(30) 2 ≤ k1 + 1,
(31) 2 ≤ (2k2 − α) − (k1 + 1),
(32) 3 ≤ (k1 + k2 + 2) − (2k2 − α) = k1 − k2 + 2 + α,
(33) 1 ≤ (k1 + 2k2 − α + 1) − (k1 + k2 + 2) = k2 − α − 1.
Then we get
s(w2 ) = (k2 − α − 1)(q − 1) + g(q, e)
where
g(q, e) = sq (2(q − e)) + sq (2(q − 1)) + sq (2(q − 1)(q − e))
(34) + sq (2(q − 1)2 − (q − e) − 1) − 1.
Summing up, we have
sq (u2 ) + sq (2uv) + sq (v 2 )
= (q − 1)(n1 + 1) + f (q, e) + (q − 1)(n2 + 1) + (k1 − 1)(q − 1)
+ 2 + (k2 − α − 1)(q − 1) + g(q, e)
= (q − 1)(2k1 + 3k2 − 2α) + f (q, e) + g(q, e) + 2.
Combining with (25) and (28) we therefore have
(35)
(q − 1)(2k1 + 3k2 − 2α) + f (q, e) + g(q, e) + 2 = (q − 1)(2k1 + 3k2 − α) + e
and
α(q − 1) = f (q, e) + g(q, e) − e + 2.
Rule (4) applied to (23) and (34) shows that the right hand side is
indeed divisible by q − 1 since e2 − e ≡ 0 mod (q − 1) by assumption.
Furthermore, we have by a crude estimation (using also (4)) that
(36) 0 ≤ α ≤ 15.
Suppose k2 ≥ 17. Then (30) and (33) are satisfied. Rewriting (31)
and (32) gives
(37) 1 + k2 − α ≤ k1 ≤ 2k2 − α − 1.
Note that k1 ≥ k2 +2 is more restrictive than the first inequality in (37).
On the other hand, since k2 ≥ 2, the interval given for k1 in (37) has at
least (2 · 17 − α − 1) − (1 + 17 − α) + 1 = 16 terms. Therefore, 2k1 + 3k2
hits all integers ≥ 2(1 + (k2 + 1) − α) + 3(k2 + 1) for k2 ≥ 17. Thus,
we find from (35) that all values
(q − 1)(2k1 + 3k2 − α) + e ≥ (q − 1)(2 · (19 − 0) + 3 · 18) + (q − 1)
= 94(q − 1)
can be achieved. This completes the proof of Theorem 1.5.
16 KEVIN G. HARE, SHANTA LAISHRAM, AND THOMAS STOLL

References
[1] C. Dartyge, G. Tenenbaum, Congruences de sommes de chiffres de valeurs poly-
nomiales, Bull. London Math. Soc. 38 (2006), no. 1, 61–69.
[2] M. Drmota, J. Rivat, The sum-of-digits function of squares, J. London Math.
Soc. (2) 72 (2005), no. 2, 273–292.
[3] K. G. Hare, S. Laishram, T. Stoll, Stolarsky’s conjecture and the sum of digits
of polynomial values, submitted, arxiv.org.
[4] B. Lindström, On the binary digits of a power, J. Number Theory 65 (1997),
321–324.
[5] C. Mauduit, J. Rivat, Sur un probléme de Gelfond: la somme des chiffres des
nombres premiers, Annals of Mathematics, to appear.
[6] C. Mauduit, J. Rivat, La somme des chiffres des carrés, Acta Mathematica, 203
(2009), 107–148. .
[7] G. Melfi, On simultaneous binary expansions of n and n2 , J. Number Theory
111 (2005), no. 2, 248–256.
[8] K. B. Stolarsky, The binary digits of a power, Proc. Amer. Math. Soc. 71 (1978),
1–5.

Department of Pure Mathematics, University of Waterloo, Water-


loo, Ontario, Canada, N2L 3G1,
E-mail address: kghare@math.uwaterloo.ca

Department of Mathematics, Indian Institute of Science Education


and Research, Bhopal, 462 023, India,
E-mail address: shanta@iiserbhopal.ac.in

Institut de Mathématiques de Luminy, Université de la Méditerranée,


13288 Marseille Cedex 9, France,
E-mail address: stoll@iml.univ-mrs.fr

View publication stats

You might also like