login
Sum of digits of n in bases 2 and 3.
4

%I #36 Jan 18 2024 02:34:27

%S 0,2,3,3,3,5,4,6,5,3,4,6,4,6,7,7,5,7,4,6,6,6,7,9,6,8,9,5,5,7,6,8,5,5,

%T 6,8,4,6,7,7,6,8,7,9,9,7,8,10,6,8,9,9,9,11,6,8,7,7,8,10,8,10,11,9,5,7,

%U 6,8,8,8,9,11,6,8,9,9,9,11,10,12,10,4,5,7,5,7,8,8,7,9,6,8,8,8,9,11,6,8,9,7

%N Sum of digits of n in bases 2 and 3.

%C Let n = Sum(c(k)*2^k), c(k) = 0,1, be the binary form of n, n = Sum(d(k)*3^k), d(k) = 0,1,2, the ternary form; then a(n) = Sum(c(k)+d(k)).

%C a(n) mod 2 = doubled Thue-Morse sequence A095190.

%C Let s[b](n) denote the sum of the digits of n to the base b. Senge and Straus proved in 1973 that s[a](n) + s[b](n) approaches infinity as n approaches infinity if and only if log(a)/log(b) is irrational. Stewart (1980) obtained an effectively computable lower bound. - _David Radcliffe_, Jan 16 2024

%H N. J. A. Sloane, <a href="/A096288/b096288.txt">Table of n, a(n) for n = 0..10000</a>

%H Jean-Marc Deshouillers, Laurent Habsieger, Shanta Laishram, and Bernard Landreau, <a href="https://doi.org/10.1007/978-3-319-55357-3_9">Sums of the digits in bases 2 and 3</a>, in: C. Elsholtz and P. Grabner (eds.), Number Theory - Diophantine Problems, Uniform Distribution and Applications: Festschrift in Honour of Robert F. Tichy's 60th Birthday, Springer, Cham, 2017, pp. 211-217; <a href="https://arxiv.org/abs/1611.08180">arXiv preprint</a>, arXiv:1611.08180 [math.NT], 2016.

%H H. G. Senge and E. G. Straus, <a href="https://doi.org/10.1007/BF02018464">PV-numbers and sets of multiplicity</a>, Period Math Hung 3 (1973), 93-100.

%H Cameron Stewart, <a href="https://doi.org/10.1515/crll.1980.319.63">On the representation of an integer in two different bases</a>, Journal für die reine und angewandte Mathematik, 319 (1980), 63-72.

%F a(n) = A000120(n) + A053735(n). - _Amiram Eldar_, Jul 28 2023

%F a(n) > (log log n) / (log log log n + C) - 1 for n > 25, where C is effectively computable (Stewart 1980). - _David Radcliffe_, Jan 16 2024

%e n=11: 11=1*2^3+1*2^1+1*2^0, 1+1+1=3, 11=1*3^2+2*3^0, 1+2=3, so a(11)=3+3=6.

%p f := proc(n) local t1,t2,i;

%p t1:=convert(n,base,2); t2:=convert(n,base,3);

%p add(t1[i],i=1..nops(t1))+ add(t2[i],i=1..nops(t2));

%p end; # _N. J. A. Sloane_, Dec 05 2019

%t a[n_] := Total @ IntegerDigits[n, 2] + Total @ IntegerDigits[n, 3];

%t a /@ Range[0, 100] (* _Jean-François Alcover_, Aug 21 2020 *)

%t Table[Total[Flatten[IntegerDigits[n,{2,3}]]],{n,0,100}] (* _Harvey P. Dale_, Jan 29 2021 *)

%o (PARI) a(n) = sumdigits(n, 2) + sumdigits(n, 3); \\ _Michel Marcus_, Aug 21 2020

%o (Python)

%o sumdigits = lambda n, b: n % b + sumdigits(n // b, b) if n else 0

%o a = lambda n: sumdigits(n, 2) + sumdigits(n, 3) # _David Radcliffe_, Jan 16 2024

%Y Cf. A000120, A053735, A095190, A010059, A010060.

%K easy,nonn,base

%O 0,2

%A _Miklos Kristof_, Peter Boros, Jun 24 2004

%E Edited by _N. J. A. Sloane_, Dec 05 2019