login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Smallest k such that 5^k has exactly n 5's in its decimal representation.
1

%I #13 Dec 13 2024 19:16:40

%S 1,6,14,27,30,41,65,66,54,83,73,109,102,112,118,106,187,159,175,204,

%T 209,174,222,278,234,327,266,300,369,318,310,339,350,377,301,357,426,

%U 411,446,421,434,452,490,525,494,521,554,543,514,503

%N Smallest k such that 5^k has exactly n 5's in its decimal representation.

%H Harvey P. Dale, <a href="/A063590/b063590.txt">Table of n, a(n) for n = 1..500</a>

%t a = {}; Do[k = 1; While[ Count[ IntegerDigits[5^k], 5] != n, k++ ]; a = Append[a, k], {n, 1, 50} ]; a

%t With[{tbl=Table[{k,DigitCount[5^k,10,5]},{k,600}]},Table[SelectFirst[tbl,#[[2]]==n&],{n,50}]][[;;,1]] (* This program is many times more efficient than the first Mathematica program above. *) (* _Harvey P. Dale_, Dec 13 2024 *)

%K base,nonn

%O 1,2

%A _Robert G. Wilson v_, Aug 10 2001

%E Name corrected by _Jon E. Schoenfield_, Jun 26 2018