A266798 Least positive integer N such that n+N has the same digits as n and N together (without counting repetitions).
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
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
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
-
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
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
Comments