login
Numbers n such that 2*n contains one more 1 than does n in its decimal representation.
1

%I #11 Oct 22 2024 18:33:48

%S 5,6,7,8,9,50,52,53,54,60,62,63,64,65,66,67,68,69,70,72,73,74,75,76,

%T 77,78,79,80,82,83,84,85,86,87,88,89,90,92,93,94,95,96,97,98,99,205,

%U 206,207,208,209,255,256,257,258,259,305,306,307,308,309,355,356,357,358,359,405,406,407,408

%N Numbers n such that 2*n contains one more 1 than does n in its decimal representation.

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

%F A376165(a(n)) = 2 * a(n).

%F A268643(2 * a(n)) = 1 + A268643(a(n)).

%e a(3) = 7 is a term because 2*7 = 14 has one 1 while 7 has none.

%e a(107) = 551 is the first term that contains a 1; it is a term because 2 * 551 = 1102 has two 1's while 551 has one.

%p select(t -> numboccur(1,convert(2*t,base,10)) = 1 + numboccur(1,convert(t,base,10)), [$1..1000]);

%t Select[Range[410], Count[IntegerDigits[2#],1]-Count[IntegerDigits[#],1]==1 &] (* _Stefano Spezia_, Oct 22 2024 *)

%o (Python)

%o from gmpy2 import digits

%o def ok(n): return digits(2*n).count("1") - digits(n).count("1") == 1

%o print([k for k in range(410) if ok(k)]) # _Michael S. Branicky_, Oct 22 2024

%Y Cf. A268643, A376165.

%K nonn,base,look

%O 1,1

%A _Robert Israel_, Oct 22 2024