login
Numbers whose sum of base-2 digits is 1 more than their sum of base-3 digits.
2

%I #14 Aug 09 2024 03:31:29

%S 3,9,15,28,29,39,45,57,82,83,84,85,94,95,99,110,118,119,123,135,162,

%T 163,165,174,175,183,207,219,248,297,303,315,324,325,334,335,342,343,

%U 363,382,383,406,407,411,423,435,441,447,459,488,494,496,497,502,503,506,508,509,543,570,571,573,603

%N Numbers whose sum of base-2 digits is 1 more than their sum of base-3 digits.

%C Numbers k such that A000120(k) = A053735(k) + 1.

%H Robert Israel, <a href="/A375257/b375257.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 15 is a term because 15 = 1111_2 = 120_3 so A000120(15) = 1+1+1+1 = 4 and A053735(15) = 1+2+0 = 3.

%p filter:= proc(n) convert(convert(n,base,2),`+`) = convert(convert(n,base,3),`+`)+1 end proc:

%p select(filter, [$1..1000]);

%t Select[Range[600], Subtract @@ DigitSum[#, {2, 3}] == 1 &] (* _Amiram Eldar_, Aug 08 2024 *)

%o (Python)

%o from sympy.ntheory import digits

%o def ok(n): return sum(digits(n, 2)[1:]) == sum(digits(n, 3)[1:]) + 1

%o print([k for k in range(604) if ok(k)]) # _Michael S. Branicky_, Aug 08 2024

%o (PARI) isok(k) = sumdigits(k,2) == 1 + sumdigits(k, 3); \\ _Michel Marcus_, Aug 08 2024

%Y Cf. A000120, A037301, A053735, A180017.

%K nonn,base

%O 1,1

%A _Robert Israel_, Aug 07 2024