login
A266798
Least positive integer N such that n+N has the same digits as n and N together (without counting repetitions).
4
10, 100, 100, 100, 100, 100, 100, 100, 100, 89, 99, 1000, 1000, 818, 1000, 1000, 1000, 1000, 168, 90, 100, 1000, 1000, 1000, 1000, 727, 336, 247, 1000, 899, 100, 1000, 1000, 1000, 1000, 1000, 326, 636, 1000, 899, 100, 1000, 1000, 1000, 1000, 405, 1000, 227, 1000, 545, 100, 1000, 1000, 1000, 450, 494, 1000, 1000, 1000, 899
OFFSET
0,1
COMMENTS
Such an N always exists since 10^(1 + number of digits of n) satisfies the property.
a(n) = 1 for almost all n (in the sense of natural density). - Charles R Greathouse IV, Nov 15 2022
What is the largest number in this sequence? It is somewhere between a(9911111111) = 302345678 and 203456789111111111. - Charles R Greathouse IV, Dec 09 2022
LINKS
FORMULA
a(n) <= 10^(1 + number of digits of n).
a(n) <= 203456789111111111 < 2.04 * 10^17. (This can probably be improved by a few orders of magnitude.) - Charles R Greathouse IV, Nov 15 2022
MAPLE
digs:= proc(n) option remember;
local t;
t:= n mod 10;
if n < 10 then {t}
else {t} union procname((n-t)/10)
fi;
end proc:
f:= proc(n)
local k, Ln;
Ln:= digs(n);
for k from 1 do
if Ln union digs(k) = digs(n+k) then return k fi
od
end proc:
seq(f(n), n=0..100); # Robert Israel, Jan 03 2016
PROG
(PARI) a(n, d=digits(n), L=10^(1+#d))=for(k=1, L, Set(digits(k+n))==Set(concat(d, digits(k)))&&return(k))
(Python)
from itertools import count
def a(n):
digs = set(str(n))
return next(N for N in count(1) if digs | set(str(N)) == set(str(n+N)))
print([a(n) for n in range(60)]) # Michael S. Branicky, Nov 15 2022
CROSSREFS
Sequence in context: A119589 A316915 A352575 * A268449 A289826 A309390
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Jan 01 2016
STATUS
approved