A298982 a(n) is the least k for which the most significant decimal digits of k/n (disregarding any leading zeros) are n, or 0 if no such k exists.
0, 0, 1, 0, 0, 4, 5, 7, 0, 1, 0, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 5, 0, 0, 0, 7, 0, 8, 0, 9, 0, 0, 11, 0, 0, 13, 14, 0, 0, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 33, 34, 35, 36, 0, 39, 4, 41, 0, 44, 45, 0, 48, 49, 51, 52, 54, 55, 0, 58, 6, 61, 63, 64, 66, 68, 69, 71, 73, 74, 76, 78, 8, 81, 83, 85, 87, 89, 91, 93, 95, 97, 0, 1
Offset: 1
Examples
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.
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)
Programs
-
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]
-
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
Comments