cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A266798 Least positive integer N such that n+N has the same digits as n and N together (without counting repetitions).

This page as a plain text file.
%I A266798 #23 Dec 13 2022 16:27:36
%S A266798 10,100,100,100,100,100,100,100,100,89,99,1000,1000,818,1000,1000,
%T A266798 1000,1000,168,90,100,1000,1000,1000,1000,727,336,247,1000,899,100,
%U A266798 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
%N A266798 Least positive integer N such that n+N has the same digits as n and N together (without counting repetitions).
%C A266798 Such an N always exists since 10^(1 + number of digits of n) satisfies the property.
%C A266798 a(n) = 1 for almost all n (in the sense of natural density). - _Charles R Greathouse IV_, Nov 15 2022
%C A266798 What is the largest number in this sequence? It is somewhere between a(9911111111) = 302345678 and 203456789111111111. - _Charles R Greathouse IV_, Dec 09 2022
%H A266798 Robert Israel, <a href="/A266798/b266798.txt">Table of n, a(n) for n = 0..10000</a>
%F A266798 a(n) <= 10^(1 + number of digits of n).
%F A266798 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
%p A266798 digs:= proc(n) option remember;
%p A266798   local t;
%p A266798   t:= n mod 10;
%p A266798   if n < 10 then {t}
%p A266798   else {t} union procname((n-t)/10)
%p A266798   fi;
%p A266798 end proc:
%p A266798 f:= proc(n)
%p A266798   local k,Ln;
%p A266798   Ln:= digs(n);
%p A266798   for k from 1 do
%p A266798      if Ln union digs(k) = digs(n+k) then return k fi
%p A266798   od
%p A266798 end proc:
%p A266798 seq(f(n),n=0..100); # _Robert Israel_, Jan 03 2016
%o A266798 (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))
%o A266798 (Python)
%o A266798 from itertools import count
%o A266798 def a(n):
%o A266798     digs = set(str(n))
%o A266798     return next(N for N in count(1) if digs | set(str(N)) == set(str(n+N)))
%o A266798 print([a(n) for n in range(60)]) # _Michael S. Branicky_, Nov 15 2022
%Y A266798 Cf. A266586, A266578.
%K A266798 nonn,base
%O A266798 0,1
%A A266798 _M. F. Hasler_, Jan 01 2016