Solution:
The number of positive integers n with properties (a) and (b) is 3k−1.
To prove this, consider the integer 5n and let a0,a1,…,ak−1 be its digits, that is
5n=ak−110k−1+…+a110+a0
By (b) the digits ai are all odd, that is ai∈{1,3,5,7,9} for every i=0,1,…,k−1.
Since n in base 10 has exactly k digits, we deduce that ak−1=1, because otherwise, if ak−1>1, we would have
n=5⋅5n≥5⋅ak−110k−1≥10k
that is, n would have at least k+1 digits.
Moreover, observe that for every integer a we have 5a=2a−110+5, so in our case, recalling that ak−1=1, it holds that
n=5⋅5n=5(ak−110k−1+⋯+a110+a0)=5ak−110k−1+5ak−210k−2⋯+5a110+a0=5⋅10k−1+(2ak−2−110+5)10k−2+⋯+(2a1−110+5)10+2a0−110+5=5⋅10k−1+2ak−2−110k−1+5⋅10k−2+⋯+2a1−1102+5⋅10+2a0−110+5=(5+2ak−2−1)10k−1+(5+2ak−3−1)10k−2+⋯+(5+2a1−1)102+(5+2a0−1)10+5
What is written above, since the ai are odd digits, is the decimal representation of n, because
0≤5+2ai−1≤9 and 2ai−1 is an integer for every i=0,…,k−2.
Since by (a) n has k odd digits, we deduce that 5+2ai−1−1 must be odd for i=1,…,k−1, that is, ai can only take the values 1,5 and 9.
There are thus at most three ways to choose ai,i=0,…,k−2, while ak−1=1, that is, there are at most 3k−1 candidates for 5n and hence for n.
The explicit formula (1) also shows that every such choice gives a number n satisfying (a) and (b).
It thus remains proven that such numbers are exactly 3k−1.