OFFSET
1,12
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..2000
EXAMPLE
39*17 = 663 has digits in nonincreasing order, and no k < 17 has this property, hence a(39) = 17.
MATHEMATICA
a[n_] := a[nn_] := Block[{n = nn, f, w = Range@9, k = 1}, While[Mod[n, 10] == 0, n /= 10]; While[(f = Select[w, Max@ Differences@ IntegerDigits[n*#] <= 0 &, 1]) == {}, k++; w = Union@ Flatten@Table[ Select[d*10^(k-1) + w, Max@ Differences@ IntegerDigits[Mod[n*#, 10^k], 10, k] <= 0 &], {d, 0, 9}]]; f[[1]]]; Array[a, 123] (* faster than basic approach. Giovanni Resta, Mar 26 2013 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paul Tek, Mar 20 2013
STATUS
approved