login
Numbers k such that 2^k, 5^k and 8^k have the same first digit.
1

%I #42 Dec 26 2022 11:30:24

%S 0,5,15,98,108,118,191,201,211,284,294,304,387,397,407,480,490,500,

%T 583,593,603,676,686,696,779,789,872,882,892,965,975,985,1068,1078,

%U 1088,1161,1171,1181,1264,1274,1284,1357,1367,1377,1450,1460,1470,1553,1563,1573,1646,1656,1666

%N Numbers k such that 2^k, 5^k and 8^k have the same first digit.

%C The first digit of 2^k is A008952(k) = floor(10^{k*log_10(2)}), the first digit of 5^k is A111395(k) = floor(10^{k*log_10(5)}), and the first digit of 8^k is A008952(3*k) = floor(10^{k*log_10(8)}), where "{x}" denotes the fractional part of x.

%C All numbers 2^k, 5^k, 8^k for k = a(n) > 0 start only with 3.

%C From _Jianing Song_, Dec 26 2022: (Start)

%C Write lg = log_10. Note that {k*lg(5)} = 1 - {k*lg(2)} and that {k*lg(8)} = {k*lg(2)} + 0, 1, or 2, so we have {k > 0 : 2^k, 5^k, 8^k all start with a} = {k: {k*lg(2)} is in I_a}, where I_a = (lg(a), lg(a+1)) intersect (1-lg(a+1), 1-lg(a)) intersect (((lg(a))/3, (lg(a+1))/3) U ((lg(a)+1)/3, (lg(a+1)+1)/3) U ((lg(a)+2)/3, (lg(a+1)+2)/3)). Note that I_3 = ((lg(3)+1)/3, 1-lg(3)) and I_a is empty otherwise (since (lg(a), lg(a+1)) intersect (1-lg(a+1), 1-lg(a)) is empty). As a result, k > 0 is a term if and only if (lg(3)+1)/3 < {k*lg(2)} < 1-lg(3).

%C Except for 0, also numbers k in A358196 such that 2^k starts with 3 (see the comment in A358196).

%C Claim: for n > 1, a(n+1) - a(n) = 10, 73, or 83. Proof: write a = (lg(3)+1)/3, b = 1-lg(3).

%C Step 1. If k > 0 is a term, then:

%C (a) {k*lg(2)} is in (a, b-(10*lg(2)-3)) => {(k+10)*lg(2)} is in (a+(10*lg(2)-3), b) => k+10 is a term;

%C (b) {k*lg(2)} is in (a+(25-83*lg(2)), b) => {(k+83)*lg(2)} is in (a, b-(25-83*lg(2))) => k+83 is a term.

%C Note that (a, b-(10*lg(2)-3)) U (a+(25-83*lg(2)), b) = (a, b), so at least one of k+10 and k+83 is a term.

%C Step 2. If k > 0 and k+m are both terms, 0 < m <= 83, then {k*lg(2)} and {(k+m)*lg(2)} are both in (a, b), so m*lg(2) is the range (N-(b-a), N+(b-a)) for some integer N, which implies that m = 10, 20, 73, or 83.

%C Note that if {k*lg(2)} < 1 - 2*(10*lg(2)-3), then {(k+10)*lg(2)} = {k*lg(2)} + (10*lg(2)-3), {(k+20)*lg(2)} = {k*lg(2)} + 2*(10*lg(2)-3), so {k*lg(2)} < {(k+10)*lg(2)} < {(k+20)*lg(2)}, which means that if k and k+20 are both terms, so is k+10. This shows that the next term after k is either 10, 73, or 83 larger.

%C We can show similarly that, for k > 0 being a term of this sequence:

%C (a) if k+73 is a term, then k+83 is a term;

%C (b) if k+83 is a term, then k+93 is a term;

%C (c) if k+166 is a term, then k+73 is a term;

%C (d) if k+10, k+73 are not terms (i.e., the next term is k+83), then k+176, k+196 are terms.

%C As a result, if we write out the sequence of the first differences, 73 is always followed by two 10's, and 83 is followed by one or two 10's; 83, 10, 10 is always followed by 73, 10, 10, and 83, 10 is always followed by 83, 10, 10. (End)

%e 5 is a term because the first digit of 2^5 = 32, 5^5 = 3125, 8^5 = 32768 is 3.

%e 15 is a term because the first digit of 2^15 = 32768, 5^15 = 30517578125, 8^15 = 35184372088832 is 3.

%p ld:= n -> floor(n/10^ilog10(n)):filter:= proc(k) local d;

%p d:= ld(2^k);

%p ld(5^k) = d and ld(8^k) = d

%p end proc:select(filter, [$0..2000]); # _Robert Israel_, Nov 02 2022

%t Select[Range[0, 1666], Equal @@ IntegerDigits[{2, 5, 8}^#][[;; , 1]] &] (* _Amiram Eldar_, Nov 02 2022 *)

%o (Python)

%o def ok(n): return str(2**n)[0] == str(5**n)[0] == str(8**n)[0]

%o print([k for k in range(1667) if ok(k)]) # _Michael S. Branicky_, Nov 03 2022

%Y Intersection of A088935 and A358196.

%Y Cf. A008952, A111395.

%K nonn,base

%O 1,2

%A _Alexander M. Domashenko_, Nov 02 2022