OFFSET
1,6
COMMENTS
By decimal digits we mean those of the fractional part of k/n. Otherwise said, we require floor(10^m*k/n) = n for some k < n and m.
It appears that the asymptotic density of 0's is slightly below 45%: The number of 0's among a(1..10^k) is (5, 42, 461, 4553, 45423, 451315, 4506142, 45017570, ...). Is there a simple estimate for the exact value? - M. F. Hasler, Feb 01 2018
There may be no asymptotic density: the fraction of 0's fluctuates too much. See the linked plot.
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..10000
Robert Israel, Plot: Fraction of 0's in a(1) to a(n)
EXAMPLE
a(1) = 0 since there does not exist any k such that k/1 has a decimal digit which begins with 1 (cf. comment).
a(6) = 4 since 4/6 = 0.666... and its decimal digit begins with 6.
a(28) = 8 since 8/28 = 0.28571428571428... even though 1/28 = 0.0357142857142857... has "28" as a subsequence.
MAPLE
f:= proc (n) local m, k;
for m from ceil(log[10](n^2)) by -1 to 1 do
k := ceil(n^2/10^m);
if n <= k then return 0 end if;
if k < n*(n+1)/10^m then return k end if
end do;
0
end proc:
map(f, [$1..200]); # Robert Israel, Feb 09 2018
MATHEMATICA
f = Compile[{{n, _Integer}}, Block[{k = 1, il = IntegerLength@ n}, While[m = 10^il*k/n; While[ IntegerLength@ Floor@ m < il, m *= 10]; k < n && Floor[m] != n, k++]; If[k < n, k, 0]]]; Array[f, 100]
PROG
(PARI) A298982(n, k=(n^2-1)\10^(logint(n, 10)+1)+1)={k*10^(logint((n^2-(n>1))\k, 10)+1)\n==n && return(k\10^valuation(k, 10))} \\ M. F. Hasler, Feb 01 2018
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
STATUS
approved