OFFSET
11,1
COMMENTS
Leading zeros are not allowed.
a(n) = -1 if n is even and only its last digit is even, or if n is divisible by 5 and only its last digit is divisible by 5.
LINKS
Robert Israel, Table of n, a(n) for n = 11..10000
EXAMPLE
a(124) = 4712 because 4712 = 38 * 124 starts with 4, ends with 12, and is the smallest number that works.
MAPLE
f:= proc(n) local x, da, db, a, b, K, m, k, r, v;
r:= infinity;
for db from 1 to ilog10(n) do
b:= n mod 10^db; a:= (n-b)/10^db;
da:= ilog10(a)+1;
if b < 10^(db-1) then next fi;
K:= map(t -> rhs(op(t)), [msolve(x*n=a, 10^da)]);
for k in K do
for m from k by 10^da do
v:= m*n;
if v >= r then break fi;
if floor(v/10^(ilog10(v)+1-db)) = b then r:= v; break fi;
od od;
od;
if r = infinity then -1 else r fi
end proc:
map(f, [$11 .. 1000]);
CROSSREFS
KEYWORD
AUTHOR
Robert Israel, Apr 20 2026
STATUS
approved
